ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

subscriber and publisher in class

asked 2017-05-03 17:42:08 -0500

Nathan_T gravatar image

Hello, I am doing simulation in gazebo. And I have two topics, by writing a subscriber for the first topic I can get the position of my mobile robot, and by writing a publisher for the second topic I can control the velocity of my robot.

But I want to control the velocity of the robot through the position information. So I wonder how I can publish the information I got from the subscriber to a topic.

Any help as to what could be done would be really appreciated

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-05-18 09:11:15 -0500

angeltop gravatar image

updated 2017-05-18 09:11:31 -0500

I suggest to process the received position information in the callback function of your subscriber calculate the desired velocities and publish them with your publisher in the callback function as well. More information about how to implement Subcribers and Publishers can be found at

Note that you also need a target position in order to compute correct velocities

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-05-03 17:42:08 -0500

Seen: 464 times

Last updated: May 18 '17