Package: pyservos
pyServosStill under developmentStarting to add XL-430 servopyservosServoSerial- half duplex hardware serial interface using DTR from a USB serial portPiServoSerial- half duplex hardware serial interface using a HW pinutils- miscXL320- register/command/error definitions for Dynamixel's XL-320 servoAX12- register/command/error definitions for Dynamixel's AX-12A servoXL430- register/command/error definitions for Dynamixel's AX-12A servoSetupInstallThe suggested way to install this is via thepipcommand as follows::pip install pyservosDevelopmentI am currently usingpoetryfor my library and usingpyproject.toml. To submit git pulls, clone the repository and set it up as
follows:git clone https://github.com/MultipedRobotics/pyservos
cd pyservos
poetry install
poety run pytestUsageThe\bindirectory has a number of useful programs to set servo position or ID number. Just
run the command with the--helpflag to see how to use it.servoAX12servoXL320(not implemented)servoXL430(not implemented)The above commands have the following format:servoXXXping: find servos on bus, ID[int|None]reboot: reboot a servo, ID[int|None]reset: reset a servo, ID[int], level[int]angle: set new angle in degrees or radians, angle[float], radians[True|False]baudrate: set new baudrate, rate[int]id: set new ID, current_id[int], new_id[int]ValuesID: 1-254reset level: 1 (all), 2(all but ID), 3 (all but ID and baudrate)angle: 0-300 degreesrate: 1000000 is defaultNone: if you leave out the value, there is a default that occurs which is safeDocumentationAX-12A ServoXL-320 ServoXL-430 ServoA simple example to turn the servo and turn the LED on using a USB serial converter:# Run an AX-12 servofrompyservos.servo_serialimportServoSerialfrompyservos.ax12importAX12serial=ServoSerial('/dev/tty.usbserial')# tell it what port you want to use# serial = ServoSerial('dummy')  # use a dummy serial interface for testingserial.open()ax=AX12()pkt=ax.makeServoPacket(1,158.6)# move servo 1 to 158.6 degreesret=serial.sendPkt(pkt)# send packet, I don't do anything with the returned status packetpkt=ax.makeLEDPacket(1,AX12.LED_ON)ret=serial.sendPkt(pkt)Although I have made some packet creators (like LED and Servo), you can make
your own using the basicmakeWritePacketandmakeReadPacket.# Run an XL-320 servofrompyservos.xl320importXL320frompyservos.utilsimportangle2intxl=XL320()# let's make our own servo packet that sends servo 3 to 220.1 degreesID=3reg=XL320.GOAL_POSITIONparams=angle2int(220.1)# convert 220.1 degrees to an int between 0-1023pkt=xl.makeWritePacket(ID,reg,params)Dynaixel ServosRobot ExamplesHere are some examplerobotsOther SoftwareI haven't used these, but they seem good:c++:libdynamixelChange Log2020-01-252.0.0re-architected around protocols rather than servos types2018-04-301.0.1API fixes and starting to add 430 support2018-02-171.0.0added AX-12 support and renamed the library2017-04-010.9.0added python3 support2017-03-260.8.0major overhaul and removed the GPIO stuff2017-03-190.7.7can switch between GPIO pin and pyserial.setRTS()2017-02-200.7.6small fixes and added servo_reboot2017-01-160.7.5fixes some small errors2016-11-290.7.4add bulk write and small changes2016-10-110.7.1small changes/updates2016-09-120.7.0refactoring, still working on API2016-09-050.5.0published to PyPi2016-08-160.0.1initThe MIT License (MIT)Copyright (c) 2016 Kevin J. WalchkoPermission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.