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)
This is collection of Managementsystem programs: Hospital Management, Student Managemen, etc

Contribute in this repository and help other students with their assignment by adding python scripts for various management system programs.

GDSC BVP DET - Navi Mumbai 3 Mar 20, 2022
A way to write regex with objects instead of strings.

Py Idiomatic Regex (AKA iregex) Documentation Available Here An easier way to write regex in Python using OOP instead of strings. Makes the code much

Ryan Peach 18 Nov 15, 2021
An audnexus client, providing rich author and audiobook data to Plex via it's legacy plugin agent system.

Audnexus.bundle An audnex.us client, providing rich author and audiobook data to Plex via it's legacy plugin agent system. 📝 Table of Contents About

David Dembeck 248 Jan 02, 2023
sawa (ꦱꦮ) is an open source programming language, an interpreter to be precise, where you can write python code using javanese character.

ꦱꦮ sawa (ꦱꦮ) is an open source programming language, an interpreter to be precise, where you can write python code using javanese character. sawa iku

Rony Lantip 307 Jan 07, 2023
ColabFold / AlphaFold2_advanced on your local PC (or macOS)

LocalColabFold ColabFold / AlphaFold2_advanced on your local PC (or macOS) Installation For Linux Make sure curl and wget commands are already install

Yoshitaka Moriwaki 207 Dec 22, 2022
IST-Website - IST Tutoring Portal for python

IST Tutoring Portal This portal is a web based interface to handle student help

Jean 3 Jan 03, 2022
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
This collection is to provide an easier way to interact with Juniper

Ansible Collection - cremsburg.apstra Overview The goal of this collection is to provide an easier way to interact with Juniper's Apstra solution. Whi

Calvin Remsburg 1 Jan 18, 2022
Project issue to website data transformation toolkit

braintransform Project issue to website data transformation toolkit. Introduction The purpose of these scripts is to be able to dynamically generate t

Brainhack 1 Nov 19, 2021
Write-ups for CTF Internacional MetaRed 2021 5th stage

MetaRed2021-5th-Writeups Write-ups for CTF Internacional MetaRed 2021 5th stage Easy (15) No Status Category Name Creator(s) 01 Done osint Cybersecuri

UA Cybersecurity 2 Dec 22, 2021
Web站点选优工具 - 优化GitHub的打开速度、高效Clone

QWebSiteOptimizer - Web站点速度选优工具 在访问GitHub等网站时,DNS解析到的IP地址可能并不是最快,过慢的节点会严重影响我们的访问情况,故制作出这样的工具来进一步优化网络质量。 由于该方案并非为VPN等方式进行的速度优化,以下几点需要您注意: 后续访问对应网站时仍可能需

QPT Family 15 May 01, 2022
Gerador do Arquivo Magnético Sintegra em Python

pysintegra é uma lib simples com o objetivo de facilitar a geração do arquivo SINTEGRA seguindo o Convênio ICMS 57/95. Com o surgimento do SPED, muito

Felipe Correa 5 Apr 07, 2022
Code needed for hybrid land cover change analysis for NASA IDS project

Documentation for the NASA IDS change analysis Poley 10/21/2021 Required python packages: whitebox numpy rasterio rasterio.mask os glob math itertools

Andrew Poley 2 Nov 12, 2021
Generate Openbox Menus from a easy to write configuration file.

openbox-menu-generator Generate Openbox Menus from a easy to write configuration file. Example Configuration: ('#' indicate comments but not implement

3 Jul 14, 2022
Frappe app for authentication, can be used with FrappeVue-AdminLTE

Frappeauth App Frappe app for authentication, can be used with FrappeVue-AdminLTE

Anthony C. Emmanuel 9 Apr 13, 2022
Identify and annotate mutations from genome editing assays.

CRISPR-detector Here we propose our CRISPR-detector to facilitate the CRISPR-edited amplicon and whole genome sequencing data analysis, with functions

hlcas 2 Feb 20, 2022
Tools for collecting social media data around focal events

Social Media Focal Events The focalevents codebase provides tools for organizing data collected around focal events on social media. It is often diffi

Ryan Gallagher 80 Nov 28, 2022
A Python 3 client for the beanstalkd work queue

Greenstalk Greenstalk is a small and unopinionated Python client library for communicating with the beanstalkd work queue. The API provided mostly map

Justin Mayhew 67 Dec 08, 2022
Code and yara rules to detect and analyze Cobalt Strike

Cobalt Strike Resources This repository contains: analyze.py: a script to analyze a Cobalt Strike beacon (python analyze.py BEACON) extract.py; extrac

Tek 224 Jan 04, 2023
Discord's own Dumbass made for shits n' Gigs!

FWB3 Discord's own Dumbass made for shits n' Gigs! Please note: This bot is made to be stupid and funny, If you want to get into bot development you'r

1 Dec 06, 2021