{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "#Setup a new motor#\n", "###This is an alternative to the use of the Herborist software###\n", "###Plug only one new motor at a time###" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First scan all available ports." ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "ports found ['/dev/ttyACM99']\n" ] } ], "source": [ "import pypot.dynamixel\n", "\n", "ports = pypot.dynamixel.get_available_ports()\n", "if not ports:\n", " raise IOError('no port found!')\n", "print 'ports found', ports" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "From the available ports, select the port where the new motor is pluggued.\n", "If the new motor is a XL-320 (using another protocol), set the using_XL320 flag to True." ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": true }, "outputs": [], "source": [ "my_port = \"/dev/ttyACM1\" #Change this value to match your setup\n", "using_XL320 = False #Change this value to True if you use XL-320 motors" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Select the new ID and the new baudrate you wish for your motor." ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": true }, "outputs": [], "source": [ "old_id = 1 #Should be 1 if the motor has never been configured\n", "new_id = 10 #Change this value\n", "\n", "old_baudrate = 57600 #Should be 57600 for new MX-28 or MX-64, 1000000 for new AX612A or XL-320\n", "new_baudrate = 1000000 #Should be 1000000" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Change the ID, baudrate and set the return time to 0." ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "scanning\n", "[]\n", "no motor found with ID 1 at baudrate 57600 on port /dev/ttyACM99\n" ] } ], "source": [ "if using_XL320:\n", " dxl_io = pypot.dynamixel.Dxl320IO(my_port, baudrate=old_baudrate)\n", "else:\n", " dxl_io = pypot.dynamixel.DxlIO(my_port, baudrate=old_baudrate)\n", " \n", "print \"scanning\"\n", "found = dxl_io.scan(range(60))\n", "print found\n", "\n", "if old_id in found:\n", " dxl_io.set_return_delay_time({old_id : 0})\n", " dxl_io.change_id({old_id : new_id})\n", " dxl_io.change_baudrate({new_id : new_baudrate})\n", "else:\n", " print \"no motor found with ID \",old_id,\" at baudrate \",old_baudrate, \" on port \",my_port\n", "\n", "dxl_io.close()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Check that the new motor is detected with its new id and new baudrate." ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "scanning\n", "[]\n" ] } ], "source": [ "dxl_io = pypot.dynamixel.DxlIO(my_port, baudrate=new_baudrate)\n", "print \"scanning\"\n", "found = dxl_io.scan(range(60))\n", "print found\n", "dxl_io.close()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.9" } }, "nbformat": 4, "nbformat_minor": 0 }