reinitialize a publisher node in ROS C++

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

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

Comments

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 imageMasterTsoutsos ( 2018-10-09 10:11:16 -0500 )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 imageHamza ( 2018-10-09 10:35:09 -0500 )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 imageDelb ( 2018-10-10 02:09:55 -0500 )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 imageHamza ( 2018-10-10 04:04:13 -0500 )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 imageDelb ( 2018-10-10 04:11:59 -0500 )edit