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

Revision history [back]

click to hide/show revision 1
initial version

A subscriber is an object and isn't the same as the messages it's subscribed to. So the line geometry_msgs::Quaternion odom_quat = sub; is definitely a problem.

I'd probably put most of your code into the callback. Then, whenever you get a message, it can calculate the odometry message and publish it.

Also, your subscriber template doesn't match the callback parameter type. You'll want to make them match.