How to get goal position out of ompl::base *goalptr?

212 views Asked by At

I am using ompl for path planning in 3D. Please guide how to get goal position (x, y, z) out of goal pointer received from this line.

const ob::Goal *Goalptr = pdef->getGoal().get();

where pdef is problem definition. and ob is ompl::base Path planner is planning paths but I can't get this goal out of it.

How should I do something like this:

x= Goalptr[0];
y= Goalptr[1];
z= Goalptr[2];

Or should i cast this Goalptr in some other type first and then do that. Pls help.

1

There are 1 answers

0
UsamaMaq On

So this post helped me to solve the problem. I used this code to get goal position.

std::vector<double> reals;
space->copyToReals(reals, pdef->getGoal()->as<ob::GoalState>()->getState());

Then we get goal position (x,y,z) in (reals[0], reals1, reals[2]).

Thanks Christopher Oezbek and others who tried.