Ask Your Question
0

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
0

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 http://wiki.ros.org/ROS/Tutorials/Wri...

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

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 378 times

Last updated: May 18 '17