Implementation of two subscribers
Hello. I am a ROS beginner. I am doing SLAM of turtlebot 2 in the ubuntu 14.04, ros (indigo) personal computer environment.
I want to call the callback function every time a topic / cmd_vel is delivered, but I also want to use the message of the topic / scan in the callback function.
I also want to distribute the topic / navigationvelocitysmoother / rawcmdvel within the callback function. Oysters How do I write the code?
Thank you.my friend.
Asked by saito on 2019-02-06 04:52:49 UTC
Answers
I want to call the callback function every time a topic / cmd_vel is delivered, but I also want to use the message of the topic / scan in the callback function.
You have two options.
The simple case consists in implementing a callback function for the topic /scan
which stores the message into a variable, such that it can be used later by the callback for the topic /cmd_vel
.
Alternatively, you may want to synchronize the two callbacks using the message filter package.
This will allow you to create a unique callback which is triggered when you receive a message on the /scan
and on the /cmd_vel
topics almost at the same time.
But I think that the first solution is what you need.
I also want to distribute the topic / navigation_velocity_smoother / raw_cmd_vel within the callback function.
I don't understand this question.
Asked by alsora on 2019-02-06 05:14:11 UTC
Comments