-
Notifications
You must be signed in to change notification settings - Fork 1
Python
SP//dr provides an easy-to-use Python library for you to interact with your Poppy Ergo Jr robot.
To install the Python library, you simply have to go in the creative-extensions/python
directory then execute the following command:
python setup.py install
And that's it !
To import the Client
class into your Python script, you need to add the following line:
from ergojunior.client import Client
To be able to communicate with the robot, you need to create a new instance of the class:
host = '127.0.0.1' # The address of the machine hosting the control server
port = 9000 # The port on which the server is listening
client = Client(host, port)
You should now be able to send commands to the server.
Creates a new Client
instance. The host
and port
parameters are the IP address and port of the OSC server connected to the Poppy Ergo Jr robot.
Sets the angle of the motor with the given motor_id
to the given angle
. The motor_id
must be between 1 and 6. The angle
must be a float.
Turns on or off the LED of the motor with the given motor_id
. The motor_id
must be between 1 and 6. The state
must be a boolean, True
to turn on the LED, False
to turn it off.
Turns on or off the torque of the motor with the given motor_id
. The motor_id
must be between 1 and 6. The state
must be a boolean, True
to turn on the torque, False
to turn it off.
Sets the speed of the motor with the given motor_id
to the given speed
. The motor_id
must be between 1 and 6. The speed
must be a 32-bits integer.
Computes the motor angles for the robot to reach the given 3D position before moveing it. x
, y
and z
must be floats.