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

pyservos的Python项目详细描述


animated gif

Pyservos

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

这项工作仍在进行中,仅支持ax-12a和xl-320。这个 库的划分如下:

  • pyservos
    • 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
    • AX12 - register/command/error definitions for Dynamixel’s AX-12A servo

设置

安装

建议的安装方法是通过pip命令,如下所示:

pip install pyservos

开发

要提交git拉取,请克隆存储库并按如下方式设置:

git clone https://github.com/walchko/pyservos
cd pyservos
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

文件

使用USB串行转换器打开伺服和LED的简单示例:

# Run an AX-12 servofrompyservosimportServoSerial,Packet,AX12serial=ServoSerial('/dev/tty.usbserial')# tell it what port you want to use# serial = ServoSerial('dummy')  # use a dummy serial interface for testingserial.open()ax=Packet(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)

虽然我做了一些包的创造者(像LED和伺服),你可以 你自己用的是基本的makeWritePacketmakeReadPacket

# Run an XL-320 servofrompyservosimportPacket,XL320frompyservos.utilsimportangle2intxl=Packet(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)

机器人示例

下面是一些示例robots

更改日志

2018-02-171.0.0added AX-12 support and renamed the library
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第三方库


热门话题
NetBeans中的Java Swing滚动窗格   java如何与具有复合键的表建立关系?   Android中读取文件时java数据丢失   java黄瓜场景。embed在ubuntu机器上不工作?   java从spring mvc控制器操作中,我如何获得请求/响应的访问权限?   java减去两个长值   java选择下一个值firebase 安卓   用于起始和结尾连字符的java正则表达式   Java正则表达式解释   java Lifefay freemarker ADT:方法不可用?   java我怎样才能让我的开关盒作用于JFrame?   java在我的场景中使用连接池的理想方式是什么   java我如何接受jsoup的cookies?   java如何将整数数组更改为字符串数组?   java Android操作\u指针\u向上直到剩余触摸移动时才调用   java为什么gradle会出错?   io如何在java中复制/拆分输入流?   java使JButton不可见,但尊重其原始空间   java Spring提交表单获取复选框值不起作用