BasicRRT - InitPlan Crash

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

BasicRRT - InitPlan Crash

praveenv4k
Dear Rosen,

I found application crash when I called InitPlan() using BasicRRT planner. I suspect the following code generates the problem.

 bool InitPlan(RobotBasePtr pbase, PlannerParametersConstPtr pparams)
    {
        EnvironmentMutex::scoped_lock lock(GetEnv()->GetMutex());
        _parameters.reset();  // Here the member variable Ptr is reset
        boost::shared_ptr<BasicRRTParameters> parameters(new BasicRRTParameters());
        parameters->copy(pparams);
        if( !RrtPlanner<SimpleNode>::_InitPlan(pbase,parameters) ) {
            parameters.reset();
            return false;
        }
        //_bOneStep = parameters->vnParameters[0]>0;
   
        //read in all goals
        int goal_index = 0;
        vector<dReal> vgoal(parameters->GetDOF());
        _vecGoals.resize(0);

        while(parameters->vgoalconfig.size() > 0) {
            for(int i = 0 ; i < parameters->GetDOF(); i++) {
                if(goal_index < (int)parameters->vgoalconfig.size())
                    vgoal[i] = parameters->vgoalconfig[goal_index];
                else {
                    RAVELOG_ERRORA("BirrtPlanner::InitPlan - Error: goals are improperly specified:\n");
                    parameters.reset();
                    return false;
                }
                goal_index++;
            }
       
            if(!CollisionFunctions::CheckCollision(GetParameters(),_robot,vgoal)) {// GetParameters() return _parameters which is NULL now so the application crashes at this point

                bool bSuccess = true;    
                if( !!parameters->_constraintfn ) {
                    // filter
                    if( !parameters->_constraintfn(vgoal, vgoal, 0) ) {
                        // failed
                        RAVELOG_WARNA("goal state rejected by constraint fn\n");
                        bSuccess = false;
                    }
                }
           
                if( bSuccess ) {
                    // set up the goal states
                    _vecGoals.push_back(vgoal);
                }
            }
            else {
                RAVELOG_WARNA("goal in collision %s\n", _robot->CheckSelfCollision()?"(self)":NULL);
                if( GetEnv()->CheckCollision(KinBodyConstPtr(_robot), _report) || _robot->CheckSelfCollision(_report)) {
                    RAVELOG_WARN(str(boost::format("birrt: robot initially in collision %s!\n")%_report->__str__()));
                }
            }
       
            if(goal_index == (int)parameters->vgoalconfig.size())
                break;
        }
       
        if( _vecGoals.size() == 0 && !parameters->_goalfn ) {
            RAVELOG_WARNA("no goals or goal function specified\n");
            parameters.reset();
            return false;
        }
       
        RAVELOG_DEBUGA("RrtPlanner::InitPlan - RRT Planner Initialized\n");
        _parameters=parameters;  // The local variable is copied to member variable at this point only
        return true;
    }


Please tell me if it is a bug or my understanding is wrong.

Thanks
PraveenKumar Vasudevan
Reply | Threaded
Open this post in threaded view
|

Re: BasicRRT - InitPlan Crash

Rosen Diankov
Administrator
hi praveen,

it would help if you sent an example c++ code that uses the InitPlan
function and crashes

There is a working example here:

http://openrave.programmingvision.com/ordocs/en/html/orplanning_planner_8cpp-example.html

rosen,

2010/10/6 praveenv4k <[hidden email]>:

>
> Dear Rosen,
>
> I found application crash when I called InitPlan() using BasicRRT planner. I
> suspect the following code generates the problem.
>
>  bool InitPlan(RobotBasePtr pbase, PlannerParametersConstPtr pparams)
>    {
>        EnvironmentMutex::scoped_lock lock(GetEnv()->GetMutex());
>        _parameters.reset();  // Here the member variable Ptr is reset
>        boost::shared_ptr<BasicRRTParameters> parameters(new
> BasicRRTParameters());
>        parameters->copy(pparams);
>        if( !RrtPlanner<SimpleNode>::_InitPlan(pbase,parameters) ) {
>            parameters.reset();
>            return false;
>        }
>        //_bOneStep = parameters->vnParameters[0]>0;
>
>        //read in all goals
>        int goal_index = 0;
>        vector<dReal> vgoal(parameters->GetDOF());
>        _vecGoals.resize(0);
>
>        while(parameters->vgoalconfig.size() > 0) {
>            for(int i = 0 ; i < parameters->GetDOF(); i++) {
>                if(goal_index < (int)parameters->vgoalconfig.size())
>                    vgoal[i] = parameters->vgoalconfig[goal_index];
>                else {
>                    RAVELOG_ERRORA("BirrtPlanner::InitPlan - Error: goals
> are improperly specified:\n");
>                    parameters.reset();
>                    return false;
>                }
>                goal_index++;
>            }
>
>
> if(!CollisionFunctions::CheckCollision(GetParameters(),_robot,vgoal)) {//
> GetParameters() return _parameters which is NULL now so the application
> crashes at this point
>
>                bool bSuccess = true;
>                if( !!parameters->_constraintfn ) {
>                    // filter
>                    if( !parameters->_constraintfn(vgoal, vgoal, 0) ) {
>                        // failed
>                        RAVELOG_WARNA("goal state rejected by constraint
> fn\n");
>                        bSuccess = false;
>                    }
>                }
>
>                if( bSuccess ) {
>                    // set up the goal states
>                    _vecGoals.push_back(vgoal);
>                }
>            }
>            else {
>                RAVELOG_WARNA("goal in collision %s\n",
> _robot->CheckSelfCollision()?"(self)":NULL);
>                if( GetEnv()->CheckCollision(KinBodyConstPtr(_robot),
> _report) || _robot->CheckSelfCollision(_report)) {
>                    RAVELOG_WARN(str(boost::format("birrt: robot initially
> in collision %s!\n")%_report->__str__()));
>                }
>            }
>
>            if(goal_index == (int)parameters->vgoalconfig.size())
>                break;
>        }
>
>        if( _vecGoals.size() == 0 && !parameters->_goalfn ) {
>            RAVELOG_WARNA("no goals or goal function specified\n");
>            parameters.reset();
>            return false;
>        }
>
>        RAVELOG_DEBUGA("RrtPlanner::InitPlan - RRT Planner Initialized\n");
>        _parameters=parameters;  // The local variable is copied to member
> variable at this point only
>        return true;
>    }
>
> Please tell me if it is a bug or my understanding is wrong.
>
> Thanks
> PraveenKumar Vasudevan
> --
> View this message in context: http://openrave-users-list.185357.n3.nabble.com/BasicRRT-InitPlan-Crash-tp1640315p1640315.html
> Sent from the OpenRAVE Users List mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> Openrave-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openrave-users
>

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Reply | Threaded
Open this post in threaded view
|

Re: BasicRRT - InitPlan Crash

praveenv4k
Dear Rosen,

In the sample also the BiRRT planner is used. I actually specified the case of Application crash when BasicRRT planner.

Thanks
PraveenKumar
Reply | Threaded
Open this post in threaded view
|

Re: BasicRRT - InitPlan Crash

Rosen Diankov
Administrator
hi praveen,

You are right, this was a bug. It is fixed in r1758

thanks!
rosen,

2010/10/6 praveenv4k <[hidden email]>:

>
> Dear Rosen,
>
> In the sample also the BiRRT planner is used. I actually specified the case
> of Application crash when BasicRRT planner.
>
> Thanks
> PraveenKumar
> --
> View this message in context: http://openrave-users-list.185357.n3.nabble.com/BasicRRT-InitPlan-Crash-tp1640315p1640713.html
> Sent from the OpenRAVE Users List mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> Openrave-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openrave-users
>

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users
Reply | Threaded
Open this post in threaded view
|

Re: BasicRRT - InitPlan Crash

praveenv4k
Dear Rosen,

Its my pleasure. Could you please suggest me some way to plot the obtained trajectory in the viewer.

Expecting your reply
Praveen
Reply | Threaded
Open this post in threaded view
|

Re: BasicRRT - InitPlan Crash

Rosen Diankov
Administrator
hi praveen,

r1759 adds code to the orplanning_planner example to plot the end
effector trajectory. hope this helps

rosen,

2010/10/6 praveenv4k <[hidden email]>:

>
> Dear Rosen,
>
> Its my pleasure. Could you please suggest me some way to plot the obtained
> trajectory in the viewer.
>
> Expecting your reply
> Praveen
> --
> View this message in context: http://openrave-users-list.185357.n3.nabble.com/BasicRRT-InitPlan-Crash-tp1640315p1641448.html
> Sent from the OpenRAVE Users List mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
> Spend less time writing and  rewriting code and more time creating great
> experiences on the web. Be a part of the beta today.
> http://p.sf.net/sfu/beautyoftheweb
> _______________________________________________
> Openrave-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openrave-users
>

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Openrave-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openrave-users