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)
Goal: Enable awesome tooling for Bazel users of the C language family.

Hedron's Compile Commands Extractor for Bazel — User Interface What is this project trying to do for me? First, provide Bazel users cross-platform aut

Hedron Vision 290 Dec 26, 2022
Resizing using nnedi3/znedi3/nnedi3cl with center alignment and correct chroma placement

nnedi3_resample A VapourSynth script for easy resizing using nnedi3/znedi3/nnedi3cl with center alignment and correct chroma placement. Requirements n

Home Of VapourSynth Evolution 12 Sep 08, 2022
Larvamatch - Find your larva or punk match.

LarvaMatch Find your larva or punk match. UI TBD API (not started) The API will allow you to specify a punk by token id to find a larva match, and vic

1 Jan 02, 2022
Scitizen - Help scientific research for the benefit of mankind and humanity 🔬

Scitizen - Help scientific research for the benefit of mankind and humanity 🔬 Scitizen has been built from the ground up to give everyone the possibi

Pierre CORBEL 21 Mar 08, 2022
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
easy_sbatch - Batch submitting Slurm jobs with script templates

easy_sbatch - Batch submitting Slurm jobs with script templates

Wei Shen 13 Oct 11, 2022
Python data loader for Solar Orbiter's (SolO) Energetic Particle Detector (EPD).

Data loader (and downloader) for Solar Orbiter/EPD energetic charged particle sensors EPT, HET, and STEP. Supports level 2 and low latency data provided by ESA's Solar Orbiter Archive.

Jan Gieseler 9 Dec 16, 2022
Learning a Little about Containerlab

Learning a Little about Containerlab Hello all. This is the respository based on this blog post. Getting Started Feel free to use this example. You wi

10 Oct 16, 2022
Keep your company's passwords behind the firewall

TeamVault TeamVault is an open-source web-based shared password manager for behind-the-firewall installation. It requires Python 3.3+ and Postgres (wi

//SEIBERT/MEDIA GmbH 38 Feb 20, 2022
script buat mengcrack

setan script buat mengcrack cara install $ pkg install upgrade && pkg update $ pkg install python $ pkg install git $ pip install requests $ pip insta

1 Nov 03, 2021
A one place destination to check whatever is trending on the top social and news websites at present.

UpTrend A one place destination to check whatever is trending on the top social and news websites at present. Explore the docs » View Demo · Report Bu

Google Developer Student Clubs - JGEC 10 Oct 03, 2021
RestMapper takes the pain out of integrating with RESTful APIs.

python-restmapper RestMapper takes the pain out of integrating with RESTful APIs. It removes all of the complexity with writing API-specific code, and

Lionheart Software 8 Oct 31, 2020
Cross-platform MachO/ObjC Static binary analysis tool & library. class-dump + otool + lipo + more

ktool Static Mach-O binary metadata analysis tool / information dumper pip3 install k2l Development is currently taking place on the @python3.10 branc

Kritanta 301 Dec 28, 2022
Bookmarkarchiver - Python script that archives all of your bookmarks on the Internet Archive

bookmarkarchiver Python script that archives all of your bookmarks on the Internet Archive. Supports all major browsers. bookmarkarchiver uses the off

Anthony Chen 3 Oct 09, 2022
Battery conservation Python script for ubuntu to enable battery conservation mode at 60% 80% or 90%

Description Batteryconservation is a small python script wich creates an appindicator for ubuntu which can be used to enable / disable battery conserv

3 Jan 04, 2022
Hacktoberfest 2021 contribution repository✨

🎃 HacktoberFest-2021 🎃 Repository for Hacktoberfest Note: Although, We are actively focusing on Machine Learning, Data Science and Tricky Python pro

Manjunatha Sai Uppu 42 Dec 11, 2022
Welcome to my pod transcript search webb app!

pod_transcript_search Welcome to the pod transcript search webb app! Tech stack used: Languages used: Python (for the back-end), JavaScript (for the f

3 Feb 04, 2022
Mute your mic while you're typing. An app for Ubuntu.

Hushboard Mute your microphone while typing, for Ubuntu. Install from kryogenix.org/code/hushboard/. Installation We recommend you install Hushboard t

Stuart Langridge 142 Jan 05, 2023
Files for QMC Workshop 2021

QMC Workshop 2021 This repository contains the presented slides and example files for the Quantum Monte Carlo (QMC) Workshop 5 October - 23 November,

QMCPACK 39 Nov 04, 2022
A plugin for managing mod installers in Mod Organizer 2

Reinstaller v1.0.* Introduction Reinstaller allows you to conveninetly backup mod installers to re-run later, without risk of them cluttering up your

Alex Ashmore 2 Jun 27, 2022