57 Argv0 = os.path.basename(__file__)
80 print "Try '%s --help' for more information." % (Argv0)
87 def printUsageErr(emsg):
89 print "%s: Error: %s" % (Argv0, emsg)
91 print "%s: Error" % (Argv0)
101 Stop all Laelaps motors. 103 Options and arguments: 104 -h, --help : Display this help and exit. 107 Returns exits status of 0 on success. An exit status of 128 indicates usage 118 def getOptions(kwargs):
122 kwargs[
'debug'] =
False 126 opts, args = getopt.getopt(argv[1:],
"?h", [
'help',
''])
127 except getopt.error, msg:
129 for opt, optarg
in opts:
130 if opt
in (
'-h',
'--help',
'-?'):
140 CliArgs = getOptions(CliArgs)
150 wd = WatchDog.WatchDog()
152 if wd.open(SysConf.SensorDevName):
154 ret = wd.cmdReadEnables()
155 if ret[
'rc'] ==
'ok':
156 if not ret[
'enables'][
'motor_ctlr_en']:
157 print "Motor controllers already disabled, nothing to stop." 160 print 'Error: Failed to open connection to watchdog subprocessor.' 161 print ' Continuing...' 165 motorctlr = RoboClaw.RoboClaw()
171 motorctlr.open(SysConf.MotorCtlrDevName, SysConf.MotorCtlrBaudRate)
172 motorctlr.setMixedSpeed(SysConf.MotorCtlrAddrFront, 0, 0)
173 motorctlr.setMixedSpeed(SysConf.MotorCtlrAddrRear, 0, 0)
175 except RoboClaw.RoboClawException
as inst:
176 print 'Error:', inst.message
Unit test command-line exception class.
msg
error message attribute
def __init__(self, msg)
Constructor.