Skip to content

Commit 080f8b0

Browse files
authored
Merge pull request #115 from krishauser/A1_control
A1 control
2 parents 4ba2efd + 67eab16 commit 080f8b0

21 files changed

Lines changed: 10237 additions & 16 deletions

GEMstack/knowledge/defaults/computation_graph.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,6 @@ components:
5252
- trajectory_tracking:
5353
inputs: [vehicle, trajectory]
5454
outputs:
55+
- signaling:
56+
inputs: [intent]
57+
outputs:

GEMstack/knowledge/defaults/current.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ control:
1313
brake_speed : 2.0
1414
pure_pursuit:
1515
lookahead: 2.0
16-
lookahead_scale: 3.0
16+
lookahead_scale: 2.0
1717
crosstrack_gain: 0.5
1818
desired_speed: trajectory
1919
longitudinal_control:
2020
pid_p: 1.0
21-
pid_i: 0.1
21+
pid_i: 0.05
2222
pid_d: 0.0
2323

2424
#configure the simulator, if using

GEMstack/onboard/planning/blink_component.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ def update(self):
3838
# sent to the drive-by-wire system, simultaneously. To avoid doing arbitrary things
3939
# to the vehicle, let's maintain the current values (e.g., accelerator, brake pedal,
4040
# steering angle) from its current readings.
41+
42+
#if Allstate.intent.intent == "HALTING" :
43+
#return
4144
current_time = time.time()
4245
if current_time - self.last_update_time >= 2: # Change signal every 2 seconds
4346
if self.turn_state == TURN_OFF:

GEMstack/onboard/planning/pure_pursuit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def compute(self, state : VehicleState, component : Component = None):
164164
print("Feedforward accel: " + str(feedforward_accel) + " m/s^2")
165165
else:
166166
#decay speed when crosstrack error is high
167-
desired_speed *= np.exp(-abs(ct_error)*1.0)
167+
desired_speed *= np.exp(-abs(ct_error)*0.8)
168168
if desired_speed > self.speed_limit:
169169
desired_speed = self.speed_limit
170170
output_accel = self.pid_speed.advance(e = desired_speed - speed, t = t, feedforward_term=feedforward_accel)

homework/blink.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
TURN_NONE = 1
77
TURN_LEFT = 2
88
TURN_HAZARD = 3
9-
TURN_AROUND = 4
109
# For message format, see
1110
# https://github.com/astuff/astuff_sensor_msgs/blob/3.3.0/pacmod_msgs/msg/PacmodCmd.msg
1211

@@ -48,19 +47,20 @@ def cleanup(self):
4847
def get_dir_distress(self):
4948
pass
5049

51-
def update(self):
50+
def update(self, Allstate):
5251
"""Run in a loop"""
5352
# TODO: Implement your control loop here
5453
# You will need to publish a PacmodCmd() to /pacmod/as_rx/turn_cmd. Read the documentation to see
5554
# what the data in the message indicates.
5655
#self.turn_cmd = PacmodCmd()
5756
# TODO change to actual direction in Part 2
58-
if self.turn_cmd.ui16_cmd == TURN_NONE:
59-
self.turn_cmd.ui16_cmd = TURN_LEFT
60-
elif self.turn_cmd.ui16_cmd == TURN_LEFT:
61-
self.turn_cmd.ui16_cmd = TURN_RIGHT
62-
else:
63-
self.turn_cmd.ui16_cmd = TURN_NONE
57+
if Allstate.intent.intent == "HALTING":
58+
if self.turn_cmd.ui16_cmd == TURN_NONE:
59+
self.turn_cmd.ui16_cmd = TURN_LEFT
60+
elif self.turn_cmd.ui16_cmd == TURN_LEFT:
61+
self.turn_cmd.ui16_cmd = TURN_RIGHT
62+
else:
63+
self.turn_cmd.ui16_cmd = TURN_NONE
6464
self.turn_blink_pub.publish(self.turn_cmd)
6565

6666
pass
@@ -97,7 +97,7 @@ def accel_callback(self, msg):
9797
rospy.loginfo(f"Output: {msg.output} (Final Output to Vehicle)")
9898
rospy.loginfo("---------------------------\n")
9999

100-
def run_ros_loop(node):
100+
def run_ros_loop(node, Allstate):
101101
"""Executes the event loop of a node using ROS. `node` should support
102102
rate(), initialize(), cleanup(), update(), and done(). You should not modify
103103
this code.
@@ -111,7 +111,7 @@ def run_ros_loop(node):
111111
termination_reason = "undetermined"
112112
try:
113113
while not rospy.is_shutdown() and not node.done() and node.healthy():
114-
node.update()
114+
node.update(node, Allstate)
115115
rate.sleep()
116116
if node.done():
117117
termination_reason = "Node done"

homework/blink_launch.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ recovery:
99
state_estimation : GNSSStateEstimator
1010
perception_normalization : StandardPerceptionNormalizer
1111
planning:
12-
trajectory_tracking : blink_component.BlinkDistress
12+
signaling: blink_component.BlinkDistress
1313
# Driving behavior for the GEM vehicle. Runs perception and planner but doesn't execute anything (no controller).
1414
drive:
1515
perception:
1616
state_estimation : GNSSStateEstimator
1717
perception_normalization : StandardPerceptionNormalizer
1818
planning:
19-
trajectory_tracking : blink_component.BlinkDistress
19+
signaling: blink_component.BlinkDistress
2020
log:
2121
# Specify the top-level folder to save the log files. Default is 'logs'
2222
folder : 'logs'

tuning logs/2025-02-13_21-10-39 (fine tuning)/PurePursuitTrajectoryTracker_debug.csv

Lines changed: 3242 additions & 0 deletions
Large diffs are not rendered by default.

tuning logs/2025-02-13_21-10-39 (fine tuning)/behavior.json

Lines changed: 6605 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
events:
2+
- description: Ctrl+C pressed, switching to recovery mode
3+
time: 1739502705.4840224
4+
vehicle_time: 1739502704.3390243
5+
- description: Mission execution ended
6+
time: 1739502707.669565
7+
vehicle_time: 1739502706.5190222
8+
exit_reason: normal exit
9+
git_branch: A1_control
10+
git_commit_id: b5cb190b3f6c6cf17344817eca71aa0a5d350394
11+
pipelines:
12+
- name: drive
13+
time: 1739502639.5759368
14+
vehicle_time: 1739502638.629087
15+
- name: recovery
16+
time: 1739502705.4858768
17+
vehicle_time: 1739502704.3390243
18+
start_time: 1739502639.3786135
19+
start_time_human_readable: '2025-02-13 21:10:39'
251 KB
Loading

0 commit comments

Comments
 (0)