Artist residency: Êtres et Numérique

#Day #7

Development:

After some extra works, I managed to have a very effective behaviour for the smart_compliance. It was just necessary to compute correctly the angle limit of the motors:


class SmartCompliance(pypot.primitive.LoopPrimitive):
    def __init__(self, poppy_robot, motor_list, freq=50, ):
        pypot.primitive.LoopPrimitive.__init__(self,poppy_robot, freq)

        self.poppy_robot = poppy_robot
        self.motor_list = [self.get_mockup_motor(m) for m in motor_list]

        self.compute_angle_limit()

    def update(self):
        for i, m in enumerate(self.motor_list):
            angle_limit = self.angles[i]
            if (min(angle_limit) > m.present_position) or (m.present_position > max(angle_limit)):
                m.compliant = False
            else:
                m.compliant = True

    def compute_angle_limit(self):
        self.angles = []
        for m in self.motor_list:
            ang = numpy.asarray(m.angle_limit) if m.direct else -1 * numpy.asarray(m.angle_limit)
            ang = ang - m.offset
            self.angles.append(ang)

I also had a management of the torque_limit to avoid the augmentation of the motors temperature. We do not care a lot about the precision of the motion, so we can reduce the torque if we are close to the target:


TORQUE_MIN = 20
TORQUE_MAX = 95
MAX_ERROR = 10

class ProtectPoppy(pypot.primitive.LoopPrimitive):
    def __init__(self, poppy_robot, freq=20):
        pypot.primitive.LoopPrimitive.__init__(self, poppy_robot, freq)
        self.poppy_robot = poppy_robot

    def update(self):
        for m in self.poppy_robot.motors:
            self.adjust_torque(m)

    def adjust_torque(self, motor):
        target = motor.goal_position
        pos = motor.present_position
        dist = abs(target - pos)

        if dist > MAX_ERROR:
            motor.torque_limit = TORQUE_MAX
        else:
            motor.torque_limit = TORQUE_MIN + dist/MAX_ERROR * (TORQUE_MAX - TORQUE_MIN)

    def teardown(self):
        for m in self.poppy_robot.motors:
            m.torque_limit = TORQUE_MAX

The applied torque is limite is linearly tuned in function of the error. Thanks to this primitive, I managed to keep temperature below 40°C for all motors.

Experimentation:

After several minutes of intense physical interaction between Poppy and Marie Aline, testing the smart compliance features, she managed to break the fixation between the leg and the r_hip_z motor:

This problem is due to lack of compatibility between some Robotis part. Fortunately, we have already replaced this robotis part by a printed one in the current open source distribution so it should not be a problem for other people.

In our case, it was just 10min of repair, just the time needed to change some screws.

We continued all the day working on the choregraphy and the music with Jean Marc Weber and Marie-Aline:

And we began to create arms motions to be interfaced with the leap motion. Marie-Aline did the choreography of left arm and I did the right one.

We finally managed to run for the first time the whole representation! This first trial took 50 min, way more than the 15-20min targeted yet it was really promising.

Unfortunately, we were not able to do a second trial, the communication problem raised up again. It was impossible to make the robot works again. I was not able to ping any motor on the upper body communication bus. One USB2AX was broken, but even change it, was not effective. The problem was specific to the motors in the upper body.

Later in the evening, I have found a damaged wire connecting the 2 motors of the left shoulder:

However, it was only the 12V wire, so it should not cause such communication problem…