-
Notifications
You must be signed in to change notification settings - Fork 4
Fix #765: Add error handling for OMPL path hard crashes and stop sign… #780
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
d8599f9
8123036
3796cea
f86fa9b
530fefa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| HelperHeading heading | ||
| uint8 steering | ||
| bool sail |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -212,9 +212,17 @@ def update_if_needed( | |
| ) | ||
| old_ompl_path = self._ompl_path | ||
|
|
||
| heading_new_path, wp_index = self.calculate_desired_heading_and_waypoint_index( | ||
| ompl_path.get_path(), 0, gps.lat_lon | ||
| ) | ||
| try: | ||
| new_path = ompl_path.get_path() | ||
| if new_path is None: | ||
| self._logger.error("New OMPL path is None") | ||
| return None, local_waypoint_index | ||
| heading_new_path, wp_index = self.calculate_desired_heading_and_waypoint_index( | ||
| new_path, 0, gps.lat_lon | ||
| ) | ||
| except Exception as e: | ||
| self._logger.error(f"Failed to get new OMPL path: {e}") | ||
| return None, local_waypoint_index | ||
|
|
||
| if received_new_global_waypoint: | ||
| self._logger.debug("Updating local path because we have a new global waypoint") | ||
|
|
@@ -227,9 +235,17 @@ def update_if_needed( | |
| self._update(ompl_path) | ||
| return heading_new_path, wp_index | ||
|
|
||
| heading_old_path, updated_wp_index = self.calculate_desired_heading_and_waypoint_index( | ||
| old_ompl_path.get_path(), local_waypoint_index, gps.lat_lon | ||
| ) | ||
| try: | ||
| old_path = old_ompl_path.get_path() | ||
| if old_path is None: | ||
| self._logger.error("Old OMPL path is None") | ||
| return None, local_waypoint_index | ||
| heading_old_path, updated_wp_index = self.calculate_desired_heading_and_waypoint_index( | ||
| old_path, local_waypoint_index, gps.lat_lon | ||
| ) | ||
| except Exception as e: | ||
| self._logger.error(f"Failed to get old OMPL path: {e}") | ||
| return None, local_waypoint_index | ||
|
||
| # check if the current path goes through a collision zone. | ||
| # No need to check for new path since it's fresh and ompl doesn't generate path that | ||
| # go through a collision zone | ||
|
|
@@ -286,4 +302,7 @@ def update_if_needed( | |
| def _update(self, ompl_path: OMPLPath): | ||
|
|
||
| self._ompl_path = ompl_path | ||
| self.path = self._ompl_path.get_path() | ||
| local_path = self._ompl_path.get_path() | ||
| if local_path is None: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should update
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| self._logger.error("OMPL path is None, cannot update local path") | ||
| self.path = local_path | ||
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.
Should perhaps return
Nonefor both.