Ask Your Question
0

Implementation of two subscribers

asked 2019-02-06 03:52:49 -0600

saito gravatar image

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 / navigation_velocity_smoother / raw_cmd_vel within the callback function. Oysters How do I write the code?

Thank you.my friend.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2019-02-06 04:14:11 -0600

alsora gravatar image

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.

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

2 followers

Stats

Asked: 2019-02-06 03:52:49 -0600

Seen: 44 times

Last updated: Feb 06