16 from os.path
import abspath, dirname, join
18 ompl_app_root = dirname(dirname(dirname(abspath(__file__))))
21 from ompl
import base
as ob
22 from ompl
import control
as oc
23 from ompl
import app
as oa
25 sys.path.insert(0, join(ompl_app_root,
'ompl/py-bindings'))
26 from ompl
import base
as ob
27 from ompl
import control
as oc
28 from ompl
import app
as oa
31 setup = oa.DynamicCarPlanning()
33 setup.setRobotMesh(
'2D/car1_planar_robot.dae')
34 setup.setEnvironmentMesh(
'2D/BugTrap_planar_env.dae')
37 stateSpace = setup.getStateSpace()
43 stateSpace.getSubspace(0).setBounds(bounds)
49 start[2] = start[3] = start[4] = 0.
54 goal[1] = goal[2] = goal[3] = goal[4] = 0.
57 setup.setStartAndGoalStates(start, goal, 3.)
60 planner =
oc.RRT(setup.getSpaceInformation())
64 print(
"\n\n***** Planning for a %s *****\n" % setup.getName())
69 path = setup.getSolutionPath()
71 print(path.printAsMatrix())
72 if not setup.haveExactSolutionPath():
73 print(
"Solution is approximate. Distance to actual goal is %g" %
74 setup.getProblemDefinition().getSolutionDifference())
76 if __name__ ==
'__main__':