Skip to content

Commit

Permalink
Fix likely cause of smarts.__del__ call in ros_driver. (#2106)
Browse files Browse the repository at this point in the history
* Fix likely cause of smarts.__del__ call.

* Update with fix.
  • Loading branch information
Gamenot authored Nov 9, 2023
1 parent d629e0a commit 7cd8c4c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Copy and pasting the git commit messages is __NOT__ enough.
### Changed
### Deprecated
### Fixed
- Fixed an issue where `SMARTS` might not be explicitly destroyed in the `ros_driver`.
- Fixed issue where `SumoTrafficSimulation` could get locked up on reset if a scenario had only 1 map but multiple scenario variations.
- Fixed an issue where an out-of-scope method reference caused a pickling error.
- Fixed an issue where the `EnvisionDataFormatterArgs` default would use a locally defined lambda and cause a serialization failure.
Expand Down
14 changes: 7 additions & 7 deletions smarts/ros/src/smarts_ros/scripts/ros_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,15 +684,15 @@ def run_forever(self):

self._publish_state()
self._publish_agents(observations, dones)
except Exception as e:
if isinstance(e, rospy.ROSInterruptException):
raise e
except Exception as ex:
if isinstance(ex, rospy.ROSInterruptException):
raise ex
batch_mode = rospy.get_param("~batch_mode", False)
if not batch_mode:
raise e
raise ex
import traceback

rospy.logerr(f"SMARTS raised exception: {e}")
rospy.logerr(f"SMARTS raised exception: {ex}")
rospy.logerr(traceback.format_exc())
rospy.logerr("Will wait for next reset...")
self._smarts = None
Expand All @@ -712,8 +712,8 @@ def run_forever(self):

except rospy.ROSInterruptException:
rospy.loginfo("ROS interrupted. exiting...")

self._reset() # cleans up the SMARTS instance...
finally:
self._reset() # cleans up the SMARTS instance...


if __name__ == "__main__":
Expand Down

0 comments on commit 7cd8c4c

Please sign in to comment.