-
Notifications
You must be signed in to change notification settings - Fork 2
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
base: main
Are you sure you want to change the base?
Conversation
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
Description
Verification
Geod
class from thepyproj
library for distance and azimuth computation.Resources