Robotics StackExchange | Archived questions

subscriber and publisher in class

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

Asked by Nathan_T on 2017-05-03 17:42:08 UTC

Comments

Answers

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 http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29

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

Asked by angeltop on 2017-05-18 09:11:15 UTC

Comments