Poppy v1 : Install and first program tutorial to the open source printable humanoid robot

Maith Egeek
8 min readMay 30, 2021

Poppy humanoid robot is a humanoid robot that can be used with its hardware platform or with the V-rep simulator. It can be programmed with python, using the pypot library, or it can also have a web interface with snap.

The humanoid Poppy robot is part of a family of robots called Poppy, that work under the same principle and installations, but differ by the configuration of the composing motors.

Motor configuration (names) of Poppy humanoid

In November 2020, they have released a version 3 of Poppy.

Below is information related to version 1 release since 2013–2014. This tutorial walk you step by step how to set up your hardware, software, but also how to try your first programs with Poppy robot or with the simulator.

Set up the Hardware

Additional wrists

You would need to install software to setup the motors:

Screenshot of Dynamixel wizard 2 Scan setting window

Every Dynamixel motor has its own configuration including:

  • its digital identifier (e.g. id=21, this is the right hip motor)
  • its baudrate: the speed of communication
  • its return delay time

By default all brand new motors have an id = 1 with default communication parameters, so all motors need to be configured one-by-one in order to be attributed their right parameters.

You have to set:

  • The digital ID corresponding to the naming convention
  • Baudrate to 1 000 000 bps
  • Return delay time to 0 ms instead of 0.5 ms

In Herborist, don’t forget to click on the ’Update EEPROM’ button so the changes are taken in account.

Set up the Software

Poppy uses pypot for control. It is a python library : http://poppy-project.github.io/pypot/ On the top of pypot are libraries for Poppy creatures : https://github.com/poppy-project.

The quick install consists in:

  • install pypot :
sudo pip install pypot
  • install your popppy creature. For instance for poppy humanoid :
sudo pip install poppy_humanoid
  • to check that the libraries are installed correctly, execute with python the code:
from poppy_humanoid import PoppyHumanoid 
poppy = PoppyHumanoid()

A good guide can be found here: https://github.com/HumaRobotics/poppy-examples/blob/master/doc/softwareGuide/softwareGuide.pdf. More technical details about pypot, you can look at installation of pypot.

In detail, this is how I installed the software:

sudo easy_install pypot

or

sudo pip install pypot
  • install the poppy_humanoid library: download Poppy model
git clone https://github.com/poppy-project/poppy-humanoid.git
  • then go to the where-you-downloaded-poppy-humanoid/software folder and install with the terminal command
python setup.py install
  • To check if everything is installed correctly, you can run the following code from folder where-you-downloaded-poppy-humanoid/software. If it runs without raising an error, everything is probably installed correctly:
import time 
import math
import json
import pypot.robot
poppy = pypot.robot.from_json(‘poppy_torso/configuration/poppy_torso.json’)

If you have trouble detecting your motors, you can follow the step 2 of https://forum.poppy-project.org/t/first-start-of-poppy and run in python (replace in below PORT_UPPER_BODY and PORT_LOWER_BODY with the name of the ports such as /dev/ttyACM0 )

import pypot.dynamixel
dxl_io_upper = pypot.dynamixel.DxlIO('PORT_UPPER_BODY')
dxl_io_lower = pypot.dynamixel.DxlIO('PORT_LOWER_BODY')
print dxl_io_upper.scan(range(60))
print dxl_io_lower.scan(range(60))

Another example of code is :

import pypot.dynamixel 
print pypot.dynamixel.get_available_ports()
#prints on the raspberry [‘/dev/ttyACM2’, ‘/dev/ttyACM1’, ‘/dev/ttyACM0’] ;
#prints on the macbook [‘/dev/tty.usbmodem142201’, ‘/dev/tty.usbmodem142301’, ‘/dev/tty.usbmodem142101’]
dxl_io = pypot.dynamixel.DxlIO(‘/dev/tty.usbmodem142301’)
print dxl_io.scan()

Control the robot

You have several ways to control the Poppy robot, using pre-built Pypot methods/class:

  • Setting the goal_position attribute: the joint will immediately try to go as close to the goal as possible (given the angle limits) w.r.t the maximum speed allowed on this joint (which is set via the moving_speed attribute). This will not take the present_speed attribute of the joint into account;
  • Setting the goal_speed attribute: the joint will immediately set the speed of the joint to the given value, replacing the current goal_position with the angle limit corresponding to the speed direction;
  • Using the goto_position(goal,time) method: this will actually set the goal_position to the given goal value, and also set the moving_speed of the joint to (goal-present_position)/t;
  • Using the higher level MovePlayer class: this class implements a LoopPrimitive in order to update frequently the goal_position attribute of the joint (N.B: the moving_speed attribute is not modified by the class when playing the motion and the robot will keep in mind the last moving_speed sent).

If the moving_speed attribute is set to 0, then the joint will move at full speed (N.B: If you’re unsure of the moving_speed you sent last to the robot and want to play a movement using MovePlayer, it is recommended to initially set the moving_speed of all the involved joints to 0.0).

First Program

  • Simple motor command :
from poppy_humanoid 
import PoppyHumanoid
import time
import pypot.robot
poppy = PoppyHumanoid() # or poppy = pypot.robot.from_config(poppy_config) poppy.head_z.compliant =False
poppy.head_z.max_torque=20
poppy.head_z.goal_position=20
poppy.head_z.goto_position(-20,3)
time.sleep(5)
print “before moving”
poppy.head_z.goto_position(40,3, wait=True)
print “after moving”
  • Make it reset to its standing position :
from poppy_humanoid 
import PoppyHumanoid
import time
import pypot.robot
poppy = PoppyHumanoid() # or poppy = pypot.robot.from_config(poppy_config) for m in poppy.motors:
m.compliant = False
for m in poppy.motors:
m.goto_position(0, 5)
time.sleep(5)
#import libraries
import time
import math
import json
import pypot.robot
from pypot.primitive.move import MoveRecorder, Move, MovePlayer

#connect to the robot
poppy = pypot.robot.from_json('poppy_torso/configuration/poppy_torso_broken.json')

#standing position: all motors to joint position 0
for m in poppy.motors:
m.compliant=False
m.goal_position=0.0

#print the names of all motors
for x in range(0,14):
print "motor ",x," is ", poppy.motors[x].name

#put designed motors in compliant mode
indices=[10,11,12,13]
for m in [poppy.motors[x] for x in indices]:
m.compliant=True


#start recording
move_recorder = MoveRecorder(poppy, 50, poppy.motors)
move_recorder.start()
print "start"

#duration of the recording
time.sleep(6)

#stop recording
print "stop"
move_recorder.stop()

for m in range(0,14):
poppy.motors[m].compliant=False


#save in a file
with open('my_nice_move.txt', 'w') as f:
move_recorder.move.save(f)


#replay a saved movement in a file
with open('my_nice_move.txt') as f:
m = Move.load(f)

poppy.compliant = False

move_player = MovePlayer(poppy, m)
move_player.start()

Other examples can be tested from https://github.com/HumaRobotics/poppy-examples.

Using the Vrep/CoppeliaSim Simulator

A poppy simulator is available with vrep simulator. The installation and the control part. V-rep simulator is now called CoppeliaSim.

In details, this is what I did:

git clone https://github.com/poppy-project/poppy-humanoid.git
  • in software folder, run
sudo python setup.py install
  • To check if everything is installed correctly, you can run the following code. If it runs without raising an error, everything is probably installed correctly:
from pypot.vrep import from_vrep 
from poppy.creatures import PoppyHumanoid
  • To instantiate poppy in vrep

— Open vrep/CoppeliaSim : click yes when prompted if you accept all incoming communications.

— Run the following code in python:

from poppy.creatures import PoppyHumanoid 
poppy = PoppyHumanoid(simulator=’vrep’)

Poppy should now appear on the CoppeliaSim simulation screen, and a popup appeared in CoppeliaSim to inform you that the simulation use custom parameters. This popup block the communication to the Python API of CoppeliaSim. You have to check the check-box “Do not show this message again” and press “Ok”. Do this 3 times.

If instead it does now appear and you get an error message

Traceback (most recent call last):
File "/Users/mai/opt/anaconda3/lib/python3.8/site-packages/pypot/creatures/abstractcreature.py", line 103, in __new__
poppy_creature = from_vrep(config, host, port, scene if scene != "keep-existing" else None, id=id, shared_vrep_io=shared_vrep_io)
File "/Users/mai/opt/anaconda3/lib/python3.8/site-packages/pypot/vrep/__init__.py", line 88, in from_vrep
vrep_io = VrepIO(vrep_host, vrep_port)
File "/Users/mai/opt/anaconda3/lib/python3.8/site-packages/pypot/vrep/io.py", line 70, in __init__
self.open_io()
File "/Users/mai/opt/anaconda3/lib/python3.8/site-packages/pypot/vrep/io.py", line 80, in open_io
raise VrepConnectionError(
pypot.vrep.io.VrepConnectionError: Could not connect to V-REP server on 127.0.0.1:19997. This could also means that you still have a previously opened connection running! (try pypot.vrep.close_all_connections())

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/mai/opt/anaconda3/lib/python3.8/site-packages/pypot/creatures/abstractcreature.py", line 105, in __new__
raise IOError('Connection to V-REP failed!')
OSError: Connection to V-REP failed!
>>> poppy = PoppyHumanoid(simulator='vrep')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/mai/opt/anaconda3/lib/python3.8/site-packages/pypot/creatures/abstractcreature.py", line 103, in __new__
poppy_creature = from_vrep(config, host, port, scene if scene != "keep-existing" else None, id=id, shared_vrep_io=shared_vrep_io)
File "/Users/mai/opt/anaconda3/lib/python3.8/site-packages/pypot/vrep/__init__.py", line 104, in from_vrep
vc._init_vrep_streaming()
File "/Users/mai/opt/anaconda3/lib/python3.8/site-packages/pypot/vrep/controller.py", line 126, in _init_vrep_streaming
self.io.set_motor_position(self._motor_name(m), p)
File "/Users/mai/opt/anaconda3/lib/python3.8/site-packages/pypot/vrep/io.py", line 151, in set_motor_position
self.call_remote_api('simxSetJointTargetPosition',
File "/Users/mai/opt/anaconda3/lib/python3.8/site-packages/pypot/vrep/io.py", line 359, in call_remote_api
raise VrepIOErrors(msg)
pypot.vrep.io.VrepIOErrors: No value

type in the Sandbox script terminal

simExtRemoteApiStart(19997)

— Check the communication is fine with the following code:

poppy.motors #prints the list of all motors of the robot
poppy.l_shoulder_y #prints the properties of l_shoulder_y
poppy.head_y.present_position # print the joint angle of the motor head_y
[m.present_position for m in poppy.motors] #prints the joint positions of all motors

Test the installation :

  • To test that you can control poppy (its head):
poppy.reset_simulation() 
poppy.head_z.goto_position(-45, 2) #control the head_z motor position to -42, move in 2s.
  • Now let’s make the robot’s head move.

— In python run the control code:

import time 
import math
current, goal = [], []
amp=60
freq=0.5
t0 = time.time()

while True:
t = time.time()

# run for 5s
if t — t0 > 50:
break

poppy.head_z.goal_position = amp * math.sin(2 * 3.14 * freq * t)
current.append(poppy.head_z.present_position)
goal.append(poppy.head_z.goal_position)
time.sleep(0.04)

— then plot the goal and actual positions:

import numpy 
from matplotlib
import pyplot
t = numpy.linspace(0, 5, len(current))
pyplot.plot(t, goal)
pyplot.plot(t, current)
pyplot.legend((‘goal’, ‘current’))
pyplot.show()

Quick links

  • A start-up tutorial:

— getting started with Poppy https://forum.poppy-project.org/t/getting-started-with-poppy-project/362

— the official doc : https://github.com/poppy-project/poppy-humanoid/blob/master/doc/en/getting_started.md

— a good step to step tutorial: https://github.com/HumaRobotics/poppy-examples/tree/master/doc

— and tutorials on their forum: https://forum.poppy-project.org/tags/tutorial

— other official website (to see other institutions using Poppy) : https://www.poppystation.org

— Install pypot : http://poppy-project.github.io/pypot/intro.html#installation

— Install software for poppy : https://github.com/poppy-project/poppy-torso

  • Example programs:

— Move and replay movements: http://poppy-project.github.io/pypot/move.html

--

--