用python控制dynamixel xl-320伺服系统的库
pyxl320的Python项目详细描述
PYXL320
这项工作仍在进行中,only仅支持xl-320和only 他们的协议版本2.0。库按如下方式划分:
- pyxl320
- ServoSerial - half duplex hardware serial interface
- Packet - creates packets to talk to the servo
- utils - misc
- xl320 - register/command/error definitions for Dynamixel’s XL-320 servo
new:pyxl320现在支持python2和python3。
设置
安装
建议的安装方法是通过pip命令,如下所示:
pip install pyxl320
开发
要提交git拉取,请克隆存储库并按如下方式设置:
git clone https://github.com/walchko/pyxl320 cd pyxl320 pip install -r requirements pip install -e .
使用量
\bin目录有许多有用的程序来设置伺服位置或ID号。只是 使用--help标志运行该命令以了解如何使用它。
Command | Description |
---|---|
^{tt4}$ | pings one or all of the servos |
^{tt5}$ | reboots one or all servos |
^{tt6}$ | resets one or all servos to a specified level |
^{tt7}$ | sets the angle of a given servo |
^{tt8}$ | change the baud rate of the servos |
^{tt9}$ | changes the ID number for a given servo |
Documentation
文档存储在repo中的标记文件中here 包括硬件接口和软件开发。然而,一个简单的例子来转动伺服 并使用USB串行转换器将LED变为绿色:
frompyxl320importxl320frompyxl320importServoSerial,Packet,utilsserial=ServoSerial('/dev/tty.usbserial')# tell it what port you want to use# serial = ServoSerial('/dev/tty.usbserial', fake=True) # use a dummy serial interface for testingserial.open()pkt=Packet.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=packet.makeLEDPacket(1,pyxl320.XL320_LED_GREEN)ret=serial.sendPkt(pkt)print('Status packet:',ret)# here I print out the status packet returned
虽然我做了一些包的创造者(像LED和伺服),你可以 你自己用的是基本的makeWritePacket和makeReadPacket。
frompyxl320importPacket,xl320frompyxl320.Packetimportle# creates little endian numbers# let's make our own servo packet that sends servo 3 to 220.1 degreesID=3reg=xl320.XL320_GOAL_POSITIONparams=le(int(220.1/300*1023))# convert 220.1 degrees to an int between 0-1023pkt=Packet.makeWritePacket(ID,reg,params)
机器人示例
下面是一些示例robots
更改日志
2017-04-01 | 0.9.0 | added python3 support |
2017-03-26 | 0.8.0 | major overhaul and removed the GPIO stuff |
2017-03-19 | 0.7.7 | can switch between GPIO pin and pyserial.setRTS() |
2017-02-20 | 0.7.6 | small fixes and added servo_reboot |
2017-01-16 | 0.7.5 | fixes some small errors |
2016-11-29 | 0.7.4 | add bulk write and small changes |
2016-10-11 | 0.7.1 | small changes/updates |
2016-09-12 | 0.7.0 | refactoring, still working on API |
2016-09-05 | 0.5.0 | published to PyPi |
2016-08-16 | 0.0.1 | init |
软件许可证
MIT许可证(MIT)
版权所有(c)2016 Kevin J.Walchko
兹免费准许任何人取得 本软件和相关文档文件(“软件”),用于处理 不受限制的软件,包括但不限于 使用、复制、修改、合并、发布、分发、再授权和/或销售副本 以及允许向其提供软件的人员 因此,必须满足以下条件:
上述版权公告及本许可公告须包括在 软件的拷贝或大部分。
本软件按“原样”提供,无任何形式的保证,明示或 默示的,包括但不限于适销性、适用性的保证 为了特殊目的和不侵权。在任何情况下,作者或 版权持有人应对任何索赔、损害或其他责任负责,无论 在合同诉讼、侵权诉讼或其他诉讼中,由 与软件的连接或软件的使用或其他交易。