Body

Rigid body with frames, inertia and geometry

Library

Bodies

Description

The Body block represents a rigid body with properties you customize. The representation that you specify must include:

The representation can also include optional body geometry and color information for visualization.

A rigid body is defined in space by the position of its CG (or center of mass) and its orientation in some defined coordinate system.

    Setting Body Initial Conditions    The initial position and orientation of a body are set by the entries in its Body dialog that define the body's home configuration. These initial conditions remain unchanged, unless, with a Joint Initial Condition Actuator, you change the initial conditions of the Joint(s) connected to the Body prior to starting the simulation, or you actuate the Body with a Body Actuator. The imposition of additional initial conditions defines the initial configuration of the body.

Defining a Body with Mass, Coordinate System, and Visualization Properties

You must enter properties for a SimMechanics™ body in two sets, mass properties and coordinate system properties. A third set, visualization properties, is optional.

Mass Properties

The mass properties are defined by the body's mass and inertia tensor.

  • The mass is the body's inertia and controls the translational acceleration of the CG in response to an applied force.

  • The inertia tensor measures the distribution of mass density in the body and controls the rotational acceleration of the body about the CG in response to an applied torque.

  • The components of the inertia tensor control the initial orientation of the body and are always interpreted as being in the CG CS axes. The orientation of the CG CS axes with respect to another CS external to the body (the World CS, a CS on a Ground, or a CS on another Body) then determines the orientation of the body with respect to other bodies or with respect to World.

  • The body's inertia tensor defines its principal axes and moments and its equivalent ellipsoid, one of the standard shapes available for displaying a body in space.

Coordinate System Properties

The coordinate system properties are defined by the body's Body CSs.

  • The CS with its origin at the CG is required. The CG point specifies both the initial position of the whole body and the origin of the CG CS. You must also orient the CG CS axes.

  • You can place one or more additional Body CSs on a body. The Body dialog requires at least one. You must define each Body CS by the position of its origin and the orientation of its CS axes.

  • Each connection of a Joint, Constraint/Drive, Actuator, or Sensor block to a Body requires an anchor point on the Body. This anchor point is one of the Body CS origins.

  • Body CSs on the block available for connections are shown by Body CS ports on the sides of the block. You can show or hide each Body CS on the block sides.

  • The set of a body's Body CS origins (including the CG CS) defines the body's convex hull, one of the standard shapes available for displaying a body in space.

Visualization Properties

The visualization properties of a body include its color and geometry (surface size and shape).

  • As a default, the machine of which the Body is a member determines these visualization properties.

  • You can partly or completely override these defaults with custom settings for an individual Body.

Default Initial State of a Body

These two properties determine a body's initial position and orientation:

  • The position of a body's CG sets its initial position.

  • The body's inertia tensor components (in the CG CS) and the orientation of the CG CS axes with respect to other CSs in the machine set its initial orientation.

The initial conditions of a machine can be changed with Joint Initial Condition Actuator blocks before you start a simulation. If you do not change the initial state of a Body before simulation, SimMechanics simulation sets its initial position and orientation to its Body dialog entries, defining the body's home configuration. SimMechanics simulation also sets the Body's initial linear/angular velocities to zero in this case.

Dialog Box and Parameters

The dialog has two active areas, Mass properties and the set of tabs, Position and Orientation for Body coordinate systems, as well as Visualization.

 Restricted Parameters

Mass Properties

Mass

Enter the mass of the body in the first field and choose units in the pull-down menu to the right. The mass must be a positive, real number or MATLAB® equivalent expression. The defaults are 1 and kg (kilograms).

Inertia

Enter the inertia tensor (with respect to the Body CG CS axes) in the first field and choose units in the pull-down menu to the right. The tensor must be a 3-by-3 real, symmetric matrix. The default tensor is eye(3), the MATLAB 3-by-3 identity matrix. A zero tensor zeros(3,3) defines a point mass. The units default is kg-m2 (kilograms-meters2).

Body Coordinate Systems

Configuring a Body Coordinate System

You set up Body CSs on the Position and Orientation tabs:

  • The default configuration consists of three Body CSs: the required CG CS attached to the body's CG and two other optional Body CSs, called "CS1" and "CS2," for connecting Joints, Constraints, or Drivers.

  • You can configure the CG CS but not delete it. You also cannot create additional CG CSs, although you can duplicate the CG CS with a different name. (See more about Body coordinate systems controls following.)

  • The other CSs can be configured or deleted as you want, keeping at least one.

  • Configuring a Body CSs requires two groups of steps:

    • Positioning the Body CS origin in the Position tab

    • Orienting the Body CS axes in the Orientation tab

  • Defining Body CSs requires referring to other, pre-existing CSs in the model. In a given Body block, you can refer to Body and Grounded CSs in three ways. The references must be to:

    • World

    • Other Body CSs on the same body

    • The Adjoining CS, the coordinate system on a neighboring body or ground directly connected to the selected Body CS by a Joint, Constraint, or Driver

  • You must directly or indirectly define all Body CSs by reference to a Ground or to World. With indirect reference, you specify a Body CS relative to another CS and so on, in a chain of references that ultimately ends in a Ground or World. The CS reference chains of the Position and Orientation tabs can be different. The CS reference chains must not form a closed cycle.

  • Switch between the Position and Orientation tabs.

    Each Body CS is labeled with a name, CG for the CG CS, and CS1, CS2, etc., for additional CSs.

Configuring the Position Fields

The Position fields for each Body CS specify the position of that CS's origin as a translation vector:

  • The numerical components of the vector carry units.

  • The translation vector's components are oriented with respect to another set of CS axes.

  • The origin is displaced from the origin of another, pre-existing CS in your machine by this translation vector.

Highlight each Body CS to configure it.

Origin Position Vector [x y z]

Enter the translation vector that defines the position of the Body CS's origin.

The entry for the CG CS origin positions the entire body.

Units

Choose linear units for the translation vector. The default is m (meters).

Translated from Origin of

In the pull-down menu, choose the other, pre-existing CS in your machine that defines the starting point for the translation vector. The choices are World, Adjoining, and the other Body CSs on this Body. The ending point of the translation vector is this Body CS's origin.

For the CG CS, the default starting-point CS is World. For the additional Body CSs (CS1, CS2, etc.), the default starting point CS is this Body's CG.

Components in Axes of

In the pull-down menu, choose the CS whose axes define the orientation of the translation vector's components. The choices are World, Adjoining, and the other Body CSs on this Body. The translation vector's components are measured relative to the axes of the CS chosen in this column.

For the CG CS, the default orientation CS is World. For the additional Body CSs (CS1, CS2, etc.), the default orientation CS is this Body's CG.

Configuring the Orientation Fields

The Orientation fields for each Body CS specify the orientation of that CS's triad of axes as a rotation:

  • The orientation vector specifying the rotation vector has three components.

  • The numerical components of the vector carry units.

  • The rotation is oriented with respect to some other, pre-existing set of CS coordinate axes in your machine.

  • The orientation vector's components are interpreted in the convention of a rotation representation.

Highlight each Body CS to configure it.

Orientation Vector

Enter the components of the rotation that defines the orientation of the Body CS's axes. The geometric meaning of these components is determined by the Specified Using Convention column.

The required entry for the CG CS orients the CG CS axes. Together with the Inertia tensor entry in Mass properties, the CG CS axes orient the whole body with respect to another CS in your machine.

Units

Choose angular units for the rotation, degrees or radians. The default is deg (degrees).

Relative CS

In the pull-down menu, choose one of the other pre-existing CSs in your machine to define the starting orientation for the rotation. The choices are World, Adjoining, and the other Body CSs on this Body.

Specified Using Convention

In the pull-down menu, choose the representation type for the rotation:

Rotation TypeOrientation Vector Components
Quaternion[nx*sin(θ/2) ny*sin(θ/2) nz*sin(θ/2) cos(θ/2)]
3x3Transform3-by-3 orthogonal rotation matrix R
EulerRotation angles about sequence of three axes defining Euler angle convention [first-axis  second-axis  third-axis]

Rotation Conventions

There are three conventions in a Body block for representing rotations. See Representations of Body Motion and Representations of Body Orientation to learn more about rotations.

  • Euler

    The Euler angle convention specifies the rotation of the Body CS axes by rotating about three axes in a sequence. The components of the 1-by-3 row vector are the angles of rotation about those three axes, respectively in sequence, in degrees or radians.

    For example, Euler X-Y-Z means rotate about the original X axis, then about the first intermediate Y axis, and then about the second intermediate Z axis. Another example: Euler X-Z-Y means rotate about the original X axis, then about the first intermediate Z axis, and then about the second intermediate Y axis.

  • 3-by-3 Transform

    The transform convention specifies the rotation as a dimensionless 3-by-3 orthogonal rotation matrix. The inverse of an orthogonal matrix R is equal to its transpose: R-1 = RT.

    The columns of R are the (x,y,z) unit vectors of the Body CS axes. The units menu is inactive.

  • Quaternion

    The quaternion convention specifies the rotation in angle-axis form as a dimensionless 1-by-4 row vector:

    [nx*sin(θ/2) ny*sin(θ/2) nz*sin(θ/2) cos(θ/2)]

    n = (nx,ny,nz) is a three-component vector of unit length: n·n = nx2 + ny2 + nz2 = 1.

    The unit vector n specifies the axis of rotation. The rotation angle about that axis is θ and follows the right-hand rule.

Managing the Body Coordinate Systems List

The Body coordinate system controls (see the following figure, Body Coordinate Systems Controls) allow you to add, reorder, and delete Body CSs on a Body block.

To add a Body CS to the list:

  1. Highlight an existing Body CS in the list.

  2. Click the Add button (see the following figure, Body Coordinate Systems Controls).

    A new Body CS appears immediately below the Body CS you highlighted. New Body CSs are named in sequence after the current ones: CS3, CS4, etc.

To change the position of a Body CS in the list:

  1. Highlight the Body CS whose position you want to change.

  2. Click on the Up or Down button (see the following figure, Body Coordinate Systems Controls) until the Body CS is where you want it.

To delete a Body CS from the list:

  1. Highlight the Body CS you want to delete.

    You cannot delete the Body's CG CS or the last one of the non-CG CSs.

  2. Click on the Delete button (see the following figure, Body Coordinate Systems Controls).

    The Body CS you highlighted disappears.

Body Coordinate Systems Controls

Managing Body CS Ports on a Body Block

Connecting a Joint, Constraint, Driver, Actuator, or Sensor block to a Body block requires an existing and configured Body CS on that Body:

  • These other blocks define, constrain, impart, and measure the motion of bodies with respect to the origin and coordinate axes of Body CSs. Connect each of these blocks to a Body CS with a connection line.

  • The actual connection line running from the other block to the Body block must be anchored to a displayed Body CS Port on the side of the Body block in the model window.

  • A displayed Body CS Port on a Body block indicates a Body CS with the displayed name configured internally within the Body block.

  • Not all the Body CSs configured inside a Body block need to be displayed, however.

    See the preceding figure, Body Coordinate Systems Controls.

Show Port

Select this check box for any Body CS to create a corresponding Body CS Port on the side of the Body block. The Body CS on that line in the Body CS list is now accessible for connection to other blocks.

Clear this check box to remove the Body CS Port corresponding to that Body CS on that line in the list.

The defaults are not selected for CG, selected for CS1 and CS2.

To apply your choices to the displayed Body block, click Apply.

Port Side

From the pull-down menu, choose which side of the Body block you want the Body CS Port for that Body CS to be placed on, Left or Right.

The defaults are Left for CG and CS1 and Right for CS2.

To apply your choices to the displayed Body block, click Apply.

Visualization Properties

Default Settings

Visualization settings for a body consist of its

  • Body geometry (surface shape)

  • Color

The visualization window uses these settings to display the body. By default, a body inherits the visualization settings of the machine to which it is connected.

Customizing the Body Visualization Settings

You can change the visualization defaults individually with these menus.

Body geometry

From the pull-down menu, choose a body surface shape:

Body color

From the pull-down menu, choose a body color:

Specifying and Configuring an External Graphics File

If you choose External graphics file in the Body geometry pull-down menu, you must specify some additional information.

External graphics file

In the field, specify the graphics file.

You can search for files on your file system by clicking the browse ... button.

Attached to Body CS

In the pull-down menu, specify which Body CS to attach the graphics to. Your Body CS list is specified by the Position tab.

This Body CS serves as the reference origin and coordinate axes for the body geometry. Geometric measurements in the graphics file are interpreted in the units associated with this Body CS.

Requirements for External Body Geometry Files

Custom body visualization requires a body geometry graphics file in the stereolithographic (STL) format. It supports both binary and ASCII types of the STL format.

See the visualization chapters of the SimMechanics Visualization and Import guide for a complete discussion of graphics files for specifying body geometries.

    Caution   In order for custom visualization to work, this STL file must be either:

    • On your MATLAB path.

    • In your MATLAB present working folder.

    • Specified with complete path in the Body dialog.

    Otherwise, visualization reverts to the default body geometry.

Specifying a Color from the Color Palette

If you choose Use color palette in the Body color pull-down menu, the color palette button appears to the right of the menu. Click the color palette button to select a color for the body.

See Also

Body Actuator, Body Sensor, Ground, Machine Environment, Mechanical Branching Bar

See the relevant entries in the Glossary: adjoining CS, axis-angle rotation, body, Body CS, center of gravity (CG), convex hull, coordinate system (CS), equivalent ellipsoid, Euler angles, inertia tensor, mass, principal axes, principal inertial moments, quaternion, right-hand rule, and rotation matrix.

Setting Up and Configuring Bodies in Models

See Modeling Grounds and Bodies, and Creating Body CS Ports for more on setting up Bodies in machines.

See Applying Motions and Forces for setting general initial conditions (positions and velocities) of DoFs in a machine.

Was this topic helpful?