0

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.

Christopher Oezbek
  • 23,994
  • 6
  • 61
  • 85
UsamaMaq
  • 47
  • 10
  • The opml page on goals (https://ompl.kavrakilab.org/goalRepresentation.html) seems to indicate that a goal is not necessarily a position, but an abstract definition of how if you satisfy a condition of having reached the goal. – Christopher Oezbek Jul 26 '19 at 17:39
  • ok so we cannot get goal position from problem definition? As this (https://ompl.kavrakilab.org/classompl_1_1base_1_1ProblemDefinition.html#a71e20eb387a023333f34b6761a01c64f) says, it returns the goal. – UsamaMaq Jul 26 '19 at 19:11
  • I never used ompl, so I don't know. From a quick search `State` might be more helpful: https://ompl.kavrakilab.org/workingWithStates.html#stateOps – Christopher Oezbek Jul 26 '19 at 19:36

1 Answers1

0

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.

UsamaMaq
  • 47
  • 10