Skip to content

Commit 589fcf5

Browse files
committed
pp speeds
1 parent 417f0a6 commit 589fcf5

4 files changed

Lines changed: 24 additions & 16 deletions

File tree

GEMstack/mathutils/transforms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def lat_lon_to_xy(lat : float, lon : float, lat_reference : float, lon_reference
117117
118118
Returns (x,y), where x is east in m, y is north in m.
119119
"""
120-
import alvinxy.alvinxy as axy
120+
import alvinxy.alvinxy as axy
121121
# convert GNSS waypoints into local fixed frame reprented in x and y
122122
east_x, north_y = axy.ll2xy(lat, lon, lat_reference, lon_reference)
123123
return east_x, north_y

GEMstack/onboard/planning/pure_pursuit.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,16 +171,17 @@ def compute(self, state : VehicleState, component : Component = None):
171171
curve_radius = self.path.fit_curve_radius((curr_x,curr_y), curve_points)
172172
# map curve radius to desired_speed. Note curve_radius can be inf if all points are colinear
173173
print("curve_radius: ", curve_radius)
174-
if curve_radius < 10:
175-
desired_speed = 2.5
176-
elif curve_radius < 15:
177-
desired_speed = 3
178-
elif curve_radius < 20:
179-
desired_speed = 4
180-
elif curve_radius < 30:
181-
desired_speed = 5
182-
else:
183-
desired_speed = 10
174+
#if curve_radius < 10:
175+
# desired_speed = 2.5
176+
#elif curve_radius < 15:
177+
# desired_speed = 3
178+
#elif curve_radius < 20:
179+
# desired_speed = 4
180+
#elif curve_radius < 30:
181+
# desired_speed = 5
182+
#else:
183+
# desired_speed = 10
184+
desired_speed = (.5*curve_radius)**.5
184185
else:
185186
#decay speed when crosstrack error is high
186187
desired_speed *= np.exp(-abs(ct_error)*0.8)

launch/fixed_route.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ drive:
1616
planning:
1717
route_planning:
1818
type: StaticRoutePlanner
19-
args: [!relative_path '../GEMstack/knowledge/routes/xyhead_highbay_backlot_p.csv']
19+
args: [!relative_path '../GEMstack/knowledge/routes/turn_right2.csv']
2020
motion_planning:
2121
type: RouteToTrajectoryPlanner
2222
args: [null] #desired speed in m/s. If null, this will keep the route untimed for the trajectory tracker
2323
trajectory_tracking:
2424
type: pure_pursuit.PurePursuitTrajectoryTracker
25-
args: {desired_speed: 2.5} #approximately 5mph
26-
print: False
25+
args: {desired_speed: 10} #approximately 5mph
26+
print: True
2727
log:
2828
# Specify the top-level folder to save the log files. Default is 'logs'
2929
#folder : 'logs'

testing/test_gg_diagram.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import json
99
import matplotlib.pyplot as plt
1010
import numpy as np
11+
from GEMstack.mathutils.transforms import lat_lon_to_xy
1112

1213
def parse_behavior_log(filename):
1314
"""
@@ -23,9 +24,11 @@ def parse_behavior_log(filename):
2324
speeds = []
2425
xs = []
2526
ys = []
27+
ref_lat = 0.0
28+
ref_long = 0.0
2629

2730
with open(filename, 'r') as f:
28-
for line in f:
31+
for idx, line in enumerate(f):
2932
try:
3033
entry = json.loads(line)
3134
except json.JSONDecodeError:
@@ -43,6 +46,10 @@ def parse_behavior_log(filename):
4346
frame = vehicle_data["pose"].get("frame")
4447
x = vehicle_data["pose"].get("x")
4548
y = vehicle_data["pose"].get("y")
49+
if idx == 0:
50+
ref_lat = x
51+
ref_long = y
52+
x, y = lat_lon_to_xy(x,y,ref_lat,ref_long)
4653
# Only add if all fields are available
4754
if None not in (t, acceleration, heading_rate, speed) and frame != 3:
4855
times.append(t)
@@ -143,7 +150,7 @@ def plot_accelerations(axis, accelerations, time):
143150
def plot_gg_diagram(axis, longitudinal_gs, lateral_gs):
144151
"""Plots gg diagram"""
145152
# Plot G-G diagram
146-
axis.scatter(longitudinal_gs, lateral_gs, alpha=0.5, label="Data Points")
153+
axis.scatter(lateral_gs, longitudinal_gs, alpha=0.5, label="Data Points")
147154

148155
# Draw friction ellipse (assuming µ = 1.0)
149156
mu = 1.0

0 commit comments

Comments
 (0)