39from math
import sin, cos
40from functools
import partial
41from ompl
import base
as ob
42from ompl
import control
as oc
48 def __init__(self, length, bounds):
49 super().__init__(length, 2, bounds)
51 def project(self, s, coord):
55 def sampleFullState(self, sampler, coord, s):
56 sampler.sampleUniform(s)
57 s.setXY(coord[0], coord[1])
63def isStateValid(space, state):
66 return space.satisfiesBounds(state)
69def propagate(start, control, duration, state):
70 state.setX(start.getX() + control[0] * duration * cos(start.getYaw()))
71 state.setY(start.getY() + control[0] * duration * sin(start.getYaw()))
72 state.setYaw(start.getYaw() + control[1] * duration)
83 space.setBounds(bounds)
92 cspace.setBounds(cbounds)
96 ss.setStateValidityChecker(partial(isStateValid, space))
97 ss.setStatePropagator(propagate)
100 start = ss.getStateSpace().allocState()
106 goal = ss.getStateSpace().allocState()
112 ss.setStartAndGoalStates(start, goal, 0.05)
115 si = ss.getSpaceInformation()
120 decomp = MyDecomposition(32, bounds)
123 ss.setPlanner(planner)
125 si.setPropagationStepSize(0.1)
128 solved = ss.solve(1.0)
129 if solved == ob.PlannerStatus.EXACT_SOLUTION:
131 print(
"Found solution:\n")
132 ss.getSolutionPath().printAsMatrix()
135if __name__ ==
"__main__":
The lower and upper bounds for an Rn space.
A state space representing SE(2).
A GridDecomposition is a Decomposition implemented using a grid.
A control space representing Rn.
Create the set of classes typically needed to solve a control problem.
SyclopEST is Syclop with EST as its low-level tree planner. .