[Poppy 101] Play with the poppytools

If you succeed the 5 steps of the First start of Poppy, you are free now to play with the poppytools and its primitives !

Install the poppytools

As the poppy-software is under development and is updated daily, the best way is to clone the git repository and install it in develop mode:

cd where-you-want
git clone https://github.com/poppy-project/poppy-software.git
cd poppy-software
python setup.py develop

Now the poppytools are added to your python path and you can easily use them just by using the package import poppytools.

Arms copy primitive:

This primitive allows a direct copy of the left arm motion on the right arm.

import pypot.robot
from poppytools.configuration.config import poppy_config
from poppytools.primitive.interaction import ArmsCopyMotion

poppy = pypot.robot.from_config(poppy_config)
poppy.start_sync()

for m in poppy.arms:
    m.compliant = False

poppy.attach_primitive(ArmsCopyMotion(poppy, 50), 'copy')

poppy.copy.start()
poppy.copy.wait_to_stop()

Walking primitive:

This example will make the arms compliant and the legs will produce a walking gait.

import os
import time
import pypot.robot

import poppytools
from poppytools.configuration.config import poppy_config
from poppytools.primitive.walking import WalkingGaitFromMat

cpg_filename = os.path.join(os.path.dirname(poppytools.__file__), 'behavior', 'IROS_Normal_Gait.mat')

poppy = pypot.robot.from_config(poppy_config)
poppy.start_sync()

for m in poppy.motors:
    m.goto_position(0,2)
    m.compliant = False

for m in poppy.arms:
    m.compliant = True

time.sleep(2)

poppy.attach_primitive(WalkingGaitFromMat(poppy, cpg_filename, compliant_motion=True), 'walk')
poppy.walk.start()

1 Like

Is there a general way to execute the other programs?
For example the StandPosition or the SitPosition?
Does the StandPosition works with the IMU and is it possible for poppy to stand alone?

I’m not sure I have understood the question.

The general way to execute a behavior is to use pypot primitive and start them:

poppy.attach_primitive(StandPosition, 'stand')
poppy.stand.start()

The StandPosition is just a primitive to put the robot in a neutral position, which is quite stable…

I tried it that way:

import pypot.robot
import poppytools
from poppytools.configuration.config import poppy_config
from poppytools.primitive.basic import StandPosition

poppy = pypot.robot.from_config(poppy_config)
poppy.start_sync()

poppy.attach_primitive(StandPosition, ‘stand’)
poppy.stand.start()

[(4.09, -26.07, -10.59, 5.93, 43.65, -5.13, -22.73, -80.57, -49.45, -179.65, 1.71, -91.47, -79.52, 10.24, 8.04, -6.46, 0.4, 1.27, -0.84, -33.27, -13.23, 2.15, -0.04, -1.71, 33.45), (0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), (100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0)]

TypeError Traceback (most recent call last)
/home/faps/ in ()
8
9 poppy.attach_primitive(StandPosition, ‘stand’)
—> 10 poppy.stand.start()
11

TypeError: unbound method start() must be called with StandPosition instance as first argument (got nothing instead)

But I got an Error.
Sorry, I’m not really good in programming and informatics.

If I don’t need the imu for standing, for what do I need it?

I have another question about the walking. Is a spring at the knee necessary? And what spring do you use?

This topic is now unlisted. It will no longer be displayed in any topic lists. The only way to access this topic is via direct link.