Hello I am new to programming and I am barely understanding Ros. I’m trying to do exercise 3.2 but I’m running into a lot of problems.
Exercise 3.2: “Create a package that launches the code. Modify the code in order to print the odometry of the robot.”
Here’s what I have right now
As you can hopefully see from my picture I have highlighted the place where I think everything breaks down. I found out information about /odom using “rostopic info /odom” to learn it is of type “nav_msgs/Odometry” so I think that’s why that is included in the from and import at the top.
Then I did “rosmsg show nav_msgs/Odometry” to see what messages are inside Odometry (if that is not what rosmsg show does please let me know). There’s a lot of information provided about what variables it contains.
In the one we’re modifying, when you do “rosmsg show std_msgs/Int32” it returns two variables that are Int32 and data, you use the data variable in the callback function. Does anyone have any advice, I don’t know a lot and I would like to know what I’m doing wrong.
** I would also like to include that I think using Odometry in “sub = rospy.Subscriber(’/odom’, Odometry, callback)” in line 10 is wrong because I usually get a lot of error messages about it. I know that spot is reserved for what message I want to send, but I don’t really know what message I’m trying to send I guess.
**Just editing my post to say I think I solved my issue by replacing the highlighted section with “pose” which will show the position and orientation?