reinitialize a publisher node in ROS C++

asked 2018-10-09 09:53:57 -0600

Hamza gravatar image

hello everyone,

Can someone help me to reinitialize a publisher node in ROS. In fact I want to start to publish data departing from initial values ( data will be modified of course) and I want after a period of time to reinitialize the data in order to take the initial values. Thanks everyone for your help.

Sincerely. Hamza

edit retag flag offensive close merge delete


you talk about data published to a topic? What you could do is store the data published in a rosbag file and keep them for reuse. and then start the node a again with the same initial values

MasterTsoutsos gravatar image MasterTsoutsos  ( 2018-10-09 10:11:16 -0600 )edit

Thank you for your quick response, In fact My problem is as follow: I have a robot fixed at (X0,Y0) initially and then will move. My node publish the new position X and position Y. After a while, i want to reinitialize my node without shutting it down and my robot come back to initial position X0 Y0

Hamza gravatar image Hamza  ( 2018-10-09 10:35:09 -0600 )edit

What are you actually doing ? Navigating a robot ? You can just store the intial values and if you can determine when is "after a while" you can set the new goal to the values you have sotred.

Delb gravatar image Delb  ( 2018-10-10 02:09:55 -0600 )edit

Thank you for your reply. I'm trying to control a follower rover which must follow the leader while always staying at a safe distance from it. That's why, I need to test a configuration of control parameters and then try to reinitialize my node. this will be done many times.

Hamza gravatar image Hamza  ( 2018-10-10 04:04:13 -0600 )edit

You can write a function that would be called when you need to reinitialize everything that send a goal to the init pose and clear whatever you need to be cleared.

Delb gravatar image Delb  ( 2018-10-10 04:11:59 -0600 )edit