用python控制dynamixel xl-320伺服系统的库

pyxl320的Python项目详细描述


animated gif

PYXL320

Latest VersionLicensehttps://travis-ci.org/MomsFriendlyRobotCompany/pyxl320.svg?branch=master

这项工作仍在进行中,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标志运行该命令以了解如何使用它。

CommandDescription
^{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和伺服),你可以 你自己用的是基本的makeWritePacketmakeReadPacket

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-010.9.0added python3 support
2017-03-260.8.0major overhaul and removed the GPIO stuff
2017-03-190.7.7can switch between GPIO pin and pyserial.setRTS()
2017-02-200.7.6small fixes and added servo_reboot
2017-01-160.7.5fixes some small errors
2016-11-290.7.4add bulk write and small changes
2016-10-110.7.1small changes/updates
2016-09-120.7.0refactoring, still working on API
2016-09-050.5.0published to PyPi
2016-08-160.0.1init

软件许可证

MIT许可证(MIT)

版权所有(c)2016 Kevin J.Walchko

兹免费准许任何人取得 本软件和相关文档文件(“软件”),用于处理 不受限制的软件,包括但不限于 使用、复制、修改、合并、发布、分发、再授权和/或销售副本 以及允许向其提供软件的人员 因此,必须满足以下条件:

上述版权公告及本许可公告须包括在 软件的拷贝或大部分。

本软件按“原样”提供,无任何形式的保证,明示或 默示的,包括但不限于适销性、适用性的保证 为了特殊目的和不侵权。在任何情况下,作者或 版权持有人应对任何索赔、损害或其他责任负责,无论 在合同诉讼、侵权诉讼或其他诉讼中,由 与软件的连接或软件的使用或其他交易。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
具有x86javapath的x64机器上x86java上的java JNI未满足链接错误   java将Pixmap的一部分上传到GPU   图像Java位图RLE8格式   java Android studio谷歌广告崩溃应用程序   java如何创建包含未知数量对象的变量?   Java计算给定int数组的所有可能组合   java JDBC classnotfound异常   httpclient中的java将HttpEntity转换为字符串的最优雅/正确的方法是什么?   如何从Java程序运行nano?   java在安卓中调用自定义类/方法   调用方法和JOptionPane后,允许代码继续执行所需的java计时器或其他想法   关于侦听器的向量Java并发问题   线程池执行器Java线程池   java配置DTO上的Swagger javax验证约束   Java中用于按钮功能的swing操作命令   ServletOutputStream中的java设置状态代码   java打印输入数组的平均值