Main Content

stateSpaceReedsShepp

State space for Reeds-Shepp vehicles

Description

ThestateSpaceReedsSheppobject stores parameters and states in the Reeds-Shepp state space, which is composed of state vectors represented by [x,y,θ].xandyare Cartesian coordinates, andθis the orientation angle. The Reeds-Shepp state space has a lower limit on the turning radius (specified by theMinTurningRadiusproperty in the object) and forward and reverse costs (specified by theForwardCostandReverseCostproperties in the object) for navigating between states.

Creation

Description

example

space= stateSpaceReedsSheppcreates a Reeds-Shepp state space object with default state bounds forx,y, andθ.

sapce= stateSpaceReedsShepp(bounds)specifies theboundsforx,y, andθ. The state values beyond the bounds are truncated to the bounds. The input,bounds, sets the value of theStateBoundsproperty.

Properties

expand all

Name of state space, specified as a string.

This property is read-only.

Dimension of the state space, specified as a positive integer.

Bounds of state variables, specified as a 3-by-2 real-valued matrix.

  • The first row specifies the lower and upper bounds for thexstate in meters.

  • The second row specifies the lower and upper bounds for theystate in meters.

  • 第三行指定上下界限for theθstate in radians.

Data Types:double

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.

Cost multiplier for forward motion, specified as a positive scalar. Increase the cost to penalize forward motion.

Cost multiplier for reverse motion, specified as a positive scalar. Increase the cost to penalize reverse motion.

Object Functions

copy Create deep copy of state space object
distance Distance between two states
enforceStateBounds Reduce state to state bounds
interpolate Interpolate between states
sampleGaussian Sample state using Gaussian distribution
sampleUniform Sample state using uniform distribution

Examples

collapse all

Create a ReedsShepp state space.

ss = stateSpaceReedsShepp;

Create anoccupanyMap-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.

loadexampleMapsmap = 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); holdon; plot(solnInfo.TreeData(:,1),solnInfo.TreeData(:,2),'.-');% tree expansionplot(pthObj.States(:,1), pthObj.States(:,2),'r-','LineWidth',2)% draw path

Figure contains an axes object. The axes object with title Occupancy Grid contains 3 objects of type image, line.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced in R2019b