Documentation

Frames and Frame Transforms

What Are Frames?

Frames are axis triads that encode position and orientation data in a 3-D multibody model. Each triad consists of three perpendicular axes that intersect at an origin. The origin determines the frame position and the axes determine the frame orientation. The axes are color-coded, with the x-axis in red, the y-axis in green, and the z-axis in blue.

Role of Frames

Every solid component has one or more local frames to which it is rigidly attached. By positioning and orienting the component frames, you position and orient the components themselves. This is the role of frames in a model—to enable you to specify the spatial relationships between components.

Working with Frames

A frame port identifies a local frame on a component. For example, the R frame port of a Solid block identifies the local reference frame of a solid. Every block has one or more frame ports that you connect in order to locate the associated components in space. The figure shows the reference frame ports on Body Elements blocks.

The connections between frame ports determine the spatial relationships between their frames. A direct frame connection line makes the connected frames coincident in space. A Rigid Transform block sets the rotational and translational offsets between the frames. The figure shows coincident and offset frame connections.

A coincident relationship between solid frames does not, by itself, constitute a coincident relationship between solid geometries. The spatial arrangement of two solid geometries depends not only on the spatial arrangement of the respective reference frames, but also on how the geometries are defined relative to those frames.

If two geometries differ from each other, or if their positions and orientations relative to their reference frames differ from each other, then making the reference frames coincident will cause the solid geometries to be offset. In the figure, connecting the frame of Solid A to the left frame of Solid B joins the solids such that their geometries are offset from each other.

What Are Frame Transforms?

The rotational and translational offsets between frames are called transforms. If the transforms are constant through time, they are called rigid. Rigid transforms enable you to fix the relative positions and orientations of components in space, e.g., to assemble solids into rigid bodies.

Working with Frame Transforms

You use the Rigid Transform block to specify a rotational, translational, or mixed rigid transform between frames. The transforms are directional. They set the rotation and translation of a frame known as follower relative to a frame known as base.

The frame port labels on the Rigid Transform block identify the base and follower frames. The frame connected to port B serves as base. The frame connected to port F serves as follower. Reversing the port connections reverses the direction in which the frame transform is applied.

You can specify a transform using different methods. For rotational transforms, these include axis-angle pairs, rotation matrices, and rotation sequences. For translational transforms, they include translational offset vectors defined in Cartesian or cylindrical coordinate systems.

If the rotational and translational transforms are both zero, the connected frames are coincident in space. This relationship is known as identity and it is equivalent to a direct frame connection line between frame ports—i.e., one without a Rigid Transform block.

Visualizing Frame Transforms

You can visualize frames and examine the transforms between frames using the Solid block visualization pane or Mechanics Explorer. Use the Solid block visualization pane to examine the frames of a single solid element. Click the Toggle frame visibility button in the visualization toolstrip to show all the solid frames.

Use Mechanics Explorer to visualize the frames of more than a single solid element—e.g., in compound bodies, multibody subsystems, or complete multibody models. Click the Toggle frame visibility button in the visualization toolstrip to show all frames. Select a node from the tree view pane to show only those frames belonging to the selected component.

Sensing Frame Transforms

You can sense rotational and translational transforms between frames. To sense a transform between any two frames, you use the Transform Sensor block. To sense a transform between frames connected by a Joint block, you use the Joint block itself.

The Transform Sensor block provides the broadest selection of transform measurements. You can sense rotation transforms as angles about axes, rotation matrices, and quaternions. You can sense translation transforms as offsets in Cartesian, cylindrical, and spherical coordinate systems.

Joint blocks provide a limited selection of transform measurements. The transforms that you can sense depend closely on the degrees of freedom that the joint provides. For example, a Prismatic Joint block provides a single translational degree of freedom and therefore senses translational variables only.

Transforms sensed through Transform Sensor blocks are given for the follower frame relative to the base frame. The transform measurements are resolved in a choice of five measurement frames, including the World frame, rotating and non-rotating versions of the base frame, and rotating and non-rotating versions of the follower frame.

Transforms sensed through joint blocks are given for the follower frame relative to the base frame. However, unless the joint has a spherical primitive, the transform measurements are resolved in the base frame only. Joint blocks with spherical primitives add the option to resolve measurements in the follower frame.

Specify a Frame Transform

This example shows how to move two solids relative to each other by specifying a frame transform between the solid reference frames. The transform consists of a -45 deg rotation about the z axis followed by a 1 m translation along the x-axis and a 1 m translation along the y-axis.

Add the solids to the model

  1. Drag two Solid blocks from the Body Elements library and place them in a new model.

    Each Solid block specifies the default geometry of a cube 1 m in width.

  2. Connect the Solid block R frame ports.

    The frame connection line makes the reference frames—and cubes—coincident in space.

Visualize the solid frames

  1. Drag a Solver Configuration block from the Simscape™ Foundation Utilities library and connect it anywhere on the model.

    This block is required for model update and simulation.

  2. Update the diagram, e.g., by selecting Simulation > Update Diagram.

    Mechanics Explorer opens with a model visualization.

  3. In the tree view pane, alternately click the Solid and Solid1 nodes.

    The visualization pane shows the solid reference frames. The frames are coincident in space.

Apply the rotation transform

  1. Drag a Rigid Transform block from the Frames and Transforms library and connect it between the two Solid blocks.

  2. In the Rigid Transform block dialog box, set:

    • Rotation > Method to Standard Axis.

    • Rotation > Axis to -Z.

    • Rotation > Angle to 45.

  3. Click OK and update the block diagram.

    The model visualization updates to show the rotated—and still overlapping—solids.

  4. In the tree view pane, click the Rigid Transform node.

    The visualization pane shows the rotated frames.

Apply the translation transform

  1. In the Rigid Transform block dialog box, set:

    • Translation > Method to Cartesian.

    • Translation > Offset to [1 1 0].

      The array elements are the translation offsets along the base frame x, y, and z axes.

  2. Click OK and update the block diagram.

    The model visualization updates to show the translated solids.

  3. In the tree view pane, click the Rigid Transform node.

    The visualization pane shows the translated frames.

The Rigid Transform block always applies the rotation transform first. The translation transform is relative to the rotated frame resulting from the rotation transform. To apply the translation transform first, use separate Rigid Transform blocks for each transform and connect them in the desired order between the Solid blocks.

Was this topic helpful?