Checksum errors

Hi,

I can not manage to have Poppy running for more than 3 minutes. There are always errors that make the computer lose connexion with the robot and I have to restart everything again: unplug the USB2AX and the power of Poppy.

I regularly have checksum errors. They seem to happen at random times, but most particularly when I ask Poppy to play a recorded movements.
If I understand well from what I read, this could come from connexion problems? I checked and it seems all the connections are plugged fine. I use a (one) USB2AX for Poppy-torso, and I have the last up-to-date pypot (pip install pypot --upgrade) running on a macos x yosemite.

My program is:

#importer des fonctions
import time
import math
import json
import pypot.robot
from pypot.primitive.move import MoveRecorder, Move, MovePlayer

#se connecter au robot
ergo = pypot.robot.from_json('poppy_torso/configuration/poppy_torso_repaired.json')

#on met le robot debout: tous les moteurs a 0
#for m in ergo.motors:
indicesTable=[1,2,3,4,5,6,7,8,9,11,12,13]; #[10,11,12,13]
for m in [ergo.motors[x] for x in indicesTable]:
    m.compliant=False
    m.goal_position=0.0

#imprimer tous les noms des moteurs
for x in range(0,len(ergo.motors)):
   print "motor ",x," is ", ergo.motors[x].name

#indiquer quels moteurs on relache
indices=[11,12,13,14,10,7,8,9,2]; #[10,11,12,13]
for m in [ergo.motors[x] for x in indices]:
   m.compliant=True


#commencer l'enregistrement
move_recorder = MoveRecorder(ergo, 50, ergo.motors)
move_recorder.start()
print "start"

#duree de l'enregistrement
time.sleep(10)

#arreter l'enregistrement
print "stop"
time.sleep(2)
move_recorder.stop()

for m in range(0,len(ergo.motors)):
  ergo.motors[m].compliant=False


#sauvegrader le fichier sous le nom 'my_nice_move.txt'
with open('my_nice_move.txt', 'w') as f:
     move_recorder.move.save(f)


#rejouer le mouvement sauvegarde sans le fichier
with open('my_nice_move.txt') as f:
     m = Move.load(f)

ergo.compliant = False
 
move_player = MovePlayer(ergo, m)
move_player.start()

time.sleep(10)
print("end")

and I get errors like:

 Exception in thread Thread-3:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/Library/Python/2.7/site-packages/pypot/utils/stoppablethread.py", line 119, in _wrapped_target
    self._target()
  File "/Library/Python/2.7/site-packages/pypot/utils/stoppablethread.py", line 179, in run
    make_update_loop(self, self._update)
  File "/Library/Python/2.7/site-packages/pypot/utils/stoppablethread.py", line 152, in make_update_loop
    update_func()
  File "/Library/Python/2.7/site-packages/pypot/dynamixel/controller.py", line 150, in update
    self.get_present_position_speed_load(self.working_motors)
  File "/Library/Python/2.7/site-packages/pypot/dynamixel/controller.py", line 155, in get_present_position_speed_load
    values = self.io.get_present_position_speed_load(ids)
  File "/Library/Python/2.7/site-packages/pypot/dynamixel/io/abstract_io.py", line 358, in my_getter
    return self._get_control_value(control, ids, **kwargs)
  File "/Library/Python/2.7/site-packages/pypot/dynamixel/io/abstract_io.py", line 390, in _get_control_value
    _force_lock=True)
  File "/Library/Python/2.7/site-packages/pypot/dynamixel/io/abstract_io.py", line 537, in _send_packet
    f(error_handler)
  File "/Library/Python/2.7/site-packages/pypot/dynamixel/error.py", line 43, in handle_checksum_error
    raise NotImplementedError
NotImplementedError

What kind of errors is that? If it is a connexion error, how do we know which connexion it is? How can we avoid these connexions?

Hello,

I had the same issues. The checksum error is due to electromagnetic disturbances which is unavoidable. If one message is lost, it is not so critical at 50Hz.
To cancel these errors, I advise you to modify the file :
/Library/Python/2.7/site-packages/pypot/dynamixel/error.py

Replacing

def handle_checksum_error(self, instruction_packet):
    raise NotImplementedError

by

def handle_checksum_error(self, instruction_packet):
    # This kind of error is not critical for the robot.
    print "A checksum error happened."

Doing this, if a checksum error happens, the software will continue.

If you’re controlling the robot directly connected to your mac with OSX this is the problem. OSX serial drivers don’t works well, @Pierre use a linux gest OS with VMware to controll motors with a usb2ax.

Thanks @Thot. Changing error.py worked better for me.
@Theo : I will try switching to a Debian or a Ubuntu to see if it works better.

Hi,

I tried on a linux (Ubunutu 14.04 LTS, not as a virtual machine) and we still have the same error messages. I guess it is not specific to OSX then.

I had the same error message and lost connexion with the motors of Poppy through USB2AX

I tested a different script that seems to raise the same issues:

from poppy_torso import PoppyTorso
poppy = PoppyTorso()

poppy.start_sync()

for m in poppy.motors:
print m.name

print poppy.motors

To be thorough, we have actually different kinds of error that arrives (randomly) when using poppy_torso.
Sometimes we have the error described above.
Sometimes we have thie following one:

Traceback (most recent call last):
File “test_torso.py”, line 4, in
poppy = PoppyTorso()
File “/usr/local/lib/python2.7/dist-packages/poppy_creature-1.7.1-py2.7.egg/poppy/creatures/abstractcreature.py”, line 96, in new
poppy_creature = from_json(config, sync)
File “/usr/local/lib/python2.7/dist-packages/pypot-2.10.1-py2.7.egg/pypot/robot/config.py”, line 244, in from_json
return from_config(config, sync=sync, strict=strict, use_dummy_io=use_dummy_io)
File “/usr/local/lib/python2.7/dist-packages/pypot-2.10.1-py2.7.egg/pypot/robot/config.py”, line 62, in from_config
check_motor_limits(config, dxl_io, motor_names)
File “/usr/local/lib/python2.7/dist-packages/pypot-2.10.1-py2.7.egg/pypot/robot/config.py”, line 183, in check_motor_limits
old_limits = dxl_io.get_angle_limit((id, ))[0]
File “/usr/local/lib/python2.7/dist-packages/pypot-2.10.1-py2.7.egg/pypot/dynamixel/io/abstract_io.py”, line 358, in my_getter
return self._get_control_value(control, ids, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/pypot-2.10.1-py2.7.egg/pypot/dynamixel/io/abstract_io.py”, line 443, in _get_control_value
models = self.get_model(ids)
File “/usr/local/lib/python2.7/dist-packages/pypot-2.10.1-py2.7.egg/pypot/dynamixel/io/abstract_io.py”, line 231, in get_model
return tuple(self._known_models[id] for id in ids)
File “/usr/local/lib/python2.7/dist-packages/pypot-2.10.1-py2.7.egg/pypot/dynamixel/io/abstract_io.py”, line 231, in
return tuple(self._known_models[id] for id in ids)
KeyError: 36

Sometimes we got this one (less significant):

Traceback (most recent call last):
File “test_torso.py”, line 4, in
poppy = PoppyTorso()
File “/usr/local/lib/python2.7/dist-packages/poppy_creature-1.7.1-py2.7.egg/poppy/creatures/abstractcreature.py”, line 96, in new
poppy_creature = from_json(config, sync)
File “/usr/local/lib/python2.7/dist-packages/pypot-2.10.1-py2.7.egg/pypot/robot/config.py”, line 244, in from_json
return from_config(config, sync=sync, strict=strict, use_dummy_io=use_dummy_io)
File “/usr/local/lib/python2.7/dist-packages/pypot-2.10.1-py2.7.egg/pypot/robot/config.py”, line 60, in from_config
dxl_io = dxl_io_from_confignode(config, c_params, attached_ids, strict)
File “/usr/local/lib/python2.7/dist-packages/pypot-2.10.1-py2.7.egg/pypot/robot/config.py”, line 139, in dxl_io_from_confignode
port = pypot.dynamixel.find_port(ids, strict)
File “/usr/local/lib/python2.7/dist-packages/pypot-2.10.1-py2.7.egg/pypot/dynamixel/init.py”, line 105, in find_port
ids, list(set(ids) - set(ids_founds))))
IndexError: No suitable port found for ids [33, 34, 35, 36, 37, 41, 42, 43, 44, 51, 52, 53, 54]. These ids are missing [51, 42, 43, 44, 52] !

And more importantly, sometimes we got this latter (that completely freezes python and makes us kill it):

Exception in thread Thread-3:
Traceback (most recent call last):
File “/usr/lib/python2.7/threading.py”, line 810, in __bootstrap_inner
self.run()
File “/usr/lib/python2.7/threading.py”, line 763, in run
self.__target(*self.__args, **self.__kwargs)
File “/usr/local/lib/python2.7/dist-packages/pypot-2.10.1-py2.7.egg/pypot/utils/stoppablethread.py”, line 113, in _wrapped_target
self._setup()
File “/usr/local/lib/python2.7/dist-packages/pypot-2.10.1-py2.7.egg/pypot/dynamixel/controller.py”, line 143, in setup
positions, speeds, loads = zip(*values)
ValueError: need more than 0 values to unpack

And sometimes, the script will work perfectly, even a few times in a row.
Anyone has an idea?

These motors “[51, 42, 43, 44, 52]” are missing. A wire on your left arm is propably disconnected or unplugged.

This happen when a motor send malformed datas. If a wire is almost disconnected, motor can answer to a ping but send after wrong datas.

Generally, we either have all motors undetected (IndexError) or no IndexError. The case described is very rare and weird.

For the ValueError, we checked the connection and it seems alright. The error will always occur when we repeat the script I wrote. Even if the robot weren’t touched.

Connect you in ssh to the robot, open an ipython shell and copy paste this code

import pypot.dynamixel

ports = pypot.dynamixel.get_available_ports()
if not ports:
    raise IOError('no port found!')
print 'ports found', ports

for port in ports:
    print 'connecting to the port:', port
    dxl_io = pypot.dynamixel.DxlIO(port)
    print "scanning"
    found =  dxl_io.scan(range(65))
    print found

If you have the same error, disconnect motors by lines (ie. first irght arm, re-execute it and disconnect left arm, again and again). When you will have disconnected the broken motor or wire the error may disapear.