Difference between revisions of "ECE434 Project - Vehicle Telemetry"

From eLinux.org
Jump to: navigation, search
(Theory of Operation)
Line 108: Line 108:
 
== Theory of Operation ==
 
== Theory of Operation ==
  
Give a high level overview of the structure of your software. Are you using GStreamer?  Show a diagram of the pipeline. Are you running multiple tasks?  Show what they do and how they interact.
+
For gps, we used gpsd module to get the data from the peripheral. To be specific, we used gpsstream() to read the data from the device.
 +
For IMU, we used I2c to communicate with the device. What we did was simply adding the device tree to the kernel and constantly read the raw data from the device tree and process the data in our program. Save the processed raw data and send it to the Kalman filter.
 +
For CAN, we used python and a can transceiver to communicate with the vehicle. It is able to get the data after sending a request to the vehicle. See CAN_LOG.py
 +
Front End Task: We used canvas to plot the data in the localhost, the port is at 8082 so the website that you need to go to is http://192.168.7.2:8082/ after the server.py and fusionT both starts. In the website, multiple plots can be added to the page upon click on the options e.g. AccelerationX, Acceleration Y, RMP etc.
  
 
== Work Breakdown ==
 
== Work Breakdown ==

Revision as of 14:07, 21 February 2023

thumb‎ Embedded Linux Class by Mark A. Yoder


Team members: Jason Su Harris Wu

Grading Template

I'm using the following template to grade. Each slot is 10 points. 0 = Missing, 5=OK, 10=Wow!

Add Extras

09 Executive Summary
09 Packaging
09 Installation Instructions 
09 User Instructions
09 Highlights
09 Theory of Operation
09 Work Breakdown
09 Future Work/Conclusions
09 Hackster.io
09 Demo/Poster
00 Not Late

Score:  90/100

Executive Summary

Use extended Kalman filter to integrate GPS and IMU data to achieve a decimeter level accuracy for the position and velocity of a vehicle. Combine with data logged from the CAN bus to build a server as a platform for implementing some apps, such as lap time, accel/brake time for analysis purpose. .

Packaging

A beaglebone cape with IMU, GPS and CAN transceiver.

GPS breakout board: https://www.adafruit.com/product/746

IMU breakout board: https://www.amazon.com/HiLetgo-MPU-6050-Accelerometer-Gyroscope-Converter/dp/B078SS8NQV

CAN transceiver: https://www.ti.com/product/SN65HVD230


Installation Instructions

Hardware

1. Connect GPS to UART

2. Connect IMU to I2C2

3. Connect CAN to CAN1

Software

1. Put BB-I2C2-MPU6050 into uEnv.txt and reboot.

2. Get the project:

$ git clone git@github.com:Sqzlnsy/ece434Project.git

3. Run ece434Project/install.sh and you can go to step 7

4. Set up MPU6050 on I2C2 at 0x68:

  $ cd /sys/class/i2c-adapter/i2c-2
  $ echo mpu6050 0x68 > new_device

5. Install gpsd:

  $ sudo apt-get install gpsd

6. Install python-can:

  $ pip install python-can

7. Config gpsd:

  $ nano /etc/default/gpsd

You will see the config file and change DEVICES="/dev/ttyS0" to the port you use. (ttyS0 is uart1)

8. Run setup.sh

git site: https://github.com/Sqzlnsy/ece434Project

User Instructions

1. Go to the project directory

   $ cd ece434Project

1. Run make to compile if needed

   $ make   

3. Check the status gpsd:

  cgps  //It may take a couple of minutes for the GPS to capture enough satellites depending on the weather and area. 

4. Connect to the OBDII port on your car.

5. Check the connection of CAN bus:

  candump can1

6. If you can see gps information using cpgs, and can messages using candump, you are ready to start the program.

7. Run run_background.sh (Terminate the program by run process_terminate.sh)

8. Go to http://192.168.7.2:8081/ to see the real-time visualized data


Highlights

We are almost able to get all the data that OBD2 Interface provides. How OBD2 works is that it listens for request and if you send it a request it will return you a data.

We have both front end task (server.py) and backend task (futionT), front end uses canvas to plot the data which came from back end, it drags multiple lines from the datalog file (see data folder) and plot them all at a specific frequency (see server.sh and js file in the templates)

The back end is the one that consumes the CPU Usage the most. Since this device is used to record the data in the vehicle, we want to ensure that it keeps updating at a certain frequency. The maximum frequency that IMU can sample is 160 Hz, but we noticed that it takes too much CPU usage (>=92%), we lowered this frequency to 100Hz. Another reason why we lowered the frequency is that for our non real time kernels, it is difficult to make the sampling rate exactly as expected.

Include a YouTube demo the audio description.

Theory of Operation

For gps, we used gpsd module to get the data from the peripheral. To be specific, we used gpsstream() to read the data from the device. For IMU, we used I2c to communicate with the device. What we did was simply adding the device tree to the kernel and constantly read the raw data from the device tree and process the data in our program. Save the processed raw data and send it to the Kalman filter. For CAN, we used python and a can transceiver to communicate with the vehicle. It is able to get the data after sending a request to the vehicle. See CAN_LOG.py Front End Task: We used canvas to plot the data in the localhost, the port is at 8082 so the website that you need to go to is http://192.168.7.2:8082/ after the server.py and fusionT both starts. In the website, multiple plots can be added to the page upon click on the options e.g. AccelerationX, Acceleration Y, RMP etc.

Work Breakdown

List the major tasks in your project and who did what.

Also list here what doesn't work yet and when you think it will be finished and who is finishing it.

Future Work

The extended Kalman filter still needs more work to provide higher accuracy.

Conclusions

Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.




thumb‎ Embedded Linux Class by Mark A. Yoder