The callback is updated later

asked 2016-08-08 03:15:52 -0500

Lucer gravatar image

updated 2016-08-08 03:54:53 -0500

class Laser:

    def __init__(self):

        self.sub = rospy.Subscriber('front_laser/scan', LaserScan, self.laser_callback)

    def laser_callback(self, scan):

        print "rango 340: " +str(scan.ranges[340])

        ... DoSOMETHING ...

if __name__ == '__main__':

When I execute the node, the print in the callback is updated later with the correct data and I don't know if it is for my code (DoSOMETHING) does many things, my computer is not very powerfull or something wrong with ros - No such check - . If I remove DoSOMETHING, the print is updated correct, but I need doing DoSOMETHING.

My computer is:

model name : Intel(R) Core(TM) i5-4200M CPU @ 2.50GHz

cpu MHz : 800.000

cache size : 3072 KB

RAM : 6 G

I use gazebo simulator with Pioneer 3dx and hayuko laser.

Example: In Gazebo has:

robot ------(range:5)----->

in shell:

5 5 5 .....

You move the robot in gazebo:

robot ----(range:3)-->

in shell:

5 5 5 (after a few seconds) 4 4 3 3 3

Any Ideas?

Sorry for my English and thanks for your answers

edit retag flag offensive close merge delete