本文整理汇总了Python中driver.Driver.execute方法的典型用法代码示例。如果您正苦于以下问题:Python Driver.execute方法的具体用法?Python Driver.execute怎么用?Python Driver.execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类driver.Driver
的用法示例。
在下文中一共展示了Driver.execute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: editor
# 需要导入模块: from driver import Driver [as 别名]
# 或者: from driver.Driver import execute [as 别名]
#.........这里部分代码省略.........
return self.ports
def doPort(self, e=None):
""" open a serial port """
if self.port == None:
self.findPorts()
self.ports += ['Gazebo']
dlg = wx.SingleChoiceDialog(self,'Port (Ex. COM4 or /dev/ttyUSB0)','Select Communications Port',self.ports)
#dlg = PortDialog(self,'Select Communications Port',self.ports)
if dlg.ShowModal() == wx.ID_OK:
if self.port != None:
self.port.ser.close()
print "Opening port: " + self.ports[dlg.GetSelection()]
try:
port_name = self.ports[dlg.GetSelection()]
if port_name == 'Gazebo':
self.port = GazeboDriver()
else:
# TODO: add ability to select type of driver
self.port = Driver(self.ports[dlg.GetSelection()], 38400, True) # w/ interpolation
self.panel.port = self.port
self.panel.portUpdated()
self.sb.SetStatusText(self.ports[dlg.GetSelection()] + "@38400",1)
except RuntimeError as e:
print 'Error opening port:', e
self.port = None
self.sb.SetBackgroundColour('RED')
self.sb.SetStatusText("Could Not Open Port",0)
self.sb.SetStatusText('not connected',1)
self.timer.Start(20)
dlg.Destroy()
def doTest(self, e=None):
if self.port != None:
self.port.execute(253, 25, list())
def doRelax(self, e=None):
""" Relax servos so you can pose them. """
if self.port != None:
print "PyPose: relaxing servos..."
for servo in range(self.project.count):
self.port.setReg(servo+1,P_TORQUE_ENABLE, [0,])
else:
self.sb.SetBackgroundColour('RED')
self.sb.SetStatusText("No Port Open",0)
self.timer.Start(20)
def doAbout(self, e=None):
license= """This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA)
"""
info = wx.AboutDialogInfo()
info.SetName(VERSION)
info.SetDescription("A lightweight pose and capture software for the ArbotiX robocontroller")
info.SetCopyright("Copyright (c) 2008-2010 Michael E. Ferguson. All right reserved.")
info.SetLicense(license)