39from __future__
import print_function
43from ConstrainedPlanningCommon
import *
48 super().__init__(3, 1)
50 def function(self, x, out):
51 out[0] = np.linalg.norm(x) - 1
53 def jacobian(self, x, out):
54 nrm = np.linalg.norm(x)
55 if np.isfinite(nrm)
and nrm > 0:
62 def __init__(self, space):
63 super().__init__(space)
71 def project(self, state, projection):
72 projection[0] = math.atan2(state[1], state[0])
73 projection[1] = math.acos(state[2])
77 if x[2] > -0.8
and x[2] < -0.6:
78 if x[1] > -0.05
and x[1] < 0.05:
81 elif x[2] > -0.1
and x[2] < 0.1:
82 if x[0] > -0.05
and x[0] < 0.05:
85 elif x[2] > 0.6
and x[2] < 0.8:
86 if x[1] > -0.05
and x[1] < 0.05:
92def spherePlanningOnce(cp, plannername, output):
93 cp.setPlanner(plannername,
"sphere")
96 stat = cp.solveOnce(output,
"sphere")
99 ou.OMPL_INFORM(
"Dumping problem information to `sphere_info.txt`.")
100 with open(
"sphere_info.txt",
"w")
as infofile:
101 print(cp.spaceType, file=infofile)
105 cp.dumpGraph(
"sphere")
109def spherePlanningBench(cp, planners):
110 cp.setupBenchmark(planners,
"sphere")
114def spherePlanning(options):
120 rvss.setBounds(bounds)
131 cp.setStartAndGoalStates(start, goal)
132 cp.ss.setStateValidityChecker(obstacles)
134 planners = options.planner.split(
",")
135 if not options.bench:
136 spherePlanningOnce(cp, planners[0], options.output)
138 spherePlanningBench(cp, planners)
141if __name__ ==
"__main__":
142 parser = argparse.ArgumentParser()
147 help=
"Dump found solution path (if one exists) in plain text and planning "
148 "graph in GraphML to `sphere_path.txt` and `sphere_graph.graphml` "
152 "--bench", action=
"store_true", help=
"Do benchmarking on provided planner list."
154 addSpaceOption(parser)
155 addPlannerOption(parser)
156 addConstrainedOptions(parser)
157 addAtlasOptions(parser)
159 spherePlanning(parser.parse_args())
Definition of a differentiable holonomic constraint on a configuration space. See Constrained Plannin...
Abstract definition for a class computing projections to Rn. Implicit integer grids are imposed on th...
virtual void defaultCellSizes()
Set the default cell dimensions for this projection. The default implementation of this function is e...
virtual unsigned int getDimension() const =0
Return the dimension of the projection defined by this evaluator.
The lower and upper bounds for an Rn space.
A state space representing Rn. The distance function is the L2 norm.