当前位置: 首页>>代码示例>>Python>>正文


Python barobo.Dongle类代码示例

本文整理汇总了Python中barobo.Dongle的典型用法代码示例。如果您正苦于以下问题:Python Dongle类的具体用法?Python Dongle怎么用?Python Dongle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Dongle类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: len

from barobo import Linkbot, Dongle
import time
import sys
if sys.version_info[0] == 3:
    raw_input = input

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print ("Usage: {0} <Com_Port> [Linkbot Serial ID]".format(sys.argv[0]))
        quit()
    if len(sys.argv) == 3:
        serialID = sys.argv[2]
    else:
        serialID = None
    dongle = Dongle()
    dongle.connectDongleTTY(sys.argv[1])
    linkbot = dongle.getLinkbot(serialID)
    print (linkbot)
    print (linkbot.getVersion())
    linkbot.recordAnglesBegin()
    s = raw_input('Press enter to continue...')
    linkbot.recordAnglesEnd()
    linkbot.recordAnglesPlot()
    for i in range(1,4):
        linkbot.setJointSpeed(i, 120)
    linkbot.moveToNB(360, 0, -360)
    linkbot.moveWait()
    linkbot.moveToNB(0, 0, 0)
    linkbot.moveWait()
开发者ID:davidko,项目名称:PyBarobo,代码行数:29,代码来源:test2.py

示例2: len

#!/usr/bin/env python

from barobo import Linkbot, Dongle
import time
import sys

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print ("Usage: {0} [Linkbot Serial ID]".format(sys.argv[0]))
        quit()
    serialID = sys.argv[2]
    dongle = Dongle()
    dongle.connect()
    linkbot = dongle.getLinkbot(serialID)

    print (linkbot.getSerialID())
开发者ID:davidko,项目名称:PyBarobo,代码行数:16,代码来源:getSerialID.py

示例3: len

#!/usr/bin/env python

from barobo import Linkbot, Dongle
import time
import sys

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print ("Usage: {0} <Com_Port> [Linkbot Serial ID]".format(sys.argv[0]))
        quit()
    if len(sys.argv) == 3:
        serialID = sys.argv[2]
    else:
        serialID = None
    dongle = Dongle()
    dongle.connectBaroboLink()
    linkbot = dongle.getLinkbot(serialID)

    linkbot.resetToZero()
    print ("Moving joints to 90 degrees...")
    linkbot.driveTo(90, 90, 90)
    time.sleep(1)
    print ("Moving joints to 0 degrees...")
    linkbot.driveTo(0, 0, 0)
开发者ID:davidko,项目名称:PyBarobo,代码行数:24,代码来源:driveTo.py

示例4: func

        global_phi = math.atan2(y-self.y, x-self.x)
        d_phi = global_phi - self.theta
        self.turn(rad2deg(d_phi))
        d = math.sqrt( (y-self.y)**2 + (x-self.x)**2)
        self.moveDistance(d)

def func(x):
    return 0.5*x**2

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print ("Usage: {0} <Com_Port> [Linkbot Serial ID]".format(sys.argv[0]))
        quit()
    if len(sys.argv) == 3:
        serialID = sys.argv[2]
    else:
        serialID = None
    dongle = Dongle()
    dongle.connectDongleTTY(sys.argv[1])
    linkbot = dongle.getLinkbot(serialID, linkbotClass=ParaLinkbot)
    linkbot.init()
 
    i = -5
    linkbot.goto(i, func(i))
    linkbot.moveWait()
    print('Start!')
    while i < 5:
        linkbot.goto(i, func(i))
        i += 0.1
        time.sleep(0.1)
开发者ID:davidko,项目名称:PyBarobo,代码行数:30,代码来源:LinkbotPolynomial.py

示例5: goto

        self.y += dy

    def goto(self, x, y):
        global_phi = math.atan2(y-self.y, x-self.x)
        d_phi = global_phi - self.theta
        self.turn(rad2deg(d_phi))
        d = math.sqrt( (y-self.y)**2 + (x-self.x)**2)
        self.moveDistance(d)

def func(x):
    return 0.5*x**2

if __name__ == "__main__":
    if len(sys.argv) < 2:
        print ("Usage: {0} [Linkbot Serial ID]".format(sys.argv[0]))
        quit()
    serialID = sys.argv[1]
    dongle = Dongle()
    dongle.connect()
    linkbot = dongle.getLinkbot(serialID, linkbotClass=ParaLinkbot)
    linkbot.init()
 
    i = -5
    linkbot.goto(i, func(i))
    linkbot.moveWait()
    print('Start!')
    while i < 5:
        linkbot.goto(i, func(i))
        i += 0.1
        time.sleep(0.1)
开发者ID:davidko,项目名称:PyBarobo,代码行数:30,代码来源:LinkbotPolynomial.py


注:本文中的barobo.Dongle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。