Laelaps  2.3.5
RoadNarrows Robotics Small Outdoor Mobile Robot Project
laelaps_tune_motors.application Class Reference

Laelaps control panel. More...

Public Member Functions

def __init__ (self)
 Constructor.
 
def printUsageErr (self, emsg)
 Print usage error. More...
 
def printUsage (self)
 Print Command-Line Usage Message. More...
 
def getOptions (self, argv=None, kwargs)
 Get command-line options. More...
 
def initRobot (self)
 Initialize interface to hek_robot.
 
def run (self, argv=None, kwargs)
 Run application. More...
 

Public Attributes

 m_win
 

Detailed Description

Laelaps control panel.

Definition at line 1655 of file laelaps_tune_motors.py.

Member Function Documentation

def laelaps_tune_motors.application.getOptions (   self,
  argv = None,
  kwargs 
)

Get command-line options.

Parameters
argvArgument list. If not None, then overrides command-line arguments.
[out]kwargsKeyword argument list.
Returns
Parsed keyword arguments.

Definition at line 1696 of file laelaps_tune_motors.py.

References laelaps_sane.application._Argv0, laelaps_speed.application._Argv0, laelaps_diag.application._Argv0, laelaps_init.application._Argv0, laelaps_tune_motors.application._Argv0, laelaps_sane.application.printUsage(), laelaps_speed.application.printUsage(), laelaps_diag.application.printUsage(), laelaps_init.application.printUsage(), and laelaps_tune_motors.application.printUsage().

Referenced by laelaps_tune_motors.application.run().

1696  def getOptions(self, argv=None, **kwargs):
1697  if argv is None:
1698  argv = sys.argv
1699 
1700  self._Argv0 = os.path.basename(kwargs.get('argv0', __file__))
1701 
1702  # defaults
1703  kwargs['debug'] = False
1704 
1705  # parse command-line options
1706  try:
1707  opts, args = getopt.getopt(argv[1:], "?h",
1708  ['help', ''])
1709  except getopt.error, msg:
1710  raise usage(msg)
1711  for opt, optarg in opts:
1712  if opt in ('-h', '--help', '-?'):
1713  self.printUsage()
1714  sys.exit(0)
1715 
1716  #if len(args) < 1:
1717  # self.printUsageErr("No input xml file specified")
1718  # sys.exit(2)
1719  #else:
1720  # kwargs['filename'] = args[0]
1721 
1722  return kwargs
1723 
Unit test command-line exception class.
def getOptions(self, argv=None, kwargs)
Get command-line options.
def printUsage(self)
Print Command-Line Usage Message.
def laelaps_tune_motors.application.printUsage (   self)

Print Command-Line Usage Message.

Definition at line 1677 of file laelaps_tune_motors.py.

References laelaps_sane.application._Argv0, laelaps_speed.application._Argv0, laelaps_diag.application._Argv0, laelaps_init.application._Argv0, and laelaps_tune_motors.application._Argv0.

Referenced by laelaps_tune_motors.application.getOptions().

1677  def printUsage(self):
1678  print \
1679 """
1680 usage: %s [OPTIONS]
1681  %s --help
1682 
1683 Options and arguments:
1684 -h, --help : Display this help and exit.
1685 """ % (self._Argv0, self._Argv0)
1686 
def printUsage(self)
Print Command-Line Usage Message.
def laelaps_tune_motors.application.printUsageErr (   self,
  emsg 
)

Print usage error.

Parameters
emsgError message string.

Definition at line 1669 of file laelaps_tune_motors.py.

References laelaps_sane.application._Argv0, laelaps_speed.application._Argv0, laelaps_diag.application._Argv0, laelaps_init.application._Argv0, and laelaps_tune_motors.application._Argv0.

1669  def printUsageErr(self, emsg):
1670  if emsg:
1671  print "%s: %s" % (self._Argv0, emsg)
1672  else:
1673  print "%s: error" % (self._Argv0)
1674  print "Try '%s --help' for more information." % (self._Argv0)
1675 
def printUsageErr(self, emsg)
Print usage error.
def laelaps_tune_motors.application.run (   self,
  argv = None,
  kwargs 
)

Run application.

Parameters
argvOptional argument list to override command-line arguments.
kwargsOptional keyword argument list.
Returns
Exit code.

Definition at line 1740 of file laelaps_tune_motors.py.

References laelaps_sane.application.getOptions(), laelaps_speed.application.getOptions(), laelaps_diag.application.getOptions(), laelaps_init.application.getOptions(), laelaps_tune_motors.application.getOptions(), laelaps_tune_motors.application.initRobot(), laelaps_sane.application.m_win, laelaps_speed.application.m_win, laelaps_diag.application.m_win, laelaps_init.application.m_win, and laelaps_tune_motors.application.m_win.

1740  def run(self, argv=None, **kwargs):
1741 
1742  # parse command-line options and arguments
1743  try:
1744  kwargs = self.getOptions(argv, **kwargs)
1745  except usage, e:
1746  print e.msg
1747  return 2
1748 
1749  # create root
1750  root = Tk()
1751 
1752  # create application window
1753  self.m_win = window(master=root)
1754 
1755  # destroy window on 'x'
1756  root.protocol('WM_DELETE_WINDOW', root.destroy)
1757 
1758  root.columnconfigure(0, weight=1)
1759  root.rowconfigure(0, weight=1)
1760 
1761  # initialize robot interface
1762  self.initRobot()
1763 
1764  # go for it
1765  self.m_win.mainloop()
1766 
1767  return 0
1768 
1769 
1770 # ------------------------------------------------------------------------------
1771 # main
1772 # ------------------------------------------------------------------------------
def getOptions(self, argv=None, kwargs)
Get command-line options.
def run(self, argv=None, kwargs)
Run application.
Window class supporting application.
def initRobot(self)
Initialize interface to hek_robot.

The documentation for this class was generated from the following file: