This class controls an ArbotiX, USBDynamixel, or similar board through a serial connection. More...

Public Member Functions | |
| def | __init__ | 
| Constructs an ArbotiX instance and opens the serial connection.   | |
| def | disableTorque | 
| Turn on the torque of a servo.   | |
| def | disableWheelMode | 
| Put a servo into servo mode.   | |
| def | enableTorque | 
| Turn on the torque of a servo.   | |
| def | enableWheelMode | 
| Put a servo into wheel mode (continuous rotation).   | |
| def | execute | 
| Send an instruction to the device.   | |
| def | getAnalog | 
| Get the value of an analog input pin.   | |
| def | getDigital | 
| Get the value of an digital input pin.   | |
| def | getPacket | 
| Read a dynamixel return packet in an iterative attempt.   | |
| def | getPosition | 
| Get the position of a servo.   | |
| def | getReturnLevel | 
| Get the return level of a device.   | |
| def | getTemperature | 
| Get the temperature of a device.   | |
| def | getVoltage | 
| Get the voltage of a device.   | |
| def | isMoving | 
| Determine if a device is moving.   | |
| def | read | 
| Read values of registers.   | |
| def | rescan | 
| Force the ArbotiX2 to rescan the Dynamixel busses.   | |
| def | setBaud | 
| Set baud rate of a device.   | |
| def | setDigital | 
| Get the value of an digital input pin.   | |
| def | setLed | 
| Set the status of the LED on a servo.   | |
| def | setPosition | 
| Set the position of a servo.   | |
| def | setReturnLevel | 
| Set the return level of a device.   | |
| def | setServo | 
| Set the position of a hobby servo.   | |
| def | setSpeed | 
| Set the speed of a servo.   | |
| def | setWheelSpeed | 
| Set the speed and direction of a servo which is in wheel mode (continuous rotation).   | |
| def | syncRead | 
| Read values of registers on many servos.   | |
| def | syncWrite | 
| Write values to registers on many servos.   | |
| def | write | 
| Write values to registers.   | |
Public Attributes | |
| error | |
| The last error level read back.   | |
Static Public Attributes | |
| int | ANA_BASE = 18 | 
| Register address of first analog port (read only).   | |
| int | BACKWARD = 1 | 
| Direction definition for setWheelSpeed.   | |
| int | FORWARD = 0 | 
| Direction definition for setWheelSpeed.   | |
| int | HIGH = 0xff | 
| Helper definition for analog and digital access.   | |
| int | INPUT = 0 | 
| Helper definition for analog and digital access.   | |
| int | LOW = 0 | 
| Extended ArbotiX Driver.   | |
| int | OUTPUT = 0xff | 
| Helper definition for analog and digital access.   | |
| int | REG_DIGITAL_IN0 = 5 | 
| Register base address for reading digital ports.   | |
| int | REG_DIGITAL_IN1 = 6 | 
| int | REG_DIGITAL_IN2 = 7 | 
| int | REG_DIGITAL_IN3 = 8 | 
| int | REG_DIGITAL_OUT0 = 47 | 
| int | REG_RESCAN = 15 | 
| Register address for triggering rescan.   | |
| int | SERVO_BASE = 26 | 
| Register address of analog servos.   | |
Private Attributes | |
| _mutex | |
| _ser | |
This class controls an ArbotiX, USBDynamixel, or similar board through a serial connection.
Definition at line 38 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.__init__ | ( | self, | |
port = "/dev/ttyUSB0",  | 
        |||
baud = 115200,  | 
        |||
timeout = 0.1  | 
        |||
| ) | 
Constructs an ArbotiX instance and opens the serial connection.
| port | The name of the serial port to open. | 
| baud | The baud rate to run the port at. | 
| timeout | The timeout to use for the port. When operating over a wireless link, you may need to increase this. | 
Definition at line 48 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.disableTorque | ( | self, | |
| index | |||
| ) | 
Turn on the torque of a servo.
| index | The ID of the device to disable. | 
Definition at line 268 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.disableWheelMode | ( | self, | |
| index, | |||
resolution = 10  | 
        |||
| ) | 
Put a servo into servo mode.
| index | The ID of the device to write. | 
| resolution | The resolution of the encoder on the servo. NOTE: if using 12-bit resolution servos (EX-106, MX-28, etc), you must pass resolution = 12. | 
Definition at line 361 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.enableTorque | ( | self, | |
| index | |||
| ) | 
Turn on the torque of a servo.
| index | The ID of the device to enable. | 
Definition at line 260 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.enableWheelMode | ( | self, | |
| index | |||
| ) | 
Put a servo into wheel mode (continuous rotation).
| index | The ID of the device to write. | 
Definition at line 350 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.execute | ( | self, | |
| index, | |||
| ins, | |||
| params, | |||
ret = True  | 
        |||
| ) | 
Send an instruction to the device.
| index | The ID of the servo to write. | 
| ins | The instruction to send. | 
| params | A list of the params to send. | 
| ret | Whether to read a return packet. | 
Definition at line 124 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.getAnalog | ( | self, | |
| index | |||
| ) | 
Get the value of an analog input pin.
| index | The ID of the pin to read (0 to 7). | 
Definition at line 430 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.getDigital | ( | self, | |
| index | |||
| ) | 
Get the value of an digital input pin.
| index | The ID of the pin to read (0 to 31). | 
Definition at line 441 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.getPacket | ( | self, | |
| mode, | |||
id = -1,  | 
        |||
leng = -1,  | 
        |||
error = -1,  | 
        |||
params = None  | 
        |||
| ) | 
Read a dynamixel return packet in an iterative attempt.
| mode | This should be 0 to start reading packet. | 
Definition at line 65 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.getPosition | ( | self, | |
| index | |||
| ) | 
Get the position of a servo.
| index | The ID of the device to read. | 
Definition at line 306 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.getReturnLevel | ( | self, | |
| index | |||
| ) | 
Get the return level of a device.
| index | The ID of the device to read. | 
Definition at line 239 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.getTemperature | ( | self, | |
| index | |||
| ) | 
Get the temperature of a device.
| index | The ID of the device to read. | 
Definition at line 329 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.getVoltage | ( | self, | |
| index | |||
| ) | 
Get the voltage of a device.
| index | The ID of the device to read. | 
Definition at line 318 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.isMoving | ( | self, | |
| index | |||
| ) | 
Determine if a device is moving.
| index | The ID of the device to read. | 
Definition at line 340 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.read | ( | self, | |
| index, | |||
| start, | |||
| length | |||
| ) | 
Read values of registers.
| index | The ID of the servo. | 
| start | The starting register address to begin the read at. | 
| length | The number of bytes to read. | 
Definition at line 166 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.rescan | ( | self | ) | 
Force the ArbotiX2 to rescan the Dynamixel busses.
Definition at line 422 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.setBaud | ( | self, | |
| index, | |||
| baud | |||
| ) | 
Set baud rate of a device.
| index | The ID of the device to write (Note: ArbotiX is 253). | 
| baud | The baud rate. | 
Definition at line 231 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.setDigital | ( | self, | |
| index, | |||
| value, | |||
direction = 0xff  | 
        |||
| ) | 
Get the value of an digital input pin.
| index | The ID of the pin to write (0 to 31). | 
| value | The value of the port, >0 is high. | 
| direction | The direction of the port, >0 is output. | 
Definition at line 463 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.setLed | ( | self, | |
| index, | |||
| value | |||
| ) | 
Set the status of the LED on a servo.
| index | The ID of the device to write. | 
| value | 0 to turn the LED off, >0 to turn it on | 
Definition at line 278 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.setPosition | ( | self, | |
| index, | |||
| value | |||
| ) | 
Set the position of a servo.
| index | The ID of the device to write. | 
| value | The position to go to in, in servo ticks. | 
Definition at line 288 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.setReturnLevel | ( | self, | |
| index, | |||
| value | |||
| ) | 
Set the return level of a device.
| index | The ID of the device to write. | 
| value | The return level. | 
Definition at line 252 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.setServo | ( | self, | |
| index, | |||
| value | |||
| ) | 
Set the position of a hobby servo.
| index | The ID of the servo to write (0 to 7). | 
| value | The position of the servo in milliseconds (1500-2500). A value of 0 disables servo output. | 
Definition at line 483 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.setSpeed | ( | self, | |
| index, | |||
| value | |||
| ) | 
Set the speed of a servo.
| index | The ID of the device to write. | 
| value | The speed to write. | 
Definition at line 298 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.setWheelSpeed | ( | self, | |
| index, | |||
| direction, | |||
| speed | |||
| ) | 
Set the speed and direction of a servo which is in wheel mode (continuous rotation).
| index | The ID of the device to write. | 
| direction | The direction of rotation, either FORWARD or BACKWARD | 
| speed | The speed to move at (0-1023). | 
Definition at line 379 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.syncRead | ( | self, | |
| servos, | |||
| start, | |||
| length | |||
| ) | 
Read values of registers on many servos.
| servos | A list of the servo IDs to read from. | 
| start | The starting register address to begin reading at. | 
| length | The number of bytes to read from each servo. | 
Definition at line 221 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.syncWrite | ( | self, | |
| start, | |||
| values | |||
| ) | 
Write values to registers on many servos.
| start | The starting register address to begin writing to. | 
| values | The data to write, in a list of lists. Format should be [(id1, val1, val2), (id2, val1, val2)] | 
Definition at line 192 of file arbotix.py.
| def arbotix_python.arbotix.ArbotiX.write | ( | self, | |
| index, | |||
| start, | |||
| values | |||
| ) | 
Write values to registers.
| index | The ID of the servo. | 
| start | The starting register address to begin writing to. | 
| values | The data to write, in a list. | 
Definition at line 182 of file arbotix.py.
arbotix_python::arbotix.ArbotiX::_mutex [private] | 
        
Definition at line 48 of file arbotix.py.
arbotix_python::arbotix.ArbotiX::_ser [private] | 
        
Definition at line 48 of file arbotix.py.
int arbotix_python::arbotix.ArbotiX::ANA_BASE = 18 [static] | 
        
Register address of first analog port (read only).
Each additional port is BASE + index.
Definition at line 414 of file arbotix.py.
int arbotix_python::arbotix.ArbotiX::BACKWARD = 1 [static] | 
        
Direction definition for setWheelSpeed.
Definition at line 368 of file arbotix.py.
The last error level read back.
Definition at line 49 of file arbotix.py.
int arbotix_python::arbotix.ArbotiX::FORWARD = 0 [static] | 
        
Direction definition for setWheelSpeed.
Definition at line 366 of file arbotix.py.
int arbotix_python::arbotix.ArbotiX::HIGH = 0xff [static] | 
        
Helper definition for analog and digital access.
Definition at line 396 of file arbotix.py.
int arbotix_python::arbotix.ArbotiX::INPUT = 0 [static] | 
        
Helper definition for analog and digital access.
Definition at line 398 of file arbotix.py.
int arbotix_python::arbotix.ArbotiX::LOW = 0 [static] | 
        
Extended ArbotiX Driver.
Helper definition for analog and digital access.
Definition at line 394 of file arbotix.py.
int arbotix_python::arbotix.ArbotiX::OUTPUT = 0xff [static] | 
        
Helper definition for analog and digital access.
Definition at line 400 of file arbotix.py.
int arbotix_python::arbotix.ArbotiX::REG_DIGITAL_IN0 = 5 [static] | 
        
Register base address for reading digital ports.
Definition at line 405 of file arbotix.py.
int arbotix_python::arbotix.ArbotiX::REG_DIGITAL_IN1 = 6 [static] | 
        
Definition at line 406 of file arbotix.py.
int arbotix_python::arbotix.ArbotiX::REG_DIGITAL_IN2 = 7 [static] | 
        
Definition at line 407 of file arbotix.py.
int arbotix_python::arbotix.ArbotiX::REG_DIGITAL_IN3 = 8 [static] | 
        
Definition at line 408 of file arbotix.py.
int arbotix_python::arbotix.ArbotiX::REG_DIGITAL_OUT0 = 47 [static] | 
        
Definition at line 419 of file arbotix.py.
int arbotix_python::arbotix.ArbotiX::REG_RESCAN = 15 [static] | 
        
Register address for triggering rescan.
Definition at line 410 of file arbotix.py.
int arbotix_python::arbotix.ArbotiX::SERVO_BASE = 26 [static] | 
        
Register address of analog servos.
Up to 10 servos, each uses 2 bytes (L, then H), pulse width (0, 1000-2000ms) (Write only)
Definition at line 417 of file arbotix.py.