本文整理汇总了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()
示例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())
示例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)
示例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)
示例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)