I have some trouble with my SmartCompliance primitive behaviour. I wondering if it is not due to the fact that the compliance is not set as fast as I think.
I saw in the controller module the compliance was not added by default as a read/write loop:
So, as you can see by directly looking inside the code of the controller, the compliance is actually synced inside the pos/speed/load loop.
def _set_pos_speed_load(self):
change_torque = {}
torques = [not m.compliant for m in self._motors]
for m, t, old_t in zip(self._motors, torques, self._old_torques):
if t != old_t:
change_torque[m.id] = t
self._old_torques = torques
if change_torque:
self._dxl_io._set_torque_enable(change_torque)
rigid_motors = [m for m in self._motors if not m.compliant]
ids = tuple(m.id for m in rigid_motors)
if not ids:
return
values = ((m._values['goal_position'],
m._values['moving_speed'],
m._values['torque_limit']) for m in rigid_motors)
self._dxl_io.set_goal_position_speed_load(dict(zip(ids, values)))
We implemented the synchronisation of the compliance this way to “bypass” the standard dynamixel motor behavior which re-enables the torque when setting a goal position. This should be explained in the doc (added to my todo list ;)).
To answer your two questions:
It will indeed be synced at 50Hz. Yet, I don’t really know what happened if you keep changing the compliance and the goal_position at 50Hz. I don’t have a setup to test this right now, but I’m definitely interested in knowing what would happened. If you test it, let me know!
It is possible yes, but as the compliance is already synced it is a bad idea