Problem with RobotBase Exceptions

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with RobotBase Exceptions

Billy Okal-3
Dear Openrave users,

So I just defined a problem instance for my prm planners so that I can easily use python for scripting.
I have defined a bunch of commands for the interface like BuildRoadMap, RunQuery... I keep getting the following error when I send this commands;

makokal@nyumbani-labs:~/host/Projects/prob-planning/trunk/examples$ python prm_planning.py
OpenGL Warning: Failed to connect to host. Make sure 3D acceleration is enabled for this VM.
[openravepy_int.cpp:2799] viewer qtcoin successfully attached
[bprmproblem.h:63] PRM Manipulation Planning: using visibilityprm planner
[environment.h:184] Environment destructor
[environment.h:192] resetting raveviewer
[environment.h:219] destroy problems
Traceback (most recent call last):
  File "prm_planning.py", line 80, in <module>
    run()
  File "prm_planning.py", line 68, in run
    self.plan_and_move(T1)
  File "prm_planning.py", line 34, in plan_and_move
    success = self.prob.SendCommand('RunQuery '+self.Serialize(T))
RuntimeError: OpenRAVE: [/usr/include/boost/smart_ptr/shared_ptr.hpp:418] -> T* boost::shared_ptr< <template-parameter-1-1> >::operator->() const [with T = OpenRAVE::RobotBase], expr: px != 0
terminate called after throwing an instance of 'OpenRAVE::openrave_exception'
  what():  OpenRAVE: [/usr/include/boost/thread/pthread/recursive_mutex.hpp:67] -> void boost::recursive_mutex::lock(), expr: !pthread_mutex_lock(&m)
Aborted
makokal@nyumbani-labs:~/host/Projects/prob-planning/trunk/examples$


I have defined the buildRoadMap command as follows, it seems to me that the RobotBasePtr robot is what is causing this, but I can't figure out why;

 bool buildRoadMap(ostream& sout, istream& sinput) {
    bExecute = true;
    PlannerBase::PlannerParametersPtr pparams(new PlannerBase::PlannerParameters());
    params = pparams;
    params->_nMaxIterations = 4000; // max iterations before failure
                       
    string cmd;
    while(!sinput.eof()) {
      sinput >> cmd;
      if( !sinput )
        break;
      std::transform(cmd.begin(), cmd.end(), cmd.begin(), ::tolower);
                               
      if( cmd == "goal" ) {
        params->vgoalconfig.resize(robot->GetActiveDOF());
        FOREACH(it, params->vgoalconfig)
          sinput >> *it;
      }
      else if( cmd == "outputtraj" )
        pOutputTrajStream = boost::shared_ptr<ostream>(&sout,null_deleter());
      else if( cmd == "maxiter" )
        sinput >> params->_nMaxIterations;
      else if( cmd == "execute" )
        sinput >> bExecute;
      else if( cmd == "writetraj" )
        sinput >> strtrajfilename;
      else {
        RAVELOG_WARNA(str(boost::format("unrecognized command: %s\n")%cmd));
        break;
      }
                               
      if( !sinput ) {
        RAVELOG_ERRORA(str(boost::format("failed processing command %s\n")%cmd));
        return false;
      }
    }
                       
    RAVELOG_DEBUGA("Checked commands, validating goal config\n");

    if( (int)params->vgoalconfig.size() != robot->GetActiveDOF() )
      return false;
                       
    RobotBase::RobotStateSaver saver(robot);
       
    // restore
    params->SetRobotActiveJoints(robot);
    robot->GetActiveDOFValues(params->vinitialconfig);
    robot->SetActiveDOFValues(params->vgoalconfig);
                       
    //set to initial config again before initializing the constraint fn
    robot->SetActiveDOFValues(params->vinitialconfig);
                       
    // now initialize and build the roadmap
    planner = GetEnv()->CreatePlanner(_plannerName);
                       
    if( !planner ) {
      RAVELOG_ERRORA("failed to create VisibilityPRM Planner\n");
      return false;
    }    
                       
    RAVELOG_DEBUGA("starting planning\n");
                       
    if( !planner->InitPlan(robot, params) ) {
      RAVELOG_INFOA("InitPlan failed\n");
      return false;
    }
                       
    return true;
  }


Regards,

billy
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Reply | Threaded
Open this post in threaded view
|

Re: Problem with RobotBase Exceptions

Rosen Diankov
Administrator
hi billy,

your robot pointer is not initialized. i would run your stuff in gdb
with inputting 'catch throw' in the gdb command line. this will stop
execution when the exception is first thrown.

rosen,

2010/7/23 Billy Okal <[hidden email]>:

> Dear Openrave users,
>
> So I just defined a problem instance for my prm planners so that I can easily use python for scripting.
> I have defined a bunch of commands for the interface like BuildRoadMap, RunQuery... I keep getting the following error when I send this commands;
>
> makokal@nyumbani-labs:~/host/Projects/prob-planning/trunk/examples$ python prm_planning.py
> OpenGL Warning: Failed to connect to host. Make sure 3D acceleration is enabled for this VM.
> [openravepy_int.cpp:2799] viewer qtcoin successfully attached
> [bprmproblem.h:63] PRM Manipulation Planning: using visibilityprm planner
> [environment.h:184] Environment destructor
> [environment.h:192] resetting raveviewer
> [environment.h:219] destroy problems
> Traceback (most recent call last):
>  File "prm_planning.py", line 80, in <module>
>    run()
>  File "prm_planning.py", line 68, in run
>    self.plan_and_move(T1)
>  File "prm_planning.py", line 34, in plan_and_move
>    success = self.prob.SendCommand('RunQuery '+self.Serialize(T))
> RuntimeError: OpenRAVE: [/usr/include/boost/smart_ptr/shared_ptr.hpp:418] -> T* boost::shared_ptr< <template-parameter-1-1> >::operator->() const [with T = OpenRAVE::RobotBase], expr: px != 0
> terminate called after throwing an instance of 'OpenRAVE::openrave_exception'
>  what():  OpenRAVE: [/usr/include/boost/thread/pthread/recursive_mutex.hpp:67] -> void boost::recursive_mutex::lock(), expr: !pthread_mutex_lock(&m)
> Aborted
> makokal@nyumbani-labs:~/host/Projects/prob-planning/trunk/examples$
>
>
> I have defined the buildRoadMap command as follows, it seems to me that the RobotBasePtr robot is what is causing this, but I can't figure out why;
>
>  bool buildRoadMap(ostream& sout, istream& sinput) {
>    bExecute = true;
>    PlannerBase::PlannerParametersPtr pparams(new PlannerBase::PlannerParameters());
>    params = pparams;
>    params->_nMaxIterations = 4000; // max iterations before failure
>
>    string cmd;
>    while(!sinput.eof()) {
>      sinput >> cmd;
>      if( !sinput )
>        break;
>      std::transform(cmd.begin(), cmd.end(), cmd.begin(), ::tolower);
>
>      if( cmd == "goal" ) {
>        params->vgoalconfig.resize(robot->GetActiveDOF());
>        FOREACH(it, params->vgoalconfig)
>          sinput >> *it;
>      }
>      else if( cmd == "outputtraj" )
>        pOutputTrajStream = boost::shared_ptr<ostream>(&sout,null_deleter());
>      else if( cmd == "maxiter" )
>        sinput >> params->_nMaxIterations;
>      else if( cmd == "execute" )
>        sinput >> bExecute;
>      else if( cmd == "writetraj" )
>        sinput >> strtrajfilename;
>      else {
>        RAVELOG_WARNA(str(boost::format("unrecognized command: %s\n")%cmd));
>        break;
>      }
>
>      if( !sinput ) {
>        RAVELOG_ERRORA(str(boost::format("failed processing command %s\n")%cmd));
>        return false;
>      }
>    }
>
>    RAVELOG_DEBUGA("Checked commands, validating goal config\n");
>
>    if( (int)params->vgoalconfig.size() != robot->GetActiveDOF() )
>      return false;
>
>    RobotBase::RobotStateSaver saver(robot);
>
>    // restore
>    params->SetRobotActiveJoints(robot);
>    robot->GetActiveDOFValues(params->vinitialconfig);
>    robot->SetActiveDOFValues(params->vgoalconfig);
>
>    //set to initial config again before initializing the constraint fn
>    robot->SetActiveDOFValues(params->vinitialconfig);
>
>    // now initialize and build the roadmap
>    planner = GetEnv()->CreatePlanner(_plannerName);
>
>    if( !planner ) {
>      RAVELOG_ERRORA("failed to create VisibilityPRM Planner\n");
>      return false;
>    }
>
>    RAVELOG_DEBUGA("starting planning\n");
>
>    if( !planner->InitPlan(robot, params) ) {
>      RAVELOG_INFOA("InitPlan failed\n");
>      return false;
>    }
>
>    return true;
>  }
>
>
> Regards,
>
> billy
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Openrave-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openrave-users
>

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users