parameters: (Model,parser=None,env=None,args=None,robotatts=dict(),defaultviewer=False,allowkinbody=False)
docstring: run the database generator from the command line using
docstring_summary: run the database generator from the command line using
docstring_tokens: run the database generator from the command line using
function: def InitializeFromParser(Model,parser=None,env=None,args=None,robotatts=dict(),defaultviewer=False,allowkinbody=False):
          """run the database generator from the command line using
          """
          from numpy import eye
          import sys
          if parser is None:
              parser = DatabaseGenerator.CreateOptionParser()
          (options, args) = parser.parse_args(args=args)
          loadplugins=True
          level=openravepy_int.DebugLevel.Info
          if options.getfilename:
              loadplugins = False
              level = openravepy_int.DebugLevel.Fatal
          if options.gethas:
              level = openravepy_int.DebugLevel.Fatal
          openravepy_int.RaveInitialize(loadplugins,level)
          OpenRAVEGlobalArguments.parseGlobal(options)
          destroyenv = False
          if env is None:
              env = openravepy_int.Environment()
              destroyenv = True
          try:
              options.viewername=OpenRAVEGlobalArguments.parseEnvironment(options,env,defaultviewer=defaultviewer,returnviewer=True)
              with env:
                  env.Load(options.robot,robotatts)
                  # TODO: if exception is raised after this point, program exits with glibc double-link list corruption. most likely something in Load?
                  if len(env.GetRobots()) > 0:
                      # get the first robot with DOF > 0
                      robot = None
                      for robot in env.GetRobots():
                          if robot.GetDOF() > 0:
                              break
                      if robot is None or robot.GetDOF() == 0:
                          raise OpenRAVEException('there is no robot with DOF > 0', 'Assert')
                  
                  elif allowkinbody:
                      robot = env.GetBodies()[0]
                  assert(robot is not None)
                  if hasattr(options,'manipname') and robot.IsRobot():
                      if options.manipname is None:
                          # prioritize manipulators with ik solvers
                          for i,m in enumerate(robot.GetManipulators()):
                              if m.GetIkSolver() is not None:
                                  robot.SetActiveManipulator(m)
                                  break
                      else:
                          for i,m in enumerate(robot.GetManipulators()):
                              if m.GetName()==options.manipname:
                                  robot.SetActiveManipulator(m)
                                  break
              model = Model(robot=robot)
              destroyenv = False
              return options,model
          
          finally:
              if destroyenv:
                  robot = None
                  model = None
                  env.Destroy()
function_tokens: def InitializeFromParser ( Model , parser = None , env = None , args = None , robotatts = dict ( ) , defaultviewer = False , allowkinbody = False ) : from numpy import eye import sys if parser is None : parser = DatabaseGenerator . CreateOptionParser ( ) ( options , args ) = parser . parse_args ( args = args ) loadplugins = True level = openravepy_int . DebugLevel . Info if options . getfilename : loadplugins = False level = openravepy_int . DebugLevel . Fatal if options . gethas : level = openravepy_int . DebugLevel . Fatal openravepy_int . RaveInitialize ( loadplugins , level ) OpenRAVEGlobalArguments . parseGlobal ( options ) destroyenv = False if env is None : env = openravepy_int . Environment ( ) destroyenv = True try : options . viewername = OpenRAVEGlobalArguments . parseEnvironment ( options , env , defaultviewer = defaultviewer , returnviewer = True ) with env : env . Load ( options . robot , robotatts ) # TODO: if exception is raised after this point, program exits with glibc double-link list corruption. most likely something in Load? if len ( env . GetRobots ( ) ) > 0 : # get the first robot with DOF > 0 robot = None for robot in env . GetRobots ( ) : if robot . GetDOF ( ) > 0 : break if robot is None or robot . GetDOF ( ) == 0 : raise OpenRAVEException ( 'there is no robot with DOF > 0' , 'Assert' ) elif allowkinbody : robot = env . GetBodies ( ) [ 0 ] assert ( robot is not None ) if hasattr ( options , 'manipname' ) and robot . IsRobot ( ) : if options . manipname is None : # prioritize manipulators with ik solvers for i , m in enumerate ( robot . GetManipulators ( ) ) : if m . GetIkSolver ( ) is not None : robot . SetActiveManipulator ( m ) break else : for i , m in enumerate ( robot . GetManipulators ( ) ) : if m . GetName ( ) == options . manipname : robot . SetActiveManipulator ( m ) break model = Model ( robot = robot ) destroyenv = False return options , model finally : if destroyenv : robot = None model = None env . Destroy ( )