Main Content

enforceStateBounds

Reduce state to state bounds

Description

example

boundedStates = enforceStateBounds(space,states) reduces the specified states states to the state bounds in the StateBounds property of the specified state space object space.

Examples

collapse all

Create an SE(3) state space object.

space = stateSpaceSE3([-1 1; ...
    -2 2; ...
    -10 10; ...
    -inf inf; ...
    -inf inf; ...
    -inf inf; ...
    -inf inf])
space = 
  stateSpaceSE3 with properties:

                 Name: 'SE3'
          StateBounds: [7x2 double]
    NumStateVariables: 7
            WeightXYZ: 1
     WeightQuaternion: 0.1000

Create a pair of states in 3-D space.

state1 = [2 10 3 2 0 0 0.8];
state2 = [223 100 3 2 2 12 5];

Enforce state bounds for a single state.

boundedState = enforceStateBounds(space,state1)
boundedState = 1×7

    1.0000    2.0000    3.0000    2.0000         0         0    0.8000

Enforce state bounds for multiple states.

boundedStates = enforceStateBounds(space,[state1; state2])
boundedStates = 2×7

    1.0000    2.0000    3.0000    2.0000         0         0    0.8000
    1.0000    2.0000    3.0000    2.0000    2.0000   12.0000    5.0000

Input Arguments

collapse all

State space object, specified as a stateSpaceSE2, stateSpaceSE3, stateSpaceDubins, or stateSpaceReedsShepp object.

Unbounded states, specified as an n-by-3 or n-by-7 matrix of real values.

For the 2-D state space objects stateSpaceSE2, stateSpaceDubins, and stateSpaceReedsShepp, each row is of form [x y theta], which defines the xy-position and orientation angle theta of a state in the state space.

For the 3-D state space object stateSpaceSE3, each row is of form [x y z qw qx qy qz], which defines the xyz-position and quaternion orientation [qw qx qy qz] of a state in the state space.

Data Types: single | double

Output Arguments

collapse all

Bounded states, returned as an n-by-3 or n-by-7 matrix of real values. The value of n is same as for states input argument.

The function truncates each of the specified unbounded states to the bounds specified in the StateBounds property of the state space object space.

For the 2-D state space objects stateSpaceSE2, stateSpaceDubins, and stateSpaceReedsShepp, each row is of form [x y theta], which defines the xy-position and orientation angle theta of the bounded states.

For the 3-D state space object stateSpaceSE3, each row is of form [x y z qw qx qy qz], which defines the xyz-position and quaternion orientation [qw qx qy qz] of the bounded states.

Data Types: single | double

Introduced in R2019b