Pypot ⚙️ A Python library for Dynamixel motor control

Overview

PyPI Build Status DOI

Pypot ⚙️ A Python library for Dynamixel motor control

Pypot is a cross-platform Python library making it easy and fast to control custom robots based on multiple models of Dynamixel motors. Use Pypot to:

  • control Robotis motors through USB2Dynamixel, USB2AX or Pixl 4 Raspberry Pi devices,
  • define kinematic chains of a custom robot and control it through high-level commands (Forward & Inverse Kinematics),
  • define primitives (motions applying to motor groups) and easily combine them to create custom complex behaviors (Robot dance, arm shaking, writing with a pen...).
  • define sensor access and processing (QRCode detection, force sensors, RGB-D, ...)

Pypot is also compatible with the CoppeliaSim simulator (formerly V-REP), embeds a REST API for Web-based control, and supports visual programming via Scratch and Snap.

🔌 Compatible hardware

Compatible motors: MX-106, MX-64, MX-28, MX-12, AX-12, AX-18, RX-24, RX-28, RX-64, XL-320, SR-RH4D, EX-106. Derivated versions are also supported (e.g. MX-28AT, MX-28R, MX-28T, ...). Both protocols v1 and v2 are supported but v2 is used only for XL-320. Use Herborist to help detect IDs and baudrates of motors.

Compatible sensors: Kinect 1, QRCode from RGB camera, sonar, micro-switch from Raspberry Pi GPIO, digital or analog sensor connected to Arduino

Compatible interpreters: Python 3.6, 3.7, 3.8, 3.9

Other models of motors and sensors can be integrated with little effort and time. Other programming languages may be connected through the REST API.

Read 📖 Documentation and get ⁉️ Assistance

Pypot is part of the opensource Poppy project

Pypot is part of the Poppy project aiming at developing robotic creations that are easy to build, customize, deploy, and share. It promotes open-source by sharing 3D-printed hardware, software, and web tools.

The Poppy creatures are:

  • Poppy Humanoid: a kid-size humanoid robot designed for biped locomotion and physical human-robot interaction (25 DoF) for biped research and university workshops,
  • Poppy Torso: just the torso of the humanoid robot, with a suction pad to stick it attach it firmly to a desk (13 DoF) for HRI research, university and high school workshops
  • Poppy Ergo Jr: a low-cost robotic arm for primary to middle school (6 Dof) for primary or middle school workshops

Poppy Humanoid

All those creatures are based on a combination of standard dynamixel actuators, 3D printed parts and open-source electronics such as Arduino boards. Both the hardware (3D models, electronics...) and software can be freely used, modified and duplicated.

💻 Installation

If you are using a Poppy robot embedding a Raspberry Pi, Pypot is already shipped with it. For custom robots, just type ⌨️ pip install pypot in your system terminal!

If you intend to modify or add features to Pypot, create a virtual environment and install it from sources instead:

git clone https://github.com/poppy-project/pypot
cd pypot/pypot
pip install .

Additional drivers may be needed for USB2serial, depending of your OS. Check here:

  • USB2AX - this device is designed to manage TTL communication only
  • USB2Dynamixel - this device can manage both TTL and RS485 communication.
  • Pixl board for RaspberryPi

👨‍💻 Contributing

If this is the first time you contribute to Pypot, it is a good idea to share your work on the forum first, we will be happy to give you a hand so that you can contribute to the opensource project.

Comments
  • Incorrect json response

    Incorrect json response

    1/ I created a new HttpServer like below

    import os
    import poppytools
    
    import json
    import pypot
    import argparse
    
    import zerorpc
    
    from pypot.robot import from_json
    from pypot.server import HTTPRobotServer
    
    print pypot.__version__
    print pypot.__path__
    
    from pypot.vrep import from_vrep
    
    config_path = 'poppy_config.json'
    scene_path = 'poppy-standing2.ttt'
    
    
    with open(config_path) as cf:
        config = json.load(cf)
    
    robot = from_vrep(config, '127.0.0.1', 19997, scene_path,
                      tracked_objects=['left_hand_tracker', 'right_hand_tracker'])
    
    #robot.start_sync()
    
    server = HTTPRobotServer(robot, '0.0.0.0', 4242)
    server.run()
    
    time.sleep(1) 
    

    2/ I implemented a js client using jquery to display the motors list coming from motor/list.json rest web service, the js client is here : https://github.com/louzar/poppy_web_client/blob/master/motors.html

    3/ I'm getting a js exception saying Uncaught SyntaxError: Unexpected token.

    4/ The Js client can't parse json response, because it's not well formatted, please look at the snapshot here : https://raw.githubusercontent.com/louzar/poppy_web_client/master/resources/Screenshot%20from%202015-01-01%2021:00:37.png

    opened by louzar 13
  • Dynamic instantiation support in from_config()

    Dynamic instantiation support in from_config()

    Created factory.py in pypot/utils to support dynamic instantiation of classes when reading the JSON file.

    Now classes that can be created from JSON (ex.controllers, motors) do not need to be imported in the config.py file, instead they only need to be registered with the factory (see the pypot/dynamixel/controller.py and pypot/dynamixel/motor.py).

    This way you can define your own controller classes and motors within your project and, as long as they are registered with register_class the standard from_config function will still be able to instantiate them no matter if they are in the pypot model or not. This gives you moch more flexibility to define motors, sensors, controllers, etc. without the need to include them allways in the pypot library.

    enhancement 
    opened by sonelu 7
  • Make motors compliant using low-level IO?

    Make motors compliant using low-level IO?

    Hi,

    I'm trying to use the low-level IO with some DXL 320 motors. It works fine as far as setting goal positions, but I'm wondering how I can set the motors to compliant mode?

    https://poppy-project.github.io/pypot/dynamixel.html

    opened by maximecb 6
  • [WIP] Prepare the version 3.0

    [WIP] Prepare the version 3.0

    This major version should include:

    • [x] merge poppy-creature in pypot for simplicity and maintainability : 19f356cca5005885d546c305bacc07e0060069e3
    • [x] a better mockup robot with a controller faking the movement of a real motor
    • [x] a clean and unified REST API
    • [x] the possibility to run a controller in a separate process
    • [ ] include (if any) recent changes in master pypot and master poppy-creature
    opened by pierre-rouanet 6
  • Change from_config to dynamicaly set missing motors as broken

    Change from_config to dynamicaly set missing motors as broken

    It would be a nice feature to be able to instantiate a PoppyCreature from config (eg. from a json config file) while there is missing motors. It is boring to have to modify by hand the json when we are testing new configurations or when there is a broken wire. Eventually it shouldn’t be the default behaviour, but it could be started from the poppy creature

    poppy = PoppyTorso(allow_missing_motors=True)
    
    ¯\_(ツ)_/¯ 
    opened by show0k 6
  • Support for Herkulex servos and combination with Dynamixel servos in a single robot

    Support for Herkulex servos and combination with Dynamixel servos in a single robot

    The Herkulex code follows the same structure as the one for Dynamixel servos, but is completely independent.

    Only the 'robot/config.py' needs to be changed out of the existing code.

    Servo / OS setup: - Servos baudrates should be set to 115,200 (e.g. with HerkulexManager) - It is also strongly advised to reduce the FTDI latency timer to 1ms (vs 16ms by default) in the port settings of your OS

    Main outstanding points: - tweak the mechansim that sends / receives packets (e.g. via shared queue ?) in order to reduce latency with the FTDI USB-to-serial port. At the moment up to 6 servos can run at 50Hz. - improve handling of long playtimes (> 2.8s) - add the equivalent of the "goal_speed" function - and quite a few things here and there - this is still WIP!

    opened by rml4o 6
  • Security features

    Security features

    During the Maker Faire, a Poppy motor has melted because it has reached an extremely high temperature.

    We could of course run a safe primitive checking for temperature state but maybe there is another way, more low level, embedded in pypot avoiding to let a $250 motor broke it self just because user is stupid ? Maybe not ...

    enhancement 
    opened by matthieu-lapeyre 6
  • What is the purpose of AngleLimitRegisterController?

    What is the purpose of AngleLimitRegisterController?

    What is the purpose of the controller AngleLimitRegisterController that is created by the BaseDxlController when initializing a Poppy Creature?

    Practically the angle limits are set in check_motor_eprom_configurationwhile doing the initialization from json file in from_config and after that they don't change. The controller just reads the values so I can't really see any value in the work that is doing.

    The controller runs at 10Hz - which is quite often - and in it's own thread - which in my case with 4 DXL IOs means I have 4 threads extra when running the robot. This adds unnecessary overhead on the controller loops, not that much because of the processor usage, but because they compete with the other threads over the IO port and interferes with the PosSpeedLoadDxlController that is indeed important.

    Can we just take it out from the BaseDxlController initialization?

    question 
    opened by sonelu 5
  • snap host vs hostname

    snap host vs hostname

    It could be better to keep the hostname in snap blocks (robot.local) because in case of using a zeroconf with avahi-daemon it is not possible to reach the host with the ip address (apart if you manualy set the ip to be on the same network... but users will never do).

    I think someone will re-write the snap blocks to work with ws, so this could be the moment to keep the hostname in the calls.

    opened by jjehl 5
  • correct bug on type str to float

    correct bug on type str to float

    The type is wrong which cause the test float < string to be always True in python 2 and to raise an error in python3. A simple type conversion works fine for both python version.

    bug 
    opened by jjehl 5
  • Pip installation fail

    Pip installation fail

    Python 3.4 Raspbian may 2016

    pip3 install pypot -> invalid wheel

    pip3 install --no-use-wheel pypot -> can't find AUTHORS.md (normal the file is not on pypi)

    bug python3 installation 
    opened by jjehl 5
  • Request: make opencv-contrib an optional dependency

    Request: make opencv-contrib an optional dependency

    In a project with students, the installation of pypot on a Raspberry Pi takes very long because of the dependency with opencv-contrib-python.

    I think it should be possible to use Pypot without this external dependency since people using a library to communicate with Dynamixel devices don't necessary need OpenCV's contrib. Maybe this should move to extra_requires, where pypot features using opencv contrib (which I don't know) would then be unavailable.

    opened by Gregwar 4
  • robot not connecting

    robot not connecting

    hi i have poppy torso and i download the latest pre-installed image for raspberry pi 4, but when i try to connect to the robot it keep given me this error WARNING:pypot.dynamixel.error:Communication error after sending DxlSyncReadDataPacket(ids=(33,...), address=6, length=4)

    opened by cs2r 0
  • bug in angle_limit with INDIRECT orientation ?

    bug in angle_limit with INDIRECT orientation ?

    I believe there is a problem with how angle limits are calculated when a motor is in indirect orientation. Here is a sample config

            "base_arm":{
                "id":2,
                "orientation":"indirect",
                "type":"MX-64",
                "angle_limit":[-180, 180],
                "offset":-50.0
            },
    

    As long is my angle limits are relaxed (here, -180 to 180), everything is fine. Now, if I move the arm in compliant mode, I find my angle limits are [40, 100]. Now, if I modify my config and add those values as angle limits and turn the motors on, my base_arm joint finds itself completely outside of the angle limits and bends over to try to get back within the limits.

    When checking base_arm.angle_limit, the values seems off: [10, -50]. I guess it is [-min-offset, -max-offset], but it doesn't look right. Sorry for not being more precise, I'm rather new to pypot and dynamixels, not sure if direct/indirect is pypot or dynamixel specific.

    opened by tgirod 8
  • Integration testing for RemoteRobotClient

    Integration testing for RemoteRobotClient

    We need tests for the RemoteRobotClient zerorpc interface.

    Even basic testing would have picked up https://github.com/poppy-project/pypot/pull/279#issuecomment-779506274, for example, since pypot.robot.remote.from_remote throws AttributeError immediately

    opened by davidjsherman 1
  • Report correct port even when dynamically allocated

    Report correct port even when dynamically allocated

    The services launcher reports the requested port regardless of which port was actually allocated by the operating system.

    When launching several service instances on the same machine, it is better to allow the OS to dynamically choose a port from the IANA ephemeral range, than to guess at what port numbers haven't been used. Tornado will happily bind an ephemeral port if port 0 is requested.

    To verify that this works with poppy-services, run

    $ poppy-services --poppy-simu --http --http-port 0 poppy-ergo-jr &
    $ sleep 10 ; ss -tlp
    State  Recv-Q Send-Q Local Address:Port   Peer Address:Port                                         
    LISTEN 0      128          0.0.0.0:42961       0.0.0.0:*     users:(("poppy-services",pid=70,fd=7)) 
    LISTEN 0      128             [::]:42961          [::]:*     users:(("poppy-services",pid=70,fd=8)) 
    
    

    The services launcher should retrieve the list of bound sockets from Tornado, instead of reporting the port that was requested https://github.com/poppy-project/pypot/blob/3cab4f46fb09ece9fbdd663b8bdce6e251a145e5/pypot/creatures/services_launcher.py#L218

    opened by davidjsherman 5
  • VrepIOErrors: Remote error

    VrepIOErrors: Remote error

    I am trying to connect to the V-rep, the creature is launched on vrep scene and it is opened but I got this error to prevent further the simulation I have tried all the solution discussed here regarding to this matter. I have tried other vrep version (e.g. V3_6_2 and less), it has the same issue
    from reachy import Reachy reachy = Reachy(simulator='vrep')

    Ubuntu 16.04 Vrep = CoppeliaSim_Edu_V4_0_0_Ubuntu16_04 Pypot = version = '3.1.3' Poppy.creature = version = '2.0.0'

    I would appreciate your help!


    VrepIOErrors Traceback (most recent call last) in () 1 from chapper import Chapper ----> 2 chapper = Chapper(simulator='vrep', host='127.0.0.1')

    /home/marwan/chapper/software/chapper/chapper.pyc in new(cls, *args, **kwargs) 74 kwargs['config'] = config 75 ---> 76 robot = AbstractPoppyCreature.new(cls, *args, **kwargs) 77 robot._controllers[0].io.set_highest_temperature_limit( 78 {m.id: 55 for m in robot.motors}

    /home/marwan/chapper/software/chapper/pypot/creatures/abstractcreature.pyc in new(cls, base_path, config, simulator, scene, host, port, id, shared_vrep_io, use_snap, snap_host, snap_port, snap_quiet, use_http, http_host, http_port, http_quiet, use_remote, remote_host, remote_port, use_ws, ws_host, ws_port, start_background_services, sync, **extra) 101 102 try: --> 103 poppy_creature = from_vrep(config, host, port, scene if scene != "keep-existing" else None, id=id, shared_vrep_io=shared_vrep_io) 104 except VrepConnectionError: 105 raise IOError('Connection to V-REP failed!')

    /home/marwan/anaconda2/envs/mmupy2/lib/python2.7/site-packages/pypot/vrep/init.pyc in from_vrep(config, vrep_host, vrep_port, scene, tracked_objects, tracked_collisions, id, shared_vrep_io) 102 103 vc = VrepController(vrep_io, scene, motors, id=id) --> 104 vc._init_vrep_streaming() 105 106 sensor_controllers = []

    /home/marwan/anaconda2/envs/mmupy2/lib/python2.7/site-packages/pypot/vrep/controller.pyc in _init_vrep_streaming(self) 93 for vrep_call in ['simxGetJointPosition', 'simxGetJointForce']: 94 self.io.call_remote_api(vrep_call, ---> 95 self.io.get_object_handle(self._motor_name(m)), 96 streaming=True, 97 _force=True)

    /home/marwan/anaconda2/envs/mmupy2/lib/python2.7/site-packages/pypot/vrep/io.pyc in get_object_handle(self, obj) 201 """ Gets the vrep object handle. """ 202 if obj not in self._object_handles: --> 203 self._object_handles[obj] = self._get_object_handle(obj=obj) 204 205 return self._object_handles[obj]

    /home/marwan/anaconda2/envs/mmupy2/lib/python2.7/site-packages/pypot/vrep/io.pyc in _get_object_handle(self, obj) 196 197 def _get_object_handle(self, obj): --> 198 return self.call_remote_api('simxGetObjectHandle', obj) 199 200 def get_object_handle(self, obj):

    /home/marwan/anaconda2/envs/mmupy2/lib/python2.7/site-packages/pypot/vrep/io.pyc in call_remote_api(self, func_name, *args, **kwargs) 357 msg = ' '.join([vrep_error[2 ** i] 358 for i, e in enumerate(err) if e]) --> 359 raise VrepIOErrors(msg) 360 361 return res

    VrepIOErrors: Remote error

    opened by Marwanon 3
Releases(5.0.0)
  • 5.0.0(Sep 29, 2021)

    • New REST API with additional endpoints and modified HTTP response codes according to the REST philosophy (incompatible with versions <5), see docs here
    • Integration of the Scratch visual programming language, see docs here
    • Fixed velocity of MX-12 motors
    Source code(tar.gz)
    Source code(zip)
  • 4.0.5(Nov 3, 2020)

  • 4.0.0(Jun 25, 2020)

    • Fixed compatibility with Python 3.5+ and dropped compatibility with Python 2
    • Updated ikpy to the latest version
    • Added optional path for move recorder
    • Download and serve a local Snap when first using it
    • Added Snap entry points for webcam access in the REST API
    • Added notebook ‘Another language’
    Source code(tar.gz)
    Source code(zip)
  • 2.11.3(Mar 15, 2016)

    V 2.11

    Features

    • Add dummy motors (mostly for unittest)
    • add native support for the pixl board
    • allow to disable sensor at loading (convenient for camera sensor)
    • add a dummy camera
    • Add support for RX-24 dynamixel motors
    • Add an event used to check if a "loopable" thread has been updated

    Snap

    • Add blocs: “ping url ” and “set $robot host to ” which aim to fix DNS issues in some filtered networks.
    • update “set of motor(s) to value ” : speed register is now moving_speed instead of goal_speed. Able to use it through many motors at once now
    • fix “get of motor(s)
    • fix some default values of inputs variable for consistency
    • add entry for ik in SnapRemoteServer
    • check return-delay-time at startup to prevent timeouts with misconfigured motors

    Bugfix

    • many primitives threading issues
    • python >= 3.4 compatibility issues
    • setup unittest via dummy robot
    • fix the unclear exception "Cannot unpack *values"
    • fix cli tool poppy-motor-reset and rename it to dxl-config
    • Fix deprecation issue in get_control_table
    • Clear error when there is no "time script" in a v-rep scene
    • Fix a freeze when stopping a paused primitive
    • Fix offset/orientation issue in DummyController
    Source code(tar.gz)
    Source code(zip)
Wordle-solve - Attempting to solve wordle

Wordle Solver Run with python wordle_beater.py. This hardmode wordle solver take

Tom Lockwood 42 Oct 11, 2022
Dockernized ZeroTierOne controller with zero-ui web interface.

docker-zerotier-controller Dockernized ZeroTierOne controller with zero-ui web interface. 中文讨论 Customize ZeroTierOne's controller planets Modify patch

sbilly 209 Jan 04, 2023
Runtime fault injection platform by Daniele Rizzieri (2021)

GDBitflip [v1.04] Runtime fault injection platform by Daniele Rizzieri (2021) This platform executes N times a binary and during each execution it inj

Daniele Rizzieri 1 Dec 07, 2021
Cross-platform config and manager for click console utilities.

climan Help the project financially: Donate: https://smartlegion.github.io/donate/ Yandex Money: https://yoomoney.ru/to/4100115206129186 PayPal: https

3 Aug 31, 2021
Choice Coin 633 Dec 23, 2022
Here is my Senior Design Project that I implemented to graduate from Computer Engineering.

Here is my Senior Design Project that I implemented to graduate from Computer Engineering. It is a chatbot made in RASA and helps the user to plan their vacation in the Turkish language. In order to

Ezgi Subaşı 25 May 31, 2022
Find out where all films you want to watch are streaming

Just Watch Letterboxd Find out where all films you want to watch are streaming Ever wonder what films you want to watch are already on the streaming p

Jordan Oslislo 2 Feb 04, 2022
Heads Down Application for Mac OSX

Heads Down A Mac app that lives in your ribbon—with a click of the mouse, temporarily block distracting websites and applications to encourage "heads

20 Mar 10, 2021
Safe temperature monitor for baby's room. Made for Raspberry Pi Pico.

Baby Safe Temperature Monitor This project is meant to build a temperature safety monitor for a baby or small child's room. Studies have shown the ris

Jeff Geerling 72 Oct 09, 2022
Audio-analytics for music-producers! Automate tedious tasks such as musical scale detection, BPM rate classification and audio file conversion.

Click here to be re-directed to the Beat Inspect Streamlit Web-App You are a music producer? Let's get in touch via LinkedIn Fundamental Analytics for

Stefan Rummer 11 Dec 27, 2022
It's a repo for Cramer's rule, which is some math crap or something idk

It's a repo for Cramer's rule, which is some math crap or something idk (just a joke, it's not crap; don't take that seriously, math teachers)

Module64 0 Aug 31, 2022
A supercharged version of paperless: scan, index and archive all your physical documents

Paperless-ng Paperless (click me) is an application by Daniel Quinn and contributors that indexes your scanned documents and allows you to easily sear

Jonas Winkler 5.3k Jan 09, 2023
An easy FASTA object handler, reader, writer and translator for small to medium size projects without dependencies.

miniFASTA An easy FASTA object handler, reader, writer and translator for small to medium size projects without dependencies. Installation Using pip /

Jules Kreuer 3 Jun 30, 2022
Backend/API for the Mumble.dev, an open source social media application.

Welcome to the Mumble Api Repository Getting Started If you are trying to use this project for the first time, you can get up and running by following

Dennis Ivy 189 Dec 27, 2022
A simple python project which control paint brush in microsoft paint app

Paint Buddy In Python A simple python project which control paint brush in micro

Ordinary Pythoneer 1 Dec 27, 2021
Python for downloading model data (HRRR, RAP, GFS, NBM, etc.) from NOMADS, NOAA's Big Data Program partners (Amazon, Google, Microsoft), and the University of Utah Pando Archive System.

Python for downloading model data (HRRR, RAP, GFS, NBM, etc.) from NOMADS, NOAA's Big Data Program partners (Amazon, Google, Microsoft), and the University of Utah Pando Archive System.

Brian Blaylock 194 Jan 02, 2023
Beginner Projects A couple of beginner projects here

Beginner Projects A couple of beginner projects here, listed from easiest to hardest :) selector.py: simply a random selector to tell me who to faceti

Kylie 272 Jan 07, 2023
Clackety Keyboards Powered by Python

KMK: Clackety Keyboards Powered by Python KMK is a feature-rich and beginner-friendly firmware for computer keyboards written and configured in Circui

KMK Firmware 780 Jan 03, 2023
ERPNext Easy Letterhead

ERPNext Easy Letterhead Intro Quality letterheads are a problem for non-technical users. So we've built (really hacked together) a slightly easier sol

Bantoo 3 Jan 02, 2023
Software that extracts spreadsheets from various .pdf files to .csv

Extração de planilhas de diversos arquivos .pdf para .csv O código inteiro foi desenvolvido em Python. Foi utilizado o pacote "tabula" e a biblioteca

Marcos Silva 2 Jan 09, 2022