State space for Reeds-Shepp vehicles
stateSpaceReedsShepp object stores parameters and states in the
Reeds-Shepp state space, which is composed of state vectors represented by
[x, y, θ]. x and
y are Cartesian coordinates, and θ is the orientation
angle. The Reeds-Shepp state space has a lower limit on the turning radius (specified by the
MinTurningRadius property in the object) and forward and reverse costs
(specified by the
properties in the object) for navigating between states.
Reeds-Shepp state space object with default state bounds for x,
y, and θ.
space = stateSpaceReedsShepp
sapce = stateSpaceReedsShepp(
bounds for x, y,
and θ. The state values beyond the bounds are truncated to the bounds.
bounds, sets the value of the StateBounds
Name— Name of state space
'SE2 Dubins'(default) | string
Name of state space, specified as a string.
NumStateVariables— Dimension of the state space
This property is read-only.
Dimension of the state space, specified as a positive integer.
StateBounds— Bounds of state variables
[-100 100; -100 100; -3.1416 3.1416](default) | 3-by-2 real-valued matrix
Bounds of state variables, specified as a 3-by-2 real-valued matrix.
The first row specifies the lower and upper bounds for the x state in meters.
The second row specifies the lower and upper bounds for the y state in meters.
The third row specifies the lower and upper bounds for the θ state in radians.
MinTurningRadius— Minimum turning radius
Minimum turning radius in meters, specified as a positive scalar. The minimum turning radius is for the smallest circle the vehicle can make with maximum steer in a single direction.
ForwardCost— Cost multiplier for forward motion
Cost multiplier for forward motion, specified as a positive scalar. Increase the cost to penalize forward motion.
ReverseCost— Cost multiplier for reverse motion
Cost multiplier for reverse motion, specified as a positive scalar. Increase the cost to penalize reverse motion.
Create a ReedsShepp state space.
ss = stateSpaceReedsShepp;
occupanyMap-based state validator using the created state space.
sv = validatorOccupancyMap(ss);
Create an occupany map from an example map and set map resolution as 10 cells/meter.
load exampleMaps map = occupancyMap(simpleMap,10); sv.Map = map;
Set validation distance for the validator.
sv.ValidationDistance = 0.01;
Update state space bounds to be the same as map limits.
ss.StateBounds = [map.XWorldLimits;map.YWorldLimits; [-pi pi]];
Create the path planner and increase max connection distance.
planner = plannerRRT(ss,sv); planner.MaxConnectionDistance = 0.3;
Set the start and goal states.
start = [0.5,0.5,0]; goal = [2.5,0.2,0];
Plan a path with default settings.
rng(100,'twister'); % repeatable result [pthObj,solnInfo] = planner.plan(start,goal);
Visualize the results.
show(map); hold on; plot(solnInfo.TreeData(:,1),solnInfo.TreeData(:,2),'.-'); % tree expansion plot(pthObj.States(:,1), pthObj.States(:,2),'r-','LineWidth',2) % draw path