Issue with Odometry [closed]

asked 2021-11-22 13:41:25 -0500

distro gravatar image

updated 2021-11-22 19:34:23 -0500

osilva gravatar image

I have attached a github link to the my actual code so my question makes more sense, if you are reading this please look at the code first so it makes sense. Here is the link: https://github.com/DistroIII/Project/... I am having an odometry issue in my algorithm: When I rostopic echo /odom to cross examine it with whats in my code:

odom=Odometry()

def callback(msg):
    global odom
    odom=msg 

rospy.Subscriber("/odom",Odometry,callback)

It appears for some reason something isn't syncing immediately so the first values of my XO and YO are always both 0 regardless of the actual pose of the robot.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by distro
close date 2022-01-12 12:58:33.675123

Comments

This issue was solved by me adding a rospy.sleep after Initialization of node and declaring of publishers and subscribers.

distro gravatar image distro  ( 2022-01-12 13:02:00 -0500 )edit