yujinrobot / kobuki

Software for iClebo Kobuki
kobuki.yujinrobot.com
222 stars 176 forks source link

Scan_angle issue in gyro_perf.py #353

Closed ElizavetaElagina closed 9 years ago

ElizavetaElagina commented 9 years ago

Hello! On launching gyro_perf.py I get the following error: 'Tester' object has no attribute scan_angle. What do I do with it?

Best regards, Elizaveta

slivingston commented 9 years ago

The error appears to be due to a race condition between timerCallback() (registered on line 69) and angleCallback() (registered on line 60).

slivingston commented 9 years ago

There are a variety of ways to fix this. I am not sure what is preferred upstream, but you could try

@@ -49,6 +49,8 @@ class Tester(object):
     self.diff_angle = 0.0
     self.accumulated_angle = 0.0
+    self.scan_angle = None  # Place holder until the first scan angle is received

     self.init_time = rospy.Time.now().to_time()
     if self.debug: print 'init time: {0:2.4f}'.format(self.init_time)

@@ -96,6 +98,8 @@ class Tester(object):
         return

     if self.state == "ALIGNING":
+      if self.scan_angle is None:
+        return
       scan_angle = self.scan_angle
       if abs(scan_angle) > radians(1.0):
         cmd_vel = Twist()
slivingston commented 9 years ago

@ElizavetaElagina, if you are interested in studying drift on the Kobuki in general rather than using gyro_perf.py in particular, then you should consider drift_estimation in the kobuki_testsuite Python package (under kobuki_testsuite/src/kobuki_testsuite/ in this repository). A GUI front-end is available in kobuki_qtestsuite.

jihoonl commented 9 years ago

@ElizavetaElagina

I have patched the script as @slivingston suggested. Let me know if you still see a problem.

@slivingston Thanks for patch!

ElizavetaElagina commented 9 years ago

@jihoonl @slivingston Thank you very much! It works fine now.