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)
Control System Packer is a lightweight, low-level program to transform energy equations into the compact libraries for control systems.

Control System Packer is a lightweight, low-level program to transform energy equations into the compact libraries for control systems. Packer supports Python ?? , C ?? and C++ ?? libraries.

mirnanoukari 31 Sep 15, 2022
Inverted-pendulum-with-fuzzy-control - Inverted pendulum with fuzzy control

Fuzzy Inverted Pendulum Basically, this project consists of an inverted pendulum

Mahan Ahmadvand 1 Aug 25, 2022
A Python library to simulate a Zoom H6 recorder remote control

H6 A Python library to emulate a Zoom H6 recorder remote control Introduction This library allows you to control your Zoom H6 recorder from your compu

Matias Godoy 68 Nov 2, 2022
inverted pendulum fuzzy control python code (python 2.7.18)

inverted-pendulum-fuzzy-control- inverted pendulum fuzzy control python code (python 2.7.18) We have 3 general functions for 3 main steps: fuzzificati

arian mottaghi 4 May 23, 2022
Parser for RISC OS Font control characters in Python

RISC OS Font control parsing in Python This repository contains a class (FontControlParser) for parsing font control codes from a byte squence, in Pyt

Charles Ferguson 1 Nov 2, 2021
Simple control of Thorlabs Elliptec devices from Python.

Elliptec Simple control of Thorlabs Elliptec devices. No docs yet » Get started · Report a bug · Request a feature About The Project ThorLabs Elliptec

David Roesel 8 Sep 22, 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
Projeto-menu - This project is designed to learn more about control mechanisms in Python programming

Projeto-menu - This project is designed to learn more about control mechanisms in Python programming

Henrik Ricarte 2 Mar 1, 2022
Open source home automation that puts local control and privacy first

Home Assistant Open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiast

Home Assistant 57k Jan 2, 2023
Modelling and Implementation of Cable Driven Parallel Manipulator System with Tension Control

Cable Driven Parallel Robots (CDPR) is also known as Cable-Suspended Robots are the emerging and flexible end effector manipulation system. Cable-driven parallel robots (CDPRs) are categorized as a type of parallel manipulators

Siddharth U 0 Jul 19, 2022
MODeflattener deobfuscates control flow flattened functions obfuscated by OLLVM using Miasm.

MODeflattener deobfuscates control flow flattened functions obfuscated by OLLVM using Miasm.

Suraj Malhotra 138 Jan 7, 2023
Control your gtps with gtps-tools!

Note Please give credit to me! Do not try to sell this app, because this app is 100% open source! Do not try to reupload and rename the creator app! S

Jesen N 6 Feb 16, 2022
A web project to control the daily life budget planing

Budget Planning - API In this repo there's only the API and Back-End of the this project. Install and run the project # install virtualenv --python=py

Leonardo Da Vinci 1 Oct 24, 2021
Mengzhan (John) code for Closed Loop Control system of Sharp Wave Ripples in Hippocampus CA3 region

ClosedLoopControl_Yu Mengzhan (John) code for Closed Loop Control system of Sharp Wave Ripples in Hippocampus CA3 region Creating Python Virtual Envir

Mengzhan (John) Liufu 1 Jan 22, 2022
Integration of CCURE access control system with automation HVAC of a commercial building

API-CCURE-Automation-Quantity-Floor Integration of CCURE access control system with automation HVAC of a commercial building CCURE is an access contro

Alexandre Edson Silva Pereira 1 Nov 24, 2021
A utility control surface for Ableton Live that makes the initialization of a Mixdown quick

Automate Mixdown initialization A script that transfers all the VSTs on your MIDI tracks to a new track so you can freeze your MIDI tracks and then co

Aarnav 0 Feb 23, 2022
It is Keqin Wang first project in CMU, trying to use DRL(PPO) to control a 5-dof manipulator to draw line in space.

5dof-robot-writing this project aim to use PPO control a 5 dof manipulator to draw lines in 3d space. Introduction to the files the pybullet environme

Keqin Wang 4 Aug 22, 2022
Check broken access control exists in the Java web application

javaEeAccessControlCheck Check broken access control exists in the Java web application. 检查 Java Web 应用程序中是否存在访问控制绕过问题。 使用 python3 javaEeAccessControl

kw0ng 3 May 4, 2022
This scrypt for auto brightness control

God damn. This scrypt for auto brightness control. The scrypt has voice assistant. You should move this script to auto-upload folder. What do you need

null 0 Jul 25, 2022