Main Content

poseplot

3-D pose plot

Description

example

poseplotplots the pose (position and orientation) at the coordinate origin position with zero rotation. The default navigation frame is the north-east-down (NED) frame.

example

poseplot(quat)plots the pose with orientation specified by a quaternionquat. The position by default is[0 0 0].

example

poseplot(R)plots the pose with orientation specified by a rotation matrixR. The position by default is[0 0 0].

example

poseplot(___,position)specifies the position of the pose plot.

poseplot(___,frame)specifies the navigation frame of the pose plot.

example

poseplot(___,Name=Value)specifies pose patch properties using one or more name-value arguments. For example,poseplot(PatchFaceColor="r")plots the pose with red face color. For a list of properties, seePosePatch Properties.

poseplot(ax,___)specifies the parent axes of the pose plot.

example

p= poseplot(___)returns thePosePatchobject. Usepto modify properties of the pose patch after creation. For a list of properties, seePosePatch Properties.

Examples

collapse all

Plot the default pose using theposeplotfunction with default settings.

poseplot xlabel("North-x (m)") ylabel("East-y (m)") zlabel("Down-z (m)");

Figure contains an axes object. The axes object is empty.

Next, plot a pose with specified orientation and position.

q = quaternion([35 10 50],"eulerd","ZYX","frame"); position = [1 1 1]; poseplot(q,position)

Figure contains an axes object. The axes object is empty.

然后,第二个姿势图和返回的阴谋thePosePatchobject. Plot the second pose with a smaller size by using theScaleFactorname-value argument.

holdonp = poseplot(eye(3),[5 5 5],ScaleFactor=0.5)
p = PosePatch with properties: Orientation: [3x3 double] Position: [5 5 5] Show all properties
legend("First Pose","Second Pose") holdoff

Figure contains an axes object. The axes object is empty. These objects represent First Pose, Second Pose.

Animate a series of poses using theposeplotfunction. First, define the initial and final positions.

ps = [0 0 0]; pf = [10 0 0];

Then, define the initial and final orientations using thequaternionobject.

qs = quaternion([45,0,0],'eulerd','ZYX','frame'); qf = quaternion([-45,0,0],'eulerd','ZYX','frame');

Show the starting pose.

patch = poseplot(qs,ps); ylim([-2 2]) xlim([-2 12]) xlabel("North-x (m)") ylabel("East-y (m)") zlabel("Down-z (m)");

Figure contains an axes object. The axes object is empty.

Change the position and orientation continuously using coefficients, and update the pose using thesetobject function.

forcoeff = 0:0.01:1 q = slerp(qs,qf,coeff); position = ps + (pf - ps)*coeff; set(patch,Orientation=q,Position=position); drawnowend

Figure contains an axes object. The axes object is empty.

Plot orientations and positions in meshes using theposeplotfunction. First, plot a ground vehicle at the origin with zero rotation.

poseplot(的"quaternion"),[0 0 0],MeshFileName="groundvehicle.stl",ScaleFactor=0.3); xlabel("North-x (m)") ylabel("East-y (m)") zlabel("Down-z (m)")

Figure contains an axes object. The axes object is empty.

Second, plot a rotor at the position[20 20 -20]with zero rotation.

holdonposeplot(的"quaternion"),[20 20 -20],MeshFileName="multirotor.stl"ScaleFactor = 0.2);

Figure contains an axes object. The axes object is empty.

Lastly, plot a fixed-wing aircraft at the position[5 5 -40]with zero rotation.

poseplot(的"quaternion"),[5 5 -40],MeshFileName="fixedwing.stl",ScaleFactor=0.4); view([-37.8 28.4]) holdoff

Figure contains an axes object. The axes object is empty.

Input Arguments

collapse all

Quaternion, specified as aquaternionobject.

Rotation matrix, specified as a 3-by-3 orthonormal matrix.

Example:eye(3)

Position of the pose plot, specified as a three-element real-valued vector.

Example:[1 3 4]

Navigation frame of the pose plot, specified as"NED"for the north-east-down frame or"ENU"for the east-north-up frame.

When the parent axes status ishold off, specifying the NED navigation frame reverses the y- and z-axes in the figure by setting theYDirandZDirproperties of the parent axes.

Parent axes of the pose plot, specified as anAxesobject. If you do not specify the axes, theposeplotfunction uses the current axes.

Name-Value Arguments

Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN, whereNameis the argument name andValueis the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example:poseplot(PatchFaceAlpha=0.1)

ThePosePatchproperties listed here are only a subset. For a complete list, seePosePatch Properties.

Orientation of the pose plot, specified as aquaternionobject or a rotation matrix.

Position of the pose plot, specified as a three-element real-valued vector.

Name of Standard Triangle Language (STL) mesh file, specified as a string scalar or a character vector containing the name of the mesh file. When you specify this argument, theposeplotfunction plots the mesh instead of the orientation box.

Scale factor of the pose plot, specified as a nonnegative scalar. The scale factor controls the size of the orientation box. When you specify theMeshFileNameargument, the scale factor also changes the scale of the mesh.

Patch face color, specified as an RGB triplet, a hexadecimal color code, a color name, or a short name.

  • An RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color. The intensities must be in the range[0, 1]; for example,[0.4 0.6 0.7].

  • A hexadecimal color code is a character vector or a string scalar that starts with a hash symbol (#) followed by three or six hexadecimal digits, which can range from0toF. The values are not case sensitive. Thus, the color codes"#FF8800","#ff8800","#F80", and"#f80"are equivalent.

Here is a list of commonly used colors and their corresponding values.

Color Name Short Name RGB Triplet Hexadecimal Color Code Appearance
"red" "r" [1 0 0] "#FF0000"

Sample of the color red

"green" "g" [0 1 0] "#00FF00"

Sample of the color green

"blue" "b" [0 0 1] "#0000FF"

Sample of the color blue

"cyan" "c" [0 1 1] "#00FFFF"

Sample of the color cyan

"magenta" "m" [1 0 1] "#FF00FF"

Sample of the color magenta

"yellow" "y" [1 1 0] "#FFFF00"

Sample of the color yellow

"black" "k" [0 0 0] "#000000"

Sample of the color black

"white" "w" [1 1 1] "#FFFFFF"

Sample of the color white

Patch face transparency, specified as a scalar in range[0, 1]. A value of1is fully opaque and0is completely transparent.

Output Arguments

collapse all

Pose patch object, returned as aPosePatchobject. You can use the returned object to query and modify properties of the plotted pose. For a list of properties, seePosePatch Properties.

Version History

Introduced in R2021b