Skip to content

Commit 4457852

Browse files
committed
Test backward control
Can run backward in simulation Cannot combine forward and backward because it uses fixed_route and desired_speed is fixed. Positive desired_speed means forward and negative means backward. Cannot change the negative velocity (fixed to -0.25m/s).
1 parent 924f690 commit 4457852

5 files changed

Lines changed: 47 additions & 5 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
0.0,0,0
2+
-1.0,0,0
3+
-2.0,0.1,0
4+
-3.0,0.2,0
5+
-4,0.4,0
6+
-5,0.8,0
7+
-6,1,0
8+
-7,1,0
9+
-8,1,0
10+
-9,1,0
11+
-10,1,0

GEMstack/knowledge/vehicle/dynamics.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,16 @@ def apply_function(value, function='linear'):
116116
if abs(acceleration) < acceleration_deadband:
117117
#deadband?
118118
return (0,0,gear)
119-
if velocity * acceleration < 0:
119+
120+
121+
122+
# Revised by Summoning
123+
# if velocity * acceleration < 0:
124+
if velocity * acceleration < 0 and gear == 1:
125+
126+
127+
128+
120129
accel_pos = 0
121130
brake_pos = -acceleration / brake_max
122131
if brake_pos > 1.0:

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 (update
1212
- 5000.0
1313
max_accelerator_power_reverse: 5000.0 #Watts. Power (backwards) in reverse gear
1414

15-
acceleration_model : hang_v1
15+
acceleration_model : 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.5,1] #range of brake pedal where output deceleration is not flat
1818

GEMstack/onboard/interface/gem_simulator.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,16 @@ def simulate(self, T : float, command : Optional[GEMVehicleCommand]):
174174
brake_pedal_position = np.clip(self.last_command.brake_pedal_position,0.0,1.0)
175175
acceleration = pedal_positions_to_acceleration(accelerator_pedal_position,brake_pedal_position,v,0,1)
176176
acceleration = np.clip(acceleration,*self.dubins.accelRange)
177+
178+
179+
180+
# Revised by Summoning
181+
if self.last_command.gear < 0:
182+
acceleration = -acceleration
183+
184+
185+
186+
177187
phides = steer2front(self.last_command.steering_wheel_angle)
178188
phides = np.clip(phides,*self.dubins.wheelAngleRange)
179189
h = 0.01 #just for finite differencing
@@ -207,10 +217,21 @@ def simulate(self, T : float, command : Optional[GEMVehicleCommand]):
207217
reading.brake_pedal_position = brake_pedal_position
208218
reading.accelerator_pedal_position = 0
209219
reading.speed = v
220+
221+
222+
223+
210224
if v >= 0:
211225
reading.gear = 1
212226
else:
213227
reading.gear = -1
228+
# Revised by Summoning
229+
# reading.gear = self.last_command.gear
230+
231+
232+
233+
234+
214235
#copy signals
215236
reading.left_turn_signal = self.last_command.left_turn_signal
216237
reading.right_turn_signal = self.last_command.right_turn_signal

launch/fixed_route.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +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/xyhead_highbay_backlot_p.csv']
20+
args: [!relative_path '../GEMstack/knowledge/routes/backward_15m.csv','start']
2021
motion_planning:
2122
type: RouteToTrajectoryPlanner
2223
args: [null] #desired speed in m/s. If null, this will keep the route untimed for the trajectory tracker
2324
trajectory_tracking:
2425
type: pure_pursuit.PurePursuitTrajectoryTracker
25-
args: {desired_speed: 2.5} #approximately 5mph
26+
args: {desired_speed: -2.5} #approximately 5mph
2627
print: False
2728
log:
2829
# Specify the top-level folder to save the log files. Default is 'logs'
@@ -56,7 +57,7 @@ replay: # Add items here to set certain topics / inputs to be replayed from log
5657
computation_graph: !include "../GEMstack/knowledge/defaults/computation_graph.yaml"
5758

5859
after:
59-
show_log_folder: True #set to false to avoid showing the log folder
60+
show_log_folder: False #set to false to avoid showing the log folder
6061

6162
#on load, variants will overload the settings structure
6263
variants:

0 commit comments

Comments
 (0)