Main Content

enforceStateBounds

Reduce state to state bounds

Description

example

boundedStates= enforceStateBounds(space,states)reduces the specified statesstatesto the state bounds in theStateBoundsproperty of the specified state space objectspace.

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×71.0000 2.0000 3.0000 2.0000 0 0 0.8000

Enforce state bounds for multiple states.

boundedStates = enforceStateBounds(space,[state1; state2])
boundedStates =2×71.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 astateSpaceSE2,stateSpaceSE3,stateSpaceDubins, orstateSpaceReedsSheppobject.

Unbounded states, specified as ann-by-3 orn-by-7 matrix of real values.

For the 2-D state space objectsstateSpaceSE2,stateSpaceDubins, andstateSpaceReedsShepp, each row is of form[x y theta], which defines thexy-position and orientation anglethetaof a state in the state space.

For the 3-D state space objectstateSpaceSE3, each row is of form[x y z qw qx qy qz], which defines thexyz-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 ann-by-3 orn-by-7 matrix of real values. The value ofnis same as forstatesinput argument.

The function truncates each of the specified unbounded states to the bounds specified in theStateBoundsproperty of the state space objectspace.

For the 2-D state space objectsstateSpaceSE2,stateSpaceDubins, andstateSpaceReedsShepp, each row is of form[x y theta], which defines thexy-position and orientation anglethetaof the bounded states.

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

Data Types:single|double

Introduced in R2019b