Skip to content

Fix emergency stop logic for sending stop primitives - #3812

Merged
williamckha merged 10 commits into
UBC-Thunderbots:masterfrom
nycrat:avah/fix_movement_after_estop
Jun 30, 2026
Merged

Fix emergency stop logic for sending stop primitives#3812
williamckha merged 10 commits into
UBC-Thunderbots:masterfrom
nycrat:avah/fix_movement_after_estop

Conversation

@nycrat

@nycrat nycrat commented Jun 26, 2026

Copy link
Copy Markdown
Member

Description

This PR fixes the estop logic so that stop primitives are actually sent to all robots when the estop is set to stop. Previously, there was a method that guarded against primitives being sent when estop is stopped, however, this logic also prevented stop primitives from being sent. I have observed the robot speeding up for half a second after the estop was pressed, and that was because stop primitives weren't being sent and the robot only stops as a result of the time-out on thunderloop. This PR fixes this.

Testing Done

Screen.Recording.2026-06-26.at.00.36.48.mov

Resolved Issues

Length Justification and Key Files to Review

N/A

Review Checklist

It is the reviewers responsibility to also make sure every item here has been covered

  • Function & Class comments: All function definitions (usually in the .h file) should have a javadoc style comment at the start of them. For examples, see the functions defined in thunderbots/software/geom. Similarly, all classes should have an associated Javadoc comment explaining the purpose of the class.
  • Remove all commented out code
  • Remove extra print statements: for example, those just used for testing
  • Resolve all TODO's: All TODO (or similar) statements should either be completed or associated with a github issue

sauravbanna
sauravbanna previously approved these changes Jun 26, 2026

@sauravbanna sauravbanna left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, thank you!

Comment on lines -44 to -47
self.estop_mode = estop_mode

self.estop_path = estop_path
self.estop_buadrate = estop_baudrate

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixing old unrelated code: these lines were duplicated later on, literally did nothing

Comment on lines -61 to -63
# static map of robot id to stop primitive
self.robot_stop_primitives_map: dict[int, StopPrimitive] = {}

@nycrat nycrat Jun 26, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixing old unrelated code: this map is assigned to but never used, literally did nothing

Comment on lines -79 to -81
# dynamic map of robot id to the individual control mode
self.robot_control_mode_map: dict[int, IndividualRobotMode] = {}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixing old unrelated code: these lines were duplicated later on, literally did nothing

# load control mode map with default values
for robot_id in range(MAX_ROBOT_IDS_PER_SIDE):
self.robot_control_mode_map[robot_id] = IndividualRobotMode.NONE
self.robot_stop_primitives_map[robot_id] = Primitive(stop=StopPrimitive())

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixing old unrelated code: this map is assigned to but never used, literally did nothing

@nycrat
nycrat requested a review from sauravbanna June 26, 2026 08:14
williamckha
williamckha previously approved these changes Jun 28, 2026
@suchirss
suchirss self-requested a review June 30, 2026 01:45
@williamckha
williamckha merged commit 79a2653 into UBC-Thunderbots:master Jun 30, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants