UltraBorg Demo GUI - ZeroDivisionError

Forums:

Hi,

When I try to run the UltraBorg Demo GUI, in raspbian I get an error.

My setup is I have 4 TowerPro SG92R servos attached to the Ultraborg.

I have worked through the UltraBorg Tuning GUI with works fine.

The error I get when trying to run the UltraBorm Demo GUI is :

root@piBorg:~/ultraborg# ./ubGui.py
Loading UltraBorg on bus 1, address 36
Found UltraBorg at 36
UltraBorg loaded on bus 1
Traceback (most recent call last):
File "./ubGui.py", line 162, in
app = UltraBorg_tk(None)
File "./ubGui.py", line 20, in __init__
self.Initialise()
File "./ubGui.py", line 90, in Initialise
self.poll()
File "./ubGui.py", line 98, in poll
servo2 = UB.GetServoPosition2()
File "/root/ultraborg/UltraBorg.py", line 649, in GetServoPosition2
powerOut = (float(pwmDuty) - self.PWM_MIN_2) / (self.PWM_MAX_2 - self.PWM_MIN_2)
ZeroDivisionError: float division by zero
root@piBorg:~/ultraborg#

Can you please help ?

piborg's picture

It would seem that there has been a slight mistake with the calibration.

The cause of the error is that the minimum and maximum positions are actually the same value for one of the servos.
When the demo GUI tries to read the current position of that servo it uses the calibrated positions to work out the range of movement and report where the servo is currently positioned between them.
Since both the minimum and maximum are the same it cannot figure out where it is and fails in error.

Based on the fact UB.GetServoPosition2 is the call which failed I think servo #2 will need to be recalibrated.

Subscribe to Comments for " UltraBorg Demo GUI - ZeroDivisionError"