Consecutive movements in primitive

Hi

I try to implement consecutive movements for two motors in a primitive like this:

class ShowPrimitive(pypot.primitive.Primitive):
    def run(self):
        self.robot.m2.goto_position(0., 1., control="dummy", wait=True)
        time.sleep(.2)
        self.robot.m1.goto_position(0., 1., control="dummy", wait=True)

On first start() both motors move as expected - consecutive. But on second start() for this primitive, both motors are moving at the same time. 3rd start is ok, 4th start not ok, and so on …
If I set control="minjerk" the motors move sometimes erratic.

What’s wrong?

My Setup:
XL320
Raspberry 2
Miniconda Python 2.7.10
PyPot 2.10.0

That’s strange. Can you show me the rest of the code? I’ll try to reproduce the problem.

Hi Pierre

Until now it’s just a kind of test program. I see this problem, when I invoke the ShowPrimitive (enter “g”) and the HidePrimitive (enter “h”) alternating. Other primitives are running fine.
If I switch on logging, I can see, that to both motors values are sent in the problem case.
Used config:

{
  "controllers": {
    "my_dxl_controller": {
      "sync_read": true,
      "protocol": 2,
      "attached_motors": [
        "m1", "m2"
      ],
      "port": "/dev/ttyACM0",
      "syncloop": "LightDxlController"
    }
  },
  "motorgroups": {
  },
  "motors": {
    "m1": {
      "offset": 0.0,
      "type": "XL-320",
      "id": 1,
      "angle_limit": [
        -90.0,
        90.0
      ],
      "orientation": "direct"
    },
    "m2": {
      "offset": 0.0,
      "type": "XL-320",
      "id": 2,
      "angle_limit": [
        -90.0,
        90.0
      ],
      "orientation": "indirect"
    }
  }
}

Thanks
Gerald

robot.py (5.2 KB)

Good catch actually! I’ve spent some times reproducing what you observed and trying to understand were the problem came from.

I think it was because we forget to clear some values from the previous run of a primitive before re-running it. I’ve pushed a branch with a fix here:

https://github.com/poppy-project/pypot/tree/fix-consecutive-primitives

It solves the problem on my test bench (using the simulator), can you tell me if it works for you?

Thanks for the bug report!

Hi Pierre

Thanks for your analysis and your bug fix. Now the primitives works as expected. :grinning:

Greetings from Switzerland
Gerald

1 Like

This topic was automatically closed after 24 hours. New replies are no longer allowed.