Msg vs.

Hi all,

I am stuck at Unit 4 Understanding ROS Topics: Subscribers & Messages.
The subscriber code in example 4.1 has a callback function that prints “”, while the subscriber code in exercise 4.2 has a callback function that prints “msg”, not “”. When I try to print “” in exercise 4.2, I get an error of “AttributeError: ‘Odometry’ object has no attribute ‘data’”, which I do not understand.
What is this error and what is the difference between “msg” and “”?

Thank you in advance.

You have to check the different types of message. There are several messages for several types of data.

fists start by lookin in:
roscd std_msgs

So if you look at your message Odometry, is for other folder. The key is to remember where is the message and look for the structure that is based for, if you look for the odometry you will see it does not have a .data variable.

1 Like

Hi, thank you for your response.
I understand now.