poseplot
3-D pose plot
Syntax
Description
poseplot
plots the pose (position and orientation) at the coordinate origin position with zero rotation. The default navigation frame is the north-east-down (NED) frame.
poseplot(
plots the pose with orientation specified by a quaternionquat
)quat
. The position by default is[0 0 0]
.
poseplot(
plots the pose with orientation specified by a rotation matrixR
)R
. The position by default is[0 0 0]
.
poseplot(___,
specifies the navigation frame of the pose plot.frame
)
poseplot(___,
specifies pose patch properties using one or more name-value arguments. For example,Name=Value
)poseplot(PatchFaceColor="r")
plots the pose with red face color. For a list of properties, seePosePatch Properties.
poseplot(
specifies the parent axes of the pose plot.ax
,___)
returns thep
= poseplot(___)PosePatch
object. Usep
to modify properties of the pose patch after creation. For a list of properties, seePosePatch Properties.
Examples
Visualize Pose Usingposeplot
Plot the default pose using theposeplot
function with default settings.
poseplot xlabel("North-x (m)") ylabel("East-y (m)") zlabel("Down-z (m)");
Next, plot a pose with specified orientation and position.
q = quaternion([35 10 50],"eulerd","ZYX","frame"); position = [1 1 1]; poseplot(q,position)
然后,第二个姿势图和返回的阴谋thePosePatch
object. Plot the second pose with a smaller size by using theScaleFactor
name-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
Animate Pose Usingposeplot
Animate a series of poses using theposeplot
function. First, define the initial and final positions.
ps = [0 0 0]; pf = [10 0 0];
Then, define the initial and final orientations using thequaternion
object.
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)");
Change the position and orientation continuously using coefficients, and update the pose using theset
object function.
forcoeff = 0:0.01:1 q = slerp(qs,qf,coeff); position = ps + (pf - ps)*coeff; set(patch,Orientation=q,Position=position); drawnowend
Show Poses with Meshes
Plot orientations and positions in meshes using theposeplot
function. 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)")
Second, plot a rotor at the position[20 20 -20]
with zero rotation.
holdonposeplot(的"quaternion"),[20 20 -20],MeshFileName="multirotor.stl"ScaleFactor = 0.2);
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
Input Arguments
quat
—Quaternion
quaternion
object
Quaternion, specified as aquaternion
object.
R
—Rotation matrix
3-by-3 orthonormal matrix
Rotation matrix, specified as a 3-by-3 orthonormal matrix.
Example:eye(3)
position
—Position of pose plot
three-element real-valued vector
Position of the pose plot, specified as a three-element real-valued vector.
Example:[1 3 4]
frame
—Navigation frame of pose plot
"NED"
(default) |"ENU"
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 theYDir
andZDir
properties of the parent axes.
ax
—Parent axes of pose plot
Axes
object
Parent axes of the pose plot, specified as anAxes
object. If you do not specify the axes, theposeplot
function uses the current axes.
Name-Value Arguments
Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN
, whereName
is the argument name andValue
is 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)
ThePosePatch
properties listed here are only a subset. For a complete list, seePosePatch Properties.
Orientation
—Orientation of pose plot
quaternion
object(default) |rotation matrix
Orientation of the pose plot, specified as aquaternion
object or a rotation matrix.
Position
—Position of pose plot
[0 0 0]
(default) |three-element real-valued vector
Position of the pose plot, specified as a three-element real-valued vector.
MeshFileName
—Name of STL mesh file
字符串标量|character 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, theposeplot
function plots the mesh instead of the orientation box.
ScaleFactor
—Scale factor of pose plot
1
(default) |nonnegative scalar
Scale factor of the pose plot, specified as a nonnegative scalar. The scale factor controls the size of the orientation box. When you specify theMeshFileName
argument, the scale factor also changes the scale of the mesh.
PatchFaceColor
—Patch face color
[0 0 0]
(default) |RGB triplet|hexadecimal color code|"r"
|"g"
|"b"
|...
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 from0
toF
. 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" |
|
"green" |
"g" |
[0 1 0] |
"#00FF00" |
|
"blue" |
"b" |
[0 0 1] |
"#0000FF" |
|
"cyan" |
"c" |
[0 1 1] |
"#00FFFF" |
|
"magenta" |
"m" |
[1 0 1] |
"#FF00FF" |
|
"yellow" |
"y" |
[1 1 0] |
"#FFFF00" |
|
"black" |
"k" |
[0 0 0] |
"#000000" |
|
"white" |
"w" |
[1 1 1] |
"#FFFFFF" |
|
PatchFaceAlpha
—Patch face transparency
0.1
(default) |scalar in range[0, 1]
Patch face transparency, specified as a scalar in range[0, 1]
. A value of1
is fully opaque and0
is completely transparent.
Output Arguments
p
— Pose patch object
PosePatch
object
Pose patch object, returned as aPosePatch
object. You can use the returned object to query and modify properties of the plotted pose. For a list of properties, seePosePatch Properties.
Version History
See Also
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)