Refer to this link. There you 'll find some guidelines regarding setting state space/bounds, using existing planners in ompl, setting start/goal states and find solution.
These are the following steps basically(for example SE2):-
//1. construct the instance of state space we are planning in->for mobile base SE2
ompl::base::StateSpacePtr space(new ompl::base::SE2StateSpace());
//2. get bounds from worldmap and set it to bounds for the planner
ompl::base::RealVectorBounds bounds(2);
space->as<ompl::base::SE2StateSpace>()->setBounds(bounds);
//3. Create an instance of ompl::geometric::SimpleSetup
ompl::geometric::SimpleSetup simple_setup(space);
//4. Set state validity checker
simple_setup.setStateValidityChecker(boost::bind(&Function_Name, this, _1));
//7. set start and goal state to planner
simple_setup.setStartAndGoalStates(ompl_scoped_state_start, ompl_scoped_state_goal);
//8 Set Planner type
ompl::base::SpaceInformationPtr si_ptr = simple_setup.getSpaceInformation();
ompl::base::PlannerPtr target_planner_ptr(new ompl::geometric::EST(si_ptr));
simple_setup.setPlanner(target_planner_ptr);
//9. Solve
simple_setup.solve(1.0);
Hope this helps.
Originally posted by VN with karma: 373 on 2012-03-05
This answer was ACCEPTED on the original site
Post score: 5
Original comments
Comment by Carlos on 2012-03-21:
Thanks a lot! but I really ment I'm new at ROS, I have just followed the ROS Tutorials and created an URDF for my robot, so I don't quite get how does it all fit with the code you propose. Sorry for the ignorance and thanks again for the help :)