Skip to content

Creating stop primitive before unavoidable collisions #3590

Open
StarrryNight wants to merge 19 commits intoUBC-Thunderbots:masterfrom
StarrryNight:stop_primitive_b4_unavoiadable_collision_#3587
Open

Creating stop primitive before unavoidable collisions #3590
StarrryNight wants to merge 19 commits intoUBC-Thunderbots:masterfrom
StarrryNight:stop_primitive_b4_unavoiadable_collision_#3587

Conversation

@StarrryNight
Copy link
Contributor

Description

This ticket resolve #3587, which is a sub-issue of #2896.

MovePrimitive now return a StopPrimitive if there's an unavoidable collision with a high velocity under a certain time threshold.

Time threshold: time until collision happens. Currently set to 0.2s.
Velocity threshold: Minimum velocity of robot to be considered "high velocity". Currently set to 2.0m/s.

Thresholds can be fine-tuned.

Testing Done

Tested by running thunderscope and logging when unavoidable collisions in a high speed is triggered.

Resolved Issues

Length Justification and Key Files to Review

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

williamckha
williamckha previously approved these changes Feb 7, 2026
Copy link
Member

@williamckha williamckha left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 35 to 37
// The time and obstacle at which the trajectory first collides with an
// obstacle first_collision_time_s is set to infinity and colliding_obstacle is
// nullptr if the trajectory does not collide.
Copy link
Member

Choose a reason for hiding this comment

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

Nit: nullopt (which is what is being returned) is different from nullptr

Comment on lines 8 to 10
const double UNAVOIDABLE_COLLISION_TIME_THRESHOLD = 0.2f;
// Tune
const double UNAVOIDABLE_COLLISION_VELOCITY_THRESHOLD = 0.5f;
Copy link
Member

Choose a reason for hiding this comment

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

Tag a TODO (#xxxx): tune collision threshold constants comment with issue number

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.

Returning stop primitive before unavoidable collision

2 participants