Main Content

Rigid Body Tree Robot Model

The rigid body tree model is a representation of a robot structure. You can use it to represent robots such as manipulators or other kinematic trees. Use rigidBodyTree objects to create these models.

A rigid body tree is made up of rigid bodies (rigidBody) that are attached via joints (rigidBodyJoint). Each rigid body has a joint that defines how that body moves relative to its parent in the tree. Specify the transformation from one body to the next by setting the fixed transformation on each joint (setFixedTransform).

You can add, replace, or remove bodies from the rigid body tree model. You can also replace joints for specific bodies. The rigidBodyTree object maintains the relationships and updates the rigidBody object properties to reflect this relationship. You can also get transformations between different body frames using getTransform.

Rigid Body Tree Components


Every rigid body tree has a base. The base defines the world coordinate frame and is the first attachment point for a rigid body. The base cannot be modified, except for the Name property. You can do so by modifying the BaseName property of the rigid body tree.

Rigid Body

The rigid body is the basic building block of rigid body tree model and is created using rigidBody. A rigid body, sometimes called a link, represents a solid body that cannot deform. The distance between any two points on a single rigid body remains constant.

When added to a rigid body tree with multiple bodies, rigid bodies have parent or children bodies associated with them (Parent or Children properties). The parent is the body that this rigid body is attached to, which can be the robot base. The children are all the bodies attached to this body downstream from the base of the rigid body tree.

Each rigid body has a coordinate frame associated with them, and contains a rigidBodyJoint object.


Each rigid body has one joint, which defines the motion of that rigid body relative to its parent. It is the attachment point that connects two rigid bodies in a robot model. To represent a single physical body with multiple joints or different axes of motion, use multiple rigidBody objects.

The rigidBodyJoint object supports fixed, revolute, and prismatic joints.

These joints allow the following motion, depending on their type:

  • 'fixed' — No motion. Body is rigidly connected to its parent.

  • 'revolute' — Rotational motion only. Body rotates around this joint relative to its parent. Position limits define the minimum and maximum angular position in radians around the axis of motion.

  • 'prismatic' — Translational motion only. The body moves linearly relative to its parent along the axis of motion.

Each joint has an axis of motion defined by the JointAxis property. The joint axis is a 3-D unit vector that either defines the axis of rotation (revolute joints) or axis of translation (prismatic joints). The HomePosition property defines the home position for that specific joint, which is a point within the position limits. Use homeConfiguration to return the home configuration for the robot, which is a collection of all the joints home positions in the model.

Joints also have properties that define the fixed transformation between parent and children body coordinate frames. These properties can only be set using the setFixedTransform method. Depending on your method of inputting transformation parameters, either the JointToParentTransform or ChildToJointTransform property is set using this method. The other property is set to the identity matrix. The following images depict what each property signifies.

  • The JointToParentTransform defines where the joint of the child body is in relationship to the parent body frame. When JointToParentTransform is an identity matrix, the parent body and joint frames coincide.

  • The ChildToJointTransform defines where the joint of the child body is in relationship to the child body frame. When ChildToJointTransform is an identity matrix, the child body and joint frames coincide.


The actual joint positions are not part of this Joint object. The robot model is stateless. There is an intermediate transformation between the parent and child joint frames that defines the position of the joint along the axis of motion. This transformation is defined in the robot configuration. See Robot Configurations.

Robot Configurations

After fully assembling your robot and defining transformations between different bodies, you can create robot configurations. A configuration defines all the joint positions of the robot by their joint names.

Use homeConfiguration to get the HomePosition property of each joint and create the home configuration.

Robot configurations are given as an array of structures.

config = homeConfiguration(robot)
config = 

  1×6 struct array with fields:

Each element in the array is a structure that contains the name and position of one of the robot joints.
ans = 

  struct with fields:

        JointName: 'jnt1'
    JointPosition: 0

You can also generate a random configuration that obeys all the joint limits using randomConfiguration.

Use robot configurations when you want to plot a robot in a figure using show. Also, you can get the transformation between two body frames with a specific configuration using getTransform.

To get the robot configuration with a specified end-effector pose, use inverseKinematics. This algorithm solves for the required joint angles to achieve a specific pose for a specified rigid body.

See Also


Related Topics