Skip to main content

A library to control dynamixel AX-12+ servos with python

Project description

Documentation Status

PyAX-12

Copyright (c) 2010,2015 Jeremie DECOCK (http://www.jdhp.org)

Description

PyAX-12 is an open source lightweight Python library to control Dynamixel AX-12+ actuators.

Watch a demo on youtube

Dependencies

Install

You can install, upgrade, uninstall PyAX-12 with these commands:

pip install pyax12
pip install --upgrade pyax12
pip uninstall pyax12

Or, if you have downloaded the PyAX-12 source code:

python3 setup.py install

Documentation

PyAX-12 documentation is available on the following page:

http://pyax-12.rtfd.org/

Example usage

In the following examples, the port and baudrate values should be adapted depending on your configuration:

  • for Linux users the port value should be something like “/dev/ttyS0” or “/dev/ttyUSB0”.
  • for Windows users the port value should be something like “COM1”, “COM2”, …

Some other examples are available in the examples directory.

Ping a Dynamixel

from pyax12.connection import Connection

# Connect to the serial port
serial_connection = Connection(port="/dev/ttyUSB0", baudrate=57600)

# Ping the third dynamixel unit
is_available = serial_connection.ping(3)

print(is_available)

# Close the serial connection
serial_connection.close()

Scan (search available Dynamixel units)

from pyax12.connection import Connection

# Connect to the serial port
serial_connection = Connection(port="/dev/ttyUSB0", baudrate=57600)

# Ping the dynamixel unit(s)
ids_available = serial_connection.scan()

for dynamixel_id in ids_available:
    print(dynamixel_id)

# Close the serial connection
serial_connection.close()

Move the first Dynamixel unit to 0° then go to 300° and finally go back to 150°

from pyax12.connection import Connection

# Connect to the serial port
serial_connection = Connection(port="/dev/ttyUSB0", baudrate=57600)

# Goto to 0°
serial_connection.goto(1, 0, degrees=True)

# Wait 2 seconds
time.sleep(2)

# Go back to 300°
serial_connection.goto(1, 300, degrees=True)

# Wait 2 seconds
time.sleep(2)

# Go back to 150°
serial_connection.goto(1, 150, degrees=True)

# Close the serial connection
serial_connection.close()

Warning

If you use the USB2Dynamixel device, make sure its switch is set on “TTL” (otherwise status packets won’t be readable).

Also, please check whether the serial port, the baudrate and the Dynamixel IDs defined in PyAX-12 fits with your hardware.

Bug reports

To search for bugs or report them, please use the PyAX-12 Bug Tracker at:

https://github.com/jeremiedecock/pyax12/issues

Related libraries

Other libraries to control Dynamixel AX-12+ actuators are referenced in the following (non comprehensive) list:

License

The PyAX-12 library is provided under the terms and conditions of the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyax12, version 0.4.dev0
Filename, size File type Python version Upload date Hashes
Filename, size pyax12-0.4.dev0.tar.gz (33.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page