Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User/medhansh/desired heading #467

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

MC6527medhansh
Copy link

Description

  • Resolves Publish desired heading #283
  • Implemented the functionality to compute and publish the desired heading from the current boat position to the next waypoint.

Verification

  • Ensure the desired heading is correctly calculated using the Geod class from the pyproj library for distance and azimuth computation.
  • Validate that the system updates the waypoint index correctly when the boat reaches a waypoint using a threshold distance.
  • Check scenarios where the path is updated to ensure the waypoints start from the boat's current position.

Resources


def get_angle(self, boat_lat, boat_long, current_lat, current_long):
# calculate distance from current position of boat to next local waypoint
distance = self.calculate_distance(boat_lat, boat_long, current_lat, current_long)
# update waypoint
Copy link
Contributor

Choose a reason for hiding this comment

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

Comments are redundant

self.gps, self.ais_ships, self.global_path, self.filtered_wind_sensor, self.planner
)

# TODO: create function to compute the heading from current position to next local waypoint
return 0.0
boat_lat = self.gps.position.lat_lon.latitude
Copy link
Contributor

Choose a reason for hiding this comment

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

The boat latitude and longitude could be placed in a tuple and parsed into the functions

return self.local_path.waypoints[self.current_waypoint_index]

def calculate_distance(lat1, lon1, lat2, lon2):
GEODESIC = Geod(ellps="WGS84")
Copy link
Contributor

@FireBoyAJ24 FireBoyAJ24 Jan 11, 2025

Choose a reason for hiding this comment

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

You could add this statements to the top of the file

_, _, distance = GEODESIC.inv(lon1, lat1, lon2, lat2)
return distance

def calculate_angle(lat1, lon1, lat2, lon2):
Copy link
Contributor

Choose a reason for hiding this comment

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

The calculate_distance and calculate_angle function looks redundant as the functions are acting as wrappers to the geodesic.inv function. You could add the geodesic.inv function to the 'get_angle' function.


def update_waypoint(self, distance, threshold):
if (distance < threshold):
# then update the next local waypoint by increasing index by 1
Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove this comment.

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.

Publish desired heading
3 participants