Ask Your Question

Revision history [back]

Hello,

If you have hector_trajectory_server, a node that control the robot and a node that save the file, you can do what you want with bond. Bond allow you to make 2 nodes notified each other if one die. So your software flow will be like this : Run Hector, Controller and Logger > Bond Logger and Controller > Wait > Controller Die and notify Logger > Logger Subscribe to Hector Path and save to a file > Logger die > ? > Profit.

Hello,

If you have hector_trajectory_server, a node that control the robot and a node that save the file, you can do what you want with bond. .

Bond allow you to make 2 nodes notified each other if one die. So your software flow will be like this :

Run Hector, Controller and Logger > Bond Logger and Controller > Wait > Controller Die and notify Logger > Logger Subscribe to Hector Path and save to a file > Logger die > ? > Profit.


Edit : Found a second possible solution :

For cpp : Subscribe to the path topic at the beginning but do nothing while a flag is false, then define a custom SIGINT handler (2.2.1), where you put the flag to true to save the path to a file and shutdown the node cleanly.

For Python : Do a callback where you subscribe to the topic and save it in a file and put this callback in : rospy.is_shutdown() , to do some work before shutting down (Documentation 2.2)