Skip to content

Commit be896d4

Browse files
committed
Fine tuned pure_pursuit
1 parent c86af3f commit be896d4

5 files changed

Lines changed: 30 additions & 18 deletions

File tree

GEMstack/knowledge/defaults/current.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ control:
1717
crosstrack_gain: 0.5 # default: 1
1818
desired_speed: trajectory
1919
longitudinal_control:
20-
pid_p: 1.0
20+
pid_p: 1.5
2121
pid_i: 0.1
2222
pid_d: 0.0
2323

GEMstack/knowledge/vehicle/dynamics.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ def acceleration_to_pedal_positions(acceleration : float, velocity : float, pitc
1818
Returns tuple (accelerator_pedal_position, brake_pedal_position, desired_gear)
1919
"""
2020
model = settings.get('vehicle.dynamics.acceleration_model','hang_v1')
21-
22-
model = 'hang_v1'
23-
# print("===============")
24-
# print(model)
25-
# print("===============")
2621

2722
if model == 'hang_v1':
2823
if gear != 1:

GEMstack/knowledge/vehicle/gem_e4_dynamics.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ max_accelerator_power: #Watts. Power at max accelerator pedal, by gear
1212
- 10000.0
1313
max_accelerator_power_reverse: 10000.0 #Watts. Power (backwards) in reverse gear
1414

15-
acceleration_model : kris_v1
15+
acceleration_model : hang_v1 # kris_v1
1616
accelerator_active_range : [0.2, 1.0] #range of accelerator pedal where output acceleration is not flat
1717
brake_active_range : [0,1] #range of brake pedal where output deceleration is not flat
1818

GEMstack/onboard/planning/pure_pursuit.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,13 @@ def compute(self, state : VehicleState, component : Component = None):
105105
else:
106106
desired_x,desired_y = self.path.eval(des_parameter)
107107
desired_yaw = np.arctan2(desired_y-curr_y,desired_x-curr_x)
108-
#print("Desired point",(desired_x,desired_y)," with lookahead distance",self.look_ahead + self.look_ahead_scale * speed)
109-
#print("Current yaw",curr_yaw,"desired yaw",desired_yaw)
110-
108+
109+
print("Desired point",(desired_x,desired_y)," with lookahead distance",self.look_ahead + self.look_ahead_scale * speed)
110+
print("Current x",curr_x,"Current y",curr_y)
111+
print("Current yaw",curr_yaw,"Desired yaw",desired_yaw)
112+
print("Parameter : ", self.current_path_parameter)
113+
print("Last index : ", self.path.domain()[1])
114+
111115
# distance between the desired point and the vehicle
112116
L = transforms.vector2_dist((desired_x,desired_y),(curr_x,curr_y))
113117

@@ -142,6 +146,7 @@ def compute(self, state : VehicleState, component : Component = None):
142146
#past the end, just stop
143147
desired_speed = 0.0
144148
feedforward_accel = -2.0
149+
f_delta = 0
145150
else:
146151
if self.desired_speed_source=='path':
147152
current_trajectory_time = self.trajectory.parameter_to_time(self.current_path_parameter)
@@ -165,6 +170,17 @@ def compute(self, state : VehicleState, component : Component = None):
165170
else:
166171
#decay speed when crosstrack error is high
167172
desired_speed *= np.exp(-abs(ct_error)*0.4)
173+
174+
if len(self.trajectory.points) < 2 or self.current_path_parameter >= self.path.domain()[1]:
175+
if component is not None:
176+
component.debug_event('Past the end of trajectory')
177+
#past the end, just stop
178+
desired_speed = 0.0
179+
feedforward_accel = -2.0
180+
f_delta = 0
181+
182+
183+
168184
if desired_speed > self.speed_limit:
169185
desired_speed = self.speed_limit
170186
output_accel = self.pid_speed.advance(e = desired_speed - speed, t = t, feedforward_term=feedforward_accel)

launch/fixed_route.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ description: "Drive the GEM vehicle along a fixed route (currently xyhead_highba
22
mode: hardware
33
vehicle_interface: gem_hardware.GEMHardwareInterface
44
mission_execution: StandardExecutor
5-
require_engaged: False
5+
# require_engaged: False
66
# Recovery behavior after a component failure
77
recovery:
88
planning:
@@ -17,13 +17,14 @@ drive:
1717
planning:
1818
route_planning:
1919
type: StaticRoutePlanner
20-
args: [!relative_path '../GEMstack/knowledge/routes/xyhead_highbay_backlot_p.csv']
21-
motion_planning:
22-
type: RouteToTrajectoryPlanner
23-
args: [null] #desired speed in m/s. If null, this will keep the route untimed for the trajectory tracker
20+
args: [!relative_path '../GEMstack/knowledge/routes/forward_15m.csv'] #forward_15m
21+
motion_planning: longitudinal_planning.YieldTrajectoryPlanner
22+
# type: RouteToTrajectoryPlanner
23+
# args: [null] #desired speed in m/s. If null, this will keep the route untimed for the trajectory tracker
2424
trajectory_tracking:
2525
type: pure_pursuit.PurePursuitTrajectoryTracker
26-
args: {desired_speed: 2.5} #approximately 5mph
26+
# args: [null]
27+
# args: {desired_speed: 2.5} #approximately 5mph
2728
print: False
2829
log:
2930
# Specify the top-level folder to save the log files. Default is 'logs'
@@ -33,7 +34,7 @@ log:
3334
# If suffix is specified, then logs will output to folder/prefix+suffix. Default uses date and time as the suffix
3435
#suffix : 'test3'
3536
# Specify which ros topics to record to vehicle.bag. Default records nothing. This records the "standard" ROS topics.
36-
ros_topics : []
37+
ros_topics : ['/septentrio_gnss/insnavgeod','/pacmod/parsed_tx/vehicle_speed_rpt']
3738
# Specify options to pass to rosbag record. Default is no options.
3839
#rosbag_options : '--split --size=1024'
3940
# If True, then record all readings / commands of the vehicle interface. Default False
@@ -57,7 +58,7 @@ computation_graph: !include "../GEMstack/knowledge/defaults/computation_graph.ya
5758
after:
5859
show_log_folder: True #set to false to avoid showing the log folder
5960

60-
#on load, variants will overload the settings structure
61+
#on load, variants will overload the settingsNone structure
6162
variants:
6263
#sim variant doesn't execute on the real vehicle
6364
#real variant executes on the real robot

0 commit comments

Comments
 (0)