Skip to content

Add trajectory evaluator #3789

Draft
StarrryNight wants to merge 63 commits into
masterfrom
samuel/trajectory_planner_refactor
Draft

Add trajectory evaluator #3789
StarrryNight wants to merge 63 commits into
masterfrom
samuel/trajectory_planner_refactor

Conversation

@StarrryNight

Copy link
Copy Markdown
Contributor

Description

Introduces TrajectoryEvaluator as a modular replacement for CollisionEvaluator, with separate cost functions for collisions, path shape, and destination similarity.

Changes TrajectoryPlanner::findTrajectory to re-evaluate the current trajectory against updated obstacles each tick before deciding whether to replan:

  • If the current trajectory cost exceeds CURRENT_TRAJ_REPLAN_THRESHOLD, replans unconditionally and uses the new best path
  • Otherwise, runs the full search but only switches to the new trajectory if its first sub-destination differs by more than DESTINATION_SIMILARITY_THRESHOLD_M — avoiding unnecessary churn when the planner finds an equivalent
    route

All destination similarity thresholds live in TrajectoryEvaluator. The goalie uses a tighter threshold (GOALIE_DESTINATION_SIMILARITY_THRESHOLD_M = 0.02m) for more precise positioning, passed through MovePrimitive from the
goalie FSM.

Testing Done

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

Andrewyx and others added 30 commits May 29, 2026 00:33
…rewyx/robot_localizer

# Conflicts:
#	src/software/embedded/primitive_executor.cpp
#	src/software/embedded/primitive_executor.h
#	src/software/embedded/thunderloop.cpp
#	src/software/simulation/er_force_simulator.cpp
#	src/software/simulation/er_force_simulator.h
Resolve conflicts from master's #3760 (new prim-exec logic using motion
controllers), #3769, and the field renames, which overlapped with this
branch's own controller/prim-exec rework.

Resolution:
- Adopt master's #3760 implementation for primitive_executor, thunderloop,
  and the motion controllers (PositionController/OrientationController,
  non-templated PidController + pid_controller.cpp). Drops the branch's
  parallel close-PID / start_angle / stall-detection variant.
- Take master's robot_constants field names (robot_trajectory_max_* ) and
  2026 tuning values (trajectory speed 2.5, decel 2.0).
- Take master's tbots_protobuf createAngularTrajectoryFromParams signature
  (uses params.start_angle()) and master's move_primitive.cpp.
- Keep robot_localizer.cpp/.h as a standalone library for separate
  re-integration; removed the now-unused thunderloop -> robot_localizer dep.

Verified building: proto translation, move_primitive, motion_control/...,
robot_localizer, primitive_executor, thunderloop.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Andrewyx and others added 30 commits June 13, 2026 19:43
…nderbots/Software into Andrewyx/robot_localizer

# Conflicts:
#	src/software/embedded/motor_controller/stspin_motor_controller.cpp
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