Skip to content

Commit b1a3a1e

Browse files
committedSep 23, 2015
GPS visualization
1 parent 097272c commit b1a3a1e

16 files changed

+5902
-3
lines changed
 

‎GPS_visualization/GPS_Visualization_Folium.py

+37-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,13 @@
2727
# * 09/12/15 - JEV - joshua.vaughan@louisiana.edu
2828
# - conversion to Python 3
2929
# - begin conversion away from Anaconda data
30+
# * 09/16/15 - JEV - joshua.vaughan@louisiana.edu
31+
# - Update parsing for ARLISS 2015 data log order
3032
#
3133
##########################################################################################
3234

35+
from __future__ import print_function, division
36+
3337
import numpy as np
3438

3539
import folium
@@ -39,6 +43,8 @@
3943

4044
import geographic_calculations as geoCalc
4145

46+
import datetime
47+
4248

4349
PRODUCE_FOLIUMMAP = True # Produce a Folium-based map?
4450
DRAW_WAYPOINTS = False # Draw the waypoints?
@@ -50,7 +56,7 @@ def create_map(data_filename):
5056
waypoints = None
5157
# TODO: be more efficient
5258
with open(data_filename, 'rb') as data_file:
53-
data = np.genfromtxt(data_file, delimiter=',', skip_header = 1, dtype = 'float')
59+
data = np.genfromtxt(data_file, delimiter=',', skip_header = 1)#, dtype = 'float')
5460

5561
if np.shape(data)[1] == 14: # _controlHistory... file
5662
data_ok = True
@@ -99,6 +105,34 @@ def create_map(data_filename):
99105
gps_speed = data[:,18]
100106

101107
waypoints = None
108+
109+
if np.shape(data)[1] == 11: # pyBoard... file
110+
# (timestamp, past point, current point, current bearing, desired bearing, angle, target distance)
111+
data_ok = True
112+
113+
hours = data[:,0]
114+
minutes = data[:,1]
115+
seconds = data[:,2]
116+
117+
time = []
118+
119+
for index, hour in enumerate(hours):
120+
time_stamp = datetime.datetime(2015, 9, 16, int(hours[index]), int(minutes[index]), int(seconds[index]))
121+
time = np.append(time, time_stamp.strftime('%H:%M:%S'))
122+
123+
past_latitude = data[:,3]
124+
past_longitude = data[:,4]
125+
126+
# current
127+
latitude = data[:,5]
128+
longitude = data[:,6]
129+
130+
current_bearing = data[:,7]
131+
desired_bearing = data[:,8]
132+
133+
angle_to_turn = data[:,9]
134+
135+
target_distance = data[:,10]
102136

103137
else:
104138
data_ok = False
@@ -107,7 +141,7 @@ def create_map(data_filename):
107141

108142
if data_ok: # If we have meaningful data, make the map
109143
# Define the start, target, and midpoint locations
110-
start = np.array([latitude[0], longitude[0]])
144+
start = np.array([past_latitude[0], past_longitude[0]])
111145

112146
if waypoints is not None:
113147
target = waypoints[-1,:] # last waypoint is the target location
@@ -162,7 +196,7 @@ def create_map(data_filename):
162196
# in a popup when clicked on
163197
for index, current_pos in enumerate(path):
164198
mymap.circle_marker(location = [current_pos[0], current_pos[1]], radius = 1,
165-
popup = 'Time: {:3.2f} s -- Lat, Lon: {:4.4f}, {:4.4f} -- Speed: {:3.2f} m/s -- Actual Heading: {:3.0f} deg -- Desired Heading: {:3.0f} deg -- Distance to Waypoint: {:.0f} m'.format(time[index], latitude[index], longitude[index], gps_speed[index], imu_heading[index], bearing_to_waypoint[index], distance_to_waypoint[index]),
199+
#popup = 'Time: {} -- Lat, Lon: {:4.4f}, {:4.4f} -- Speed: {:3.2f} m/s -- Actual Heading: {:3.0f} deg -- Desired Heading: {:3.0f} deg -- Distance to Waypoint: {:.0f} m'.format(time[index], latitude[index], longitude[index], gps_speed[index], imu_heading[index], bearing_to_waypoint[index], distance_to_waypoint[index]),
166200
line_color = '#0000FF', fill_color = '#0000FF')
167201

168202

Binary file not shown.
5.78 KB
Binary file not shown.

‎GPS_visualization/log.csv

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
2+
3+
-----------------------------
4+
5+
(21, 50, 50.0), (40.84274, -119.0779), (40.84274, -119.0779), 0.0, 295.7986, -64.20142 ,, 5280.068
6+
7+
8+
-----------------------------
9+
10+
(21, 50, 57.0), (40.84274, -119.0779), (40.84274, -119.0779), 0.0, 295.7986, -64.20142 ,, 5280.068
11+
12+
13+
-----------------------------
14+
15+
(21, 51, 12.0), (40.84274, -119.0779), (40.84275, -119.0779), 0.0, 295.7893, -64.2107 ,, 5279.903
16+
17+
18+
-----------------------------
19+
20+
(21, 51, 15.0), (40.84275, -119.0779), (40.84275, -119.0779), 0.0, 295.7893, -64.2107 ,, 5279.903
21+
22+
23+
-----------------------------
24+
25+
(21, 51, 30.0), (40.84275, -119.0779), (40.84275, -119.0779), 0.0, 295.7893, -64.2107 ,, 5279.903
26+
27+
28+
-----------------------------
29+
30+
(21, 51, 39.0), (40.84275, -119.0779), (40.84275, -119.0779), 0.0, 295.7893, -64.2107 ,, 5279.903
31+
32+
33+
-----------------------------
34+
35+
(21, 51, 42.0), (40.84275, -119.0779), (40.84275, -119.0779), 0.0, 295.7893, -64.2107 ,, 5279.903
36+
37+
38+
-----------------------------
39+
40+
(21, 51, 50.0), (40.84275, -119.0779), (40.84275, -119.0779), 0.0, 295.7893, -64.2107 ,, 5279.903
41+
42+
43+
-----------------------------
44+
45+
(21, 52, 0.0), (40.84275, -119.0779), (40.84275, -119.0779), 0.0, 295.7893, -64.2107 ,, 5279.903
46+
47+
48+
-----------------------------
49+
50+
(21, 52, 8.0), (40.84275, -119.0779), (40.84275, -119.0779), 0.0, 295.7893, -64.2107 ,, 5279.903
51+
52+
53+
-----------------------------
54+
55+
(21, 52, 17.0), (40.84275, -119.0779), (40.84275, -119.0779), 0.0, 295.7893, -64.2107 ,, 5279.903
56+
57+
58+
-----------------------------
59+
60+
(21, 52, 26.0), (40.84275, -119.0779), (40.84275, -119.0779), 0.0, 295.7893, -64.2107 ,, 5279.903
61+
62+
63+
-----------------------------
64+
65+
(21, 52, 35.0), (40.84275, -119.0779), (40.84275, -119.0779), 0.0, 295.7893, -64.2107 ,, 5279.903
66+
67+
68+
-----------------------------
69+
70+
(21, 52, 50.0), (40.84275, -119.0779), (40.84275, -119.0779), 0.0, 295.7874, -64.21256 ,, 5279.738
71+
72+
73+
-----------------------------
74+
75+
(21, 52, 53.0), (40.84275, -119.0779), (40.84275, -119.0779), 0.0, 295.7874, -64.21256 ,, 5279.738
76+
77+
78+
-----------------------------
79+
80+
(21, 53, 1.0), (40.84275, -119.0779), (40.84275, -119.0779), 0.0, 295.7874, -64.21256 ,, 5279.738
81+
82+
83+
-----------------------------
84+
85+
(21, 53, 10.0), (40.84275, -119.0779), (40.84275, -119.0779), 180.0, 295.7893, 115.7893 ,, 5279.903
86+
87+
88+
-----------------------------
89+
90+
(21, 53, 26.0), (40.84275, -119.0779), (40.84275, -119.0779), 0.0, 295.7893, -64.2107 ,, 5279.903
91+
92+
93+
-----------------------------
94+
95+
(21, 53, 30.0), (40.84275, -119.0779), (40.84275, -119.0779), 0.0, 295.7893, -64.2107 ,, 5279.903
96+
97+
98+
-----------------------------
99+
100+
(21, 53, 44.0), (40.84275, -119.0779), (40.84277, -119.0778), 58.79022, 295.7526, -123.0376, 5282.018

0 commit comments

Comments
 (0)