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


Python Driver.setReg方法代码示例

本文整理汇总了Python中driver.Driver.setReg方法的典型用法代码示例。如果您正苦于以下问题:Python Driver.setReg方法的具体用法?Python Driver.setReg怎么用?Python Driver.setReg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在driver.Driver的用法示例。


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

示例1: editor

# 需要导入模块: from driver import Driver [as 别名]
# 或者: from driver.Driver import setReg [as 别名]

#.........这里部分代码省略.........
        #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)
        info.SetWebSite("http://www.vanadiumlabs.com")
        wx.AboutBox(info)

    def doClose(self, e=None):
        # TODO: edit this to check if we NEED to save...
        if self.project.save == True:
            dlg = wx.MessageDialog(None, 'Save changes before closing?', '',
开发者ID:jpieper,项目名称:nuke-jpieper,代码行数:70,代码来源:PyPose.py


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