Changing the robot pose in the map is too slow

asked 2018-01-12 18:29:11 -0500

starter gravatar image

updated 2018-01-13 04:13:09 -0500

Hi, I am simply trying to change the robot pose in the map's frame whenever the robot detects a landmark, So I am publishing programmatically the desired robot pose to the /initialpose topic and it works fine, but the problem is that after publishing the new pose, the effect takes place after a big delay of 0.5 second, that means you can see in Rviz the robot in the new pose after a delay. This causes an issue for me especially when the robot is moving, therfore is there a solution to reduce this delay ? don't hesitate to ask for further details, thank you in advance.

Edit: this is how I am publishsing:

class test(object):

    def __init__(self):
        rospy.init_node('test')
        rospy.Subscriber("/Landmarks",Pose, self.callback)
        self.pub=rospy.Publisher("/intialpose",PoseWithCovarianceStamped,queue_size=10)

    def callback(self,msg):
        #Do some caculations that takes less than 1ms

        pose = PoseWithCovarianceStamped()
        pose.header.frame_id = "map"
        pose.pose.pose.position.x=x
        pose.pose.pose.position.y=y
        pose.pose.pose.orientation.z=z
        pose.pose.pose.orientation.w=w

        self.pub.publish(pose)


if "__name__"=="__main__":

    node=test() 
    rate=rospy.Rate(10)
    while not rospy.is_shutdown():
            rate.sleep()
edit retag flag offensive close merge delete

Comments

How are you publishing the pose? Can you please give an example of your code?

jayess gravatar image jayess  ( 2018-01-12 19:09:01 -0500 )edit

@jayess you can check the edited version of the question.

starter gravatar image starter  ( 2018-01-13 04:14:21 -0500 )edit