Commit d65729cbbe9f9e6d1c9280cc38708a1792ca1a86
1 parent
edf655e5
adding some info
Showing
2 changed files
with
7 additions
and
27 deletions
Show diff stats
README.md
1 | 1 | # Carrying out a vehicle datalogger |
2 | 2 | |
3 | 3 | ## Introduction |
4 | + | |
4 | 5 | The goal of this project is to develop a kind of datalogger collecting different peaces of information from OBD-II (On-board diagnostics), GPS, and IMU (Inertial measurement unit) and to store them into a CSV file in an SD card. |
5 | 6 | The developped datalogger has to meet certain requirements to operate. These are: |
6 | 7 | |
... | ... | @@ -10,6 +11,7 @@ The developped datalogger has to meet certain requirements to operate. These are |
10 | 11 | * SD card. |
11 | 12 | |
12 | 13 | ## How to run the project ? |
14 | + | |
13 | 15 | Once you fullfil all the needs above, you clone the depository then you load the `./FreematicsOBD/datalogger/simple_obd_test.ino` using |
14 | 16 | the Freematics Arduino Builder. You choose the appropirate target board. Tick `Rebuild Core` and `Rebuild Llibs`. Finally, connect your board to the computer, click on refresh then click on the last added serial port to upload the project. |
15 | 17 | Now, you can connect the device to the OBD port of the vehicle. Turn on the engine and wait until you hear a bip from the board buzzer. At this time, the board is ready to collect information. If the buzzer does not work, you just reconnect the board and wait again. |
... | ... | @@ -19,13 +21,15 @@ you need to set `USE_SERIAL` to 1 (otherwise 0) which exists in the `./Freematic |
19 | 21 | In order to avoid collecting data during traffic jumps you can set `SLEEP_STOP` to 1 (otherwise 0). This make the board go in deep sleep for 5s. |
20 | 22 | |
21 | 23 | ## How to visualize the collected data ? |
24 | + | |
22 | 25 | To plot some magnitudes or the path you can use the python script. This script needs two arguments. The first one is the name of the CSV file. The second one is html file which can be opened with a navigator and see the journey path. You can also reduce the number of points |
23 | 26 | drawn on the map by uncommenting the call of rdp function. This one has a parameter called epsilon. The bigger epsilon is the lesser points you get. |
24 | 27 | To plot a magnitude you can follow the examples given in the script file. |
25 | 28 | Example of launching the python script: `python3 script_gps.py 27.CSV Trajet.html`. |
26 | 29 |  |
27 | 30 | |
28 | -  | |
29 | 31 | |
32 | +  | |
30 | 33 | |
31 | 34 | |
35 | +## Gettig started with code | ... | ... |
script_gps.py
... | ... | @@ -19,7 +19,7 @@ def plot_path(df,out): |
19 | 19 | df2.reset_index(drop = True, inplace = True) |
20 | 20 | |
21 | 21 | coordinates=np.array([np.array(df2['GPS_LATITUDE']),np.array(df2['GPS_LONGITUDE'])]).transpose() |
22 | - #coordinates=rdp(coordinates,epsilon=0.000005) | |
22 | + #coordinates=rdp(coordinates,epsilon=0.00002) | |
23 | 23 | print(coordinates.shape[0]) |
24 | 24 | _map = folium.Map(location=[coordinates[0,0],coordinates[0,1]], zoom_start=20) |
25 | 25 | |
... | ... | @@ -36,30 +36,6 @@ def plot_path(df,out): |
36 | 36 | popup="B",\ |
37 | 37 | icon=folium.Icon(color='red')).add_to(_map) |
38 | 38 | |
39 | - """ | |
40 | - _map = folium.Map(location=[df2['GPS_LATITUDE'][0],df2['GPS_LONGITUDE'][0]], zoom_start=20) | |
41 | - | |
42 | - for i in range(len(df2['GPS_LATITUDE'])): | |
43 | - folium.Marker([df2['GPS_LATITUDE'][i],df2['GPS_LONGITUDE'][i]],\ | |
44 | - popup=str(i),\ | |
45 | - icon=folium.Icon(color='green')).add_to(_map) | |
46 | - | |
47 | - folium.Marker([df2['GPS_LATITUDE'][0],df2['GPS_LONGITUDE'][0]],\ | |
48 | - popup="A",\ | |
49 | - icon=folium.Icon(color='green')).add_to(_map) | |
50 | - | |
51 | - folium.Marker([df2['GPS_LATITUDE'][df2.shape[0]-1],df2['GPS_LONGITUDE'][df2.shape[0]-1]],\ | |
52 | - popup="B",\ | |
53 | - icon=folium.Icon(color='red')).add_to(_map) | |
54 | - | |
55 | - print("nbr_points = "+str(df2.shape[0])) | |
56 | - """ | |
57 | - """ | |
58 | - L=[] | |
59 | - for i in range(df2.shape[0]): | |
60 | - L+=[[df2['GPS_LATITUDE'][i],df2['GPS_LONGITUDE'][i]]] | |
61 | - folium.PolyLine(L, tooltip="Journey", color='red').add_to(_map) | |
62 | - """ | |
63 | 39 | _map.save(out) |
64 | 40 | |
65 | 41 | |
... | ... | @@ -92,6 +68,6 @@ output_file = sys.argv[2] |
92 | 68 | df = pd.read_csv(input_file) |
93 | 69 | plot_path(df,output_file) |
94 | 70 | plot_magnitude(df,"GPS_ALTITUDE","in m") |
95 | -plot_magnitude(df,"GPS_SPEED","in m/s",100) | |
71 | +plot_magnitude(df,"GPS_SPEED","in Km/h") | |
96 | 72 | plot_magnitude(df,"PID_SPEED","in km/h") |
97 | 73 | ... | ... |