Skip to content

#949: Setting Goal Yaw#959

Merged
raghumanimehta merged 22 commits into
mainfrom
ethanhu912/949-path-set-goal-yaw
Jun 23, 2026
Merged

#949: Setting Goal Yaw#959
raghumanimehta merged 22 commits into
mainfrom
ethanhu912/949-path-set-goal-yaw

Conversation

@ethanhu912

Copy link
Copy Markdown
Contributor

Description

  • Resolves PATH: set goal yaw #949
  • Added yaw at goal position
  • Added two functions:
    • One to compute the heading from the next global waypoint to the next-next waypoint
      • If the next global waypoint is the last, sets it to a default heading of east
      • Passes this heading to setYaw.
    • One to offset the goal heading if it is in irons
      • Offsets it towards the closest edge of the no-go zone
  • Added tests to ensure that goal heading is in the correct direction if it is not in irons, and that goal heading gets offset to the correct side of no-go zone if in irons

Verification

  • Passes all tests

Resources

@ethanhu912 ethanhu912 requested a review from AMaharaj16 June 22, 2026 20:20
@ethanhu912 ethanhu912 self-assigned this Jun 22, 2026
@ethanhu912 ethanhu912 added enhancement New feature or request path Pathfinding team labels Jun 22, 2026
@ethanhu912 ethanhu912 linked an issue Jun 22, 2026 that may be closed by this pull request

@raghumanimehta raghumanimehta 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.

Well done @ethanhu912 ! This was good work. I had some problems with readibility and that is why i am requesting changes but this is a high quality contribution.

Please update the tests when you add the buffer near NO_GO_ZONE in _offset_if_in_irons.

for i in range(1, len(waypoints)):
if waypoints[i] == reference:
# reference_latlon sits at (0, 0) in the OMPL frame
next_to_next_xy = cs.latlon_to_xy(reference, waypoints[i - 1])

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.

Suggested change
next_to_next_xy = cs.latlon_to_xy(reference, waypoints[i - 1])
next_to_next_gw_xy = cs.latlon_to_xy(reference, waypoints[i - 1])

if waypoints[i] == reference:
# reference_latlon sits at (0, 0) in the OMPL frame
next_to_next_xy = cs.latlon_to_xy(reference, waypoints[i - 1])
bearing_deg = cs.get_path_segment_true_bearing(cs.XY(0, 0), next_to_next_xy)

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.

nit: You should directly refer reference_xy to improve readibility rather than cs.XY(0, 0).
not nit: shouldn't the order of argument be reversed here?

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.

Please pushback if i am wrong here.

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.

Nevermind, the confusion is resolved. I would ask for better naming of variables and a small comment clarifying that reference is the next_gw_xy and that it is calculating a bearing from this to next to next.

)
return self._offset_if_in_irons(0.0)

def _offset_if_in_irons(self, ompl_yaw_rad: float) -> float:

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.

rename to include rad in the name as you did for the others.

)
return self._offset_if_in_irons(0.0)

def _offset_if_in_irons(self, ompl_yaw_rad: float) -> float:

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.

rename ompl_yaw_rad to target_yaw_rad. Seems clearer to me. Thoughts?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed. Will change right now

ompl_yaw_rad: Proposed goal yaw in OMPL Cartesian radians.

Returns:
float: A goal yaw in OMPL Cartesian radians outside the wind no-go zone.

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.

Should specify what the OMPL Cartesian coordinates are for readibility.


if abs(twa) < NO_GO_ZONE:
# Upwind irons: snap to the closer ±NO_GO_ZONE edge.
new_twa = NO_GO_ZONE if twa >= 0 else -NO_GO_ZONE

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.

We shouldn't be setting it eactly to NO_GO_ZONE. Consider adding a small margin to make sure OMPL doesn't crash because of validitiy not passing.

goal-yaw helpers read. Avoids running the OMPL solver in every test.
"""
wind = Wind(tw_speed_kmph, tw_dir_deg)
state = SimpleNamespace(

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.

nit: consider using Mock instead of SimpleNamespace.

fake._offset_if_in_irons = types.MethodType(ompl_path.OMPLPath._offset_if_in_irons, fake)
return fake


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.

In the test file, why not use pytest mark parametrize?

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.

Never mind this, I got codex to care of the problems in tests. Focus on ohter comments.

raghumanimehta
raghumanimehta previously approved these changes Jun 23, 2026
@raghumanimehta raghumanimehta merged commit 67cbe05 into main Jun 23, 2026
6 checks passed
@raghumanimehta raghumanimehta deleted the ethanhu912/949-path-set-goal-yaw branch June 23, 2026 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request path Pathfinding team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PATH: set goal yaw

3 participants