Another instance using the serial port

Can you try:

import time

# import you robot as you did

robot.m1.moving_speed = 100
robot.m1.goal_position = 50
time.sleep(1)
robot.m1.goal_position = -50

For an unknown reason, your moving_speed is at 0, so your motors won’t move.

so it does move to one direction now, but does not to the other. I thought this is because it moves very slowly and the other move command gets issued on the bus before the previous action ends, but I gave it a 3 second sleep and still does the same thing. the present position does not change, the servo does not move, the goal position changes though, speed remains on 100, compliance is still false:

dict for m1 is:
> { ‘_safe_compliance’: <pypot.dynamixel.motor.SafeCompliance object at 0x76c32630>,
> ‘_read_synchronous’: defaultdict(<function at 0x75dd10f0>,
> {‘present_temperature’: False,
> ‘name’: False,
> ‘goal_position’: False,
> ‘present_voltage’: False,
> ‘upper_limit’: False,
> ‘lower_limit’: False,
> ‘present_position’: False,
> ‘angle_limit’: False,
> ‘model’: False,
> ‘id’: False,
> ‘moving_speed’: False}),
> ‘direct’: False,
> ‘present_load’: 0.0,
> ‘id’: 1,
> ‘present_temperature’: 36.0,
> ‘compliant’: False,
> ‘_compliant_behavior’: ‘dummy’,
> ‘moving_speed’: 100,
> ‘compliance_slope’: (32, 32),
> ‘_default_goto_behavior’: ‘dummy’,
> ‘_write_synchronous’: defaultdict(<function at 0x75dd11f0>,
> {‘goal_position’: False,
> ‘compliance_slope’: False,
> ‘torque_limit’: False,
> ‘moving_speed’: False,
> ‘compliance_margin’: False}),
> ‘torque_limit’: 100.0,
> ‘_broken’: False,
> ‘goal_position’: 50.0,
> ‘_read_synced’: defaultdict(<class ‘pypot.utils.SyncEvent’>,
> {‘compliance_slope’: <pypot.utils.SyncEvent object at 0x75de46b0>,
> ‘present_temperature’: <pypot.utils.SyncEvent object at 0x75dd8b10>,
> ‘present_voltage’: <pypot.utils.SyncEvent object at 0x75dd8eb0>,
> ‘upper_limit’: <pypot.utils.SyncEvent object at 0x75dd8030>,
> ‘lower_limit’: <pypot.utils.SyncEvent object at 0x75dd8db0>,
> ‘compliance_margin’: <pypot.utils.SyncEvent object at 0x75dd8c70>}),
> ‘upper_limit’: 89.88,
> ‘lower_limit’: -89.88,
> ‘max_pos’: 150,
> ‘offset’: 0.0, ‘compliance_margin’: (1, 1),
> ‘name’: ‘m1’,
> ‘present_speed’: 0.0,
> ‘present_voltage’: 12.3,
> ‘present_position’: -50.59,
> ‘_write_synced’: defaultdict(<class ‘pypot.utils.SyncEvent’>,
> {‘compliance_slope’: <pypot.utils.SyncEvent object at 0x75de4cb0>,
> ‘compliance_margin’: <pypot.utils.SyncEvent object at 0x75de4710>}),
> ‘model’: ‘AX-12A’}

also sorry Theo, I couldn’t figure out how to format my comments so nicely so far, I would’ve if I’ve knew :slight_smile:

edit: I can also see that despite issuing

robot.m1.goal_position = -50

the goal position remains 50, but the present position is set to -50, which is a little strange.

apart the forementioned config structure I run this code now:

robot = pypot.robot.from_config(my_config)
robot.power_up()

for m in robot.a:
    m.moving_speed = 100
    m.goal_position = 50
    print m.present_position
    print 'speed is currently: ', m.moving_speed
    print m.compliant, 'is the current state of compliance'
    print 'sleeping'
    time.sleep(3)
    print 'speed is currently: ', m.moving_speed
    print m.compliant, 'is the current state of compliance'
    m.goal_position = -50
    print m.goal_position, 'is the goal position now'
    print m.present_position
print 'dict for m1 is: '
print robot.a[0].__dict__

which produces the following result:

50.59
speed is currently:  100
False is the current state of compliance
sleeping
speed is currently:  100
False is the current state of compliance
-50.0 is the goal position now
50.59

To be sure you motor is not moving put the sleeping after the goal_position (m.goal_position = -50) because you need to wait for the motor to reach its position.

If nothing change… I give up !

needless to say, that didn’t help either. Interestingly enough right after issuing (with having the wait after them) the command the return values checked out (goal and present position) despite the servo was still moving. moving the wait before asking for the present position value didn’t change anything.