Create box collision geometry
collisionBox to create a box collision geometry centered at
X — Side length of box geometry
Side length of box geometry along the x-axis, specified as a positive scalar. Units are in meters.
Y — Side length of box geometry
Side length of box geometry along the y-axis, specified as a positive scalar. Units are in meters.
Z — Side length of box geometry
Side length of box geometry along the z-axis, specified as a positive scalar. Units are in meters.
Pose — Pose
eye(4) (default) | real-valued 4-by-4 matrix |
Pose of the collision geometry relative to the world frame, specified as a 4-by-4 homogeneous
matrix or an
se3 object. You can change the pose after
you create the collision geometry.
Note that when the pose is specified as an
se3 object, the
Pose property stores the pose
as a numeric 4-by-4 matrix.
|Show collision geometry|
|Convert collision primitive geometry into collision mesh geometry|
|Fit collision capsule around collision geometry|
Create and Visualize Box Collision Geometry
Create a box collision geometry centered at the origin. The side lengths in the x-, y-, and z-directions are 3, 1, and 2 meters, respectively.
box = collisionBox(3,1,2)
box = collisionBox with properties: X: 3 Y: 1 Z: 2 Pose: [4x4 double]
Visualize the box.
Create two homogeneous transformation matrices. The first matrix is a rotation about the z-axis by radians, and the second matrix is a rotation about the x-axis of radians.
matZ = axang2tform([0 0 1 pi/2]); matX = axang2tform([1 0 0 pi/8]);
Create a second box collision geometry with the same dimensions as the first. Change its pose to the product of the two matrices. The product corresponds to first rotation about the z-axis followed by rotation about the x-axis. Visualize the result.
box2 = collisionBox(3,1,2); box2.Pose = matZ*matX; show(box2) title('Box2')
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version HistoryIntroduced in R2019b
Pose property supports
You can now specify the
Pose property of