mobileRobotPropagator
Description
The mobileRobotPropagator
object is a state propagator that propagates
and validates the state of a mobile robot based on control commands, durations, and target
states. The object supports different kinematic models, integrator types, and control
policies.
Creation
Description
creates
a mobile robot propagator for a bicycle kinematic model using a linear-pursuit control
policy.mobileProp
= mobileRobotPropagator
specifies properties using name-value arguments. For example,
mobileProp
= mobileRobotPropagator(Name,Value
)mobileRobotPropagator("ControlStepSize"=0.01)
creates a mobile
robot propagator with a control step size of 0.01.
Properties
StateSpace
— State space for sampling during planning
stateSpaceSE2
object (default) | object of subclass of nav.StateSpace
object
State space for sampling during planning, specified as an object of a subclass of
nav.StateSpace
object.
The state space is responsible for representing the configuration space of a system. The object should include all state information related to the propagated system. Systems employing multi-layer cascade controllers can append persistent low-level control information directly to the state vector, whereas the state propagator directly manages top-level control commands.
Environment
— Environment for validating states
[]
(default) | binaryOccupancyMap
object | occupancyMap
object | vehicleCostmap
object
Environment for validating states, specified as a binaryOccupancyMap
, occupancyMap
, or vehicleCostmap
(Automated Driving Toolbox) object.
The mobileRobotPropagator
object validates discrete states along
the propagated motion. By default, the environment is empty, so the object only rejects
states outside the state space bounds.
This property can only be set during construction.
DistanceEstimator
— Distance metric for estimating propagation cost
'euclidean'
(default) | 'dubins'
| 'reedsshepp'
Distance metric for estimating propagation cost, specified as one of these options:
'euclidean'
— Standard Euclidean distance.'dubins'
— Distance along a Dubins path that connects the two states. For more information, seedubinsPathSegment
.'reedsshepp'
— Distance along a Reeds Shepp path that connects the two states. For more information, seereedsSheppPathSegment
.
This property can only be set during construction.
GoalDistance
— Threshold of distance for reaching goal states
1
(default) | positive scalar
Threshold of distance for reaching goal states, specified as a positive scalar. When propagating states, a state is considered equal to the goal state when it is closer than this distance threshold.
This property can only be set during construction.
KinematicModel
— Kinematic model for propagating state
'bicycle'
(default) | 'ackermann'
Kinematic model for propagating the state, which determines the state variables,
size of the control inputs, and other system parameters that you can specify in the
SystemParameters
property.
Kinematic Model States and Controls
Type | State Vector | Control input |
---|---|---|
'bicycle' | [x y theta] | [v psi] |
'ackermann' | [x y theta psi] | [v psiDot] |
This property can only be set during construction and selecting the Ackermann kinematic model requires the Robotics System Toolbox™.
Integrator
— Integration method when propagating state
'rungekutta4'
(default) | 'euler'
Integration method when propagating state. Integration step size can be updated
through the SystemParameters
property.
'rungekutta4'
provides a more accurate integration result than
'euler'
at the cost of speed.
This property can only be set during construction.
SystemParameters
— Parameters for kinematic model, integrator, and control policy
structure
Parameters for the kinematic model, integrator, and control policy, specified as a structure with these fields:
KinematicModel
— Parameters for the kinematic model type specified in theKinematicModel
property.WheelBase
— Size of wheel base in metersSpeedLimit
— Velocity in the forward and backward directions in meters per second.SteerRatelimit
— Limits on steering rate in radians per second
Integrator
— Parameters for the integrator type specified in theIntegrator
property.ControlPolicy
— Parameters for the control policy specified in theControlPolicy
property.
Control Parameters
ControlPolicy
— Control command generation policy
'linearpursuit'
(default) | 'arcpursuit'
| 'randomsamples'
Control command generation policy, specified as one of these options:
'linearpursuit'
— Samples a random velocity and calculates a lookahead point along the vector that connects the initial state to the target state.'arcpursuit'
— Samples a random velocity and calculates a lookahead point along an arc that is tangential to the target state and intersects the initial xy-position.'randomsamples'
— Draws a finite set of random control samples from the control space and propagates to each. The propagator selects the sample that gets the closest to the goal and then performs a validation.
ControlLimits
— Limits on control commands for each state
[-1 1; -pi/4 pi/4]
(default) | n-by-2 matrix
Limits on control commands for each state, specified as an n-by-2 matrix. n is the number of control inputs for your system model.
NumControlOutput
— Number of control outputs
2
(default) | positive scalar
This property is read-only.
Number of control outputs, specified as a nonnegative scalar.
ControlStepSize
— Duration of each control command
0.1
(default) | positive scalar
Duration of each control command, specified as a positive scalar.
MaxControlSteps
— Maximum number of control steps
10
(default) | positive integer
Maximum number of times to propagate the system specified as positive integer.
Object Functions
distance | Estimate cost of propagating to target state |
propagate | Propagate system without validation |
propagateWhileValid | Propagate system and return valid motion |
sampleControl | Generate control command and duration |
setup | Set up the mobile robot state propagator |
Examples
Plan Kinodynamic Path with Controls for Mobile Robot
Plan control paths for a bicycle kinematic model with the mobileRobotPropagator
object. Specify a map for the environment, set state bounds, and define a start and goal location. Plan a path using the control-based RRT algorithm, which uses a state propagator for planning motion and the required control commands.
Set State and State Propagator Parameters
Load a ternary map matrix and create an occupancyMap
object. Create the state propagator using the map. By default, the state propagator uses a bicycle kinematic model.
load('exampleMaps','ternaryMap') map = occupancyMap(ternaryMap,10); propagator = mobileRobotPropagator(Environment=map); % Bicycle model
Set the state bounds on the state space based on the map world limits.
propagator.StateSpace.StateBounds(1:2,:) = ...
[map.XWorldLimits; map.YWorldLimits];
Plan Path
Create the path planner from the state propagator.
planner = plannerControlRRT(propagator);
Specify the start and goal states.
start = [10 15 0]; goal = [40 30 0];
Plan a path between the states. For repeatable results, reset the random number generator before planning. The plan
function outputs a navPathControl
object, which contains the states, control commands, and durations.
rng("default")
path = plan(planner,start,goal)
path = navPathControl with properties: StatePropagator: [1x1 mobileRobotPropagator] States: [192x3 double] Controls: [191x2 double] Durations: [191x1 double] TargetStates: [191x3 double] NumStates: 192 NumSegments: 191
Visualize Results
Visualize the map and plot the path states.
show(map) hold on plot(start(1),start(2),"rx") plot(goal(1),goal(2),"go") plot(path.States(:,1),path.States(:,2),"b") hold off
Display the [v psi]
control inputs of forward velocity and steering angle.
plot(path.Controls) ylim([-1 1]) legend(["Velocity (m/s)","Steering Angle (rad)"])
Limitations
Deployment using MATLAB® Compiler™ is not supported when
KinematicModel
is set to'ackermann'
.
Version History
Introduced in R2021b
See Also
Classes
Objects
Functions
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)