Skip to content

vikashplus/dynamixel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python wrapper for dynamixels

Primarily designed for MX series

Set up

  1. Clone the dynamixel robotis repo. Note that the repo has gone through changes that aren't backward compatible. Checkout an earlier commit compatibility .
git clone https://github.com/ROBOTIS-GIT/DynamixelSDK.git  
cd DynamixelSDK
git checkout 2ae37fc2390eedcd8fe356f40ece398720db0532 
  1. build the c library
cd ~/Libraries/DynamixelSDK/c/build/linux64/ 
make 
  1. add path to the ctype wrapper in the bashrc

export PYTHONPATH="/home/vik/Libraries/DynamixelSDK/python/dynamixel_functions_py:$PYTHONPATH"

  1. Edit DynamixelSDK/python/dynamixel_functions_py/dynamixel_functions.py to point to the right libraries (absolute path)

dxl_lib = cdll.LoadLibrary("/home/vik/Libraries/DynamixelSDK/c/build/linux64/libdxl_x64_c.so")

  1. Edit user permissions to access ports
sudo usermod -a -G tty yourname
sudo usermod -a -G dialout yourname

Note that logout/login will be required for the group addition to take effect.

  1. Port's latency can significantly affect your performance. You can check its value by:
$ cat /sys/bus/usb-serial/devices/ttyUSB0/latency_timer

If you think that the communication is too slow, type following after plugging the usb in to change the latency timer

Method 1.

$ echo 1 | sudo tee /sys/bus/usb-serial/devices/ttyUSB0/latency_timer
$ cat /sys/bus/usb-serial/devices/ttyUSB0/latency_timer

Method 2.

$ echo ACTION==\"add\", SUBSYSTEM==\"usb-serial\", DRIVER==\"ftdi_sio\", ATTR{latency_timer}=\"1\" > 99-dynamixelsdk-usb.rules
$ sudo cp ./99-dynamixelsdk-usb.rules /etc/udev/rules.d/

Use commands below to reload the rules, or log-off+login for the new rules to take effect.

$ sudo udevadm control --reload-rules
$ sudo udevadm trigger --action=add
$ cat /sys/bus/usb-serial/devices/ttyUSB0/latency_timer
  1. Create identifiable link for your usb devices now. Check the serial of the device using
udevadm info -a -p  $(udevadm info -q path -n /dev/ttyUSBX) | grep serial

Now add a synlink to your udev file /etc/udev/rules.d/99-dynamixel-usb.rules. The final file will look something like this

ACTION=="add", SUBSYSTEM=="usb-serial", DRIVER=="ftdi_sio", ATTR{latency_timer}="1"
ACTION=="add", SUBSYSTEM=="tty", ENV{ID_MODEL_ID}=="6014", ENV{ID_VENDOR_ID}=="0403", ENV{ID_SERIAL_SHORT}=="FT3R4CCT", SYMLINK+="DKitty"
ACTION=="add", SUBSYSTEM=="tty", ENV{ID_MODEL_ID}=="6014", ENV{ID_VENDOR_ID}=="0403", ENV{ID_SERIAL_SHORT}=="FT2H2MX4", SYMLINK+="DLeg"

Note that logout/login will be required for the new rules to take effect. Alternatively one can also use udevadm control -R

usage

  1. Open dynamixel_utils.py and pick the connected dynamixel type
  2. python dynamixel_utils.pyto test

About

Python interface for Dynamixels

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages