0
$\begingroup$

Rosanswers logo

Hi,

I just solve a situation I don't know how to debug. When subscribing to a topic, the prototype of my callback function was

void my_callback(const std_msgs::String::ConstPtr& msg);

instead of

void my_callback(const control_msgs::JointControllerState::ConstPtr& msg);

However, the code compiled fine and no error was reported at runtime. For future use, where should I look to get more debug info on topic subscriptions?


Originally posted by Stephane Caron on ROS Answers with karma: 5 on 2015-03-20

Post score: 0

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

The actually a WARNING will be at runtime logged at the publisher side:

E. g. if trying to publish a std_msgs/Emtpy to topic /camera/image where rosrun image_view image_view is listening:

rostopic pub /camera/image std_msgs/Empty -r 1
[WARN] [WallTime: 1426844976.659990] Could not process inbound connection: topic types do not match: [sensor_msgs/Image] vs. [std_msgs/Empty]{'topic': '/camera/image', 'tcp_nodelay': '0', 'md5sum': '060021388200f6f0f447d0fcd9c64743', 'type': 'sensor_msgs/Image', 'callerid': '/image_view_1426844958567455361'}

On the subscriber side, however, no Error/Warning is logged:

rosrun image_view  image_view image:=/camera/image
[ INFO] [1426844958.672731010]: Using transport "raw"

So you have to look at the log msgs of the publisher.


Originally posted by Wolf with karma: 7555 on 2015-03-20

This answer was ACCEPTED on the original site

Post score: 3

$\endgroup$
0
$\begingroup$

Rosanswers logo

The message type that is the argument for the callback determines the message type for the subscriber. If you use the wrong message type there, you should get an error at runtime that says message types between publisher and subscriber do not match (red ROS_ERROR logging). This would only appear if you have a actual topic connection, however. Are you sure that is the case?


Originally posted by Stefan Kohlbrecher with karma: 24361 on 2015-03-20

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.