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

Revision history [back]

Okay, a few things here:

1) (Minor) You don't necessarily need a custom message type for this, a Twist message is made to transmit exactly this kind of information

2) In your main function, you should at most do the initial setup, configure the subscription callback, and call ros::spin(). Every time your message is received, the callback function will be processed, and that's where you can publish odometry message and transform. This is

Currently, you're running a loop that is constantly resubscribing to the topic, and then publishing odom/tf, whether you have received a message or not. Try refactoring the way I described in #2, and if it still doesn't work, update the question with your new code.

Also, please use the markdown formatting to make your code a little more readable too, it's very hard to understand when it's only partially formatted as above.

Okay, a few things here:

1) (Minor) You don't necessarily need a custom message type for this, a Twist message is made to transmit exactly this kind of information

2) Currently, you're running a loop that is constantly resubscribing to the topic, and then publishing odom/tf, whether you have received a message or not.

3_ In your main function, you should at most do the initial setup, configure the subscription callback, and call ros::spin(). Every time your message is received, the callback function will be processed, and that's where you can publish odometry message and transform. This is

Currently, you're running a loop that is constantly resubscribing to the topic, and then publishing odom/tf, whether you have received a message or not. Try refactoring the way I described in #2, #3, and if it still doesn't work, update the question with your new code.

Also, please use the markdown formatting to make your code a little more readable too, it's very hard to understand when it's only partially formatted as above.