Motion Sensing

In SimMechanics™, you can sense the spatial relationship between two frames using two types of blocks:

  • Transform Sensor — Sense the spatial relationship between any two frames in a model. Parameters that you can sense with this block include position, velocity, and acceleration of the linear and angular types. This block provides the most extensive motion sensing capability in the SimMechanics libraries.

  • Joint blocks — Sense the spatial relationship between the base and follower frames of a Joint block. Parameters that you can sense with a Joint block include the position and its first two time derivatives (velocity and acceleration) for each joint primitive.

These blocks output a physical signal for each measurement that you specify. You can use the sensing output of these blocks for analysis or as input to a control system in a model.

Sensing Spatial Relationship Between Joint Frames

To sense the spatial relationship between the base and follower frames of a Joint block, you can use the Joint block itself. For each joint primitive, the dialog box provides a Sensing menu with basic parameters that you can measure. These parameters include the position, velocity, and acceleration of the follower frame with respect to the base frame. If the sensing menu of the dialog box does not provide the parameters that you wish to sense, use the Transform Sensor block instead. See Sensing Spatial Relationship Between Arbitrary Frames.

The sensing capability of a joint block is limited to the base and follower frames of that joint block. Every measurement provides the value of a parameter for the joint follower frame with respect to the joint base frame. If sensing the spatial relationship with a spherical joint primitive, you can also select the frame to resolve the measurement in. To sense the spatial relationship between any other two frames, use the Transform Sensor block instead.

If the joint primitive is of the revolute or spherical type, the parameters correspond to the rotation angle, angular velocity, and angular acceleration, respectively. If the joint primitive is of the prismatic type, the parameters correspond to the offset distance, linear velocity, and linear acceleration, respectively.

Regardless of joint primitive type, each parameter that you select applies only to the joint primitive it belongs to. For example, selecting Position in the Z Revolute Primitive (Rz) > Sensing menu exposes a physical signal port that outputs the rotation angle of the follower frame with respect to the base frame about the base frame Z axis.

The table lists the port label for each parameter that you can sense using a joint block. The first column of the table identifies the parameters that you can select. The remaining three columns identify the port labels for the three joint primitive menus that the dialog box can contain: Spherical, Revolute, and Prismatic.

ParameterSphericalRevolutePrismatic
PositionQqp
Velocitywwv
Velocity (X/Y/Z)wx/wy/wzN/AN/A
Accelerationbba
Acceleration (X/Y/Z)bx/by/bzN/AN/A

A joint block can contain multiple revolute and prismatic joint primitives. For blocks with multiple primitives of the same type, the port labels include an extra letter identifying the joint primitive axis. For example, the Position port label for the Z prismatic primitive of a Cartesian Joint block is pz.

Select Joint Parameters To Sense

To select the spatial relationship parameters that you wish to sense:

  1. Open the dialog box for the joint block to sense the spatial relationship across.

  2. In the Sensing menu of the block dialog box, select the parameters to sense.

The block exposes one physical signal port for each parameter that you select. The label of each port identifies the parameter that port outputs.

Sensing Spatial Relationship Between Arbitrary Frames

To sense the spatial relationship between two arbitrary frames in a model, you use the Transform Sensor block. The dialog box of this block provides a set of menus that you can use to select the parameters to sense. These parameters include position, velocity, and acceleration of the linear and angular types.

Every measurement provides the value of a parameter for the follower frame with respect to the base frame, resolved in the measurement frame that you choose. You can connect the base and follower frame ports of the Transform Sensor block to any two frames in a model. To measure a parameter for a different frame, connect the follower frame port to the frame line or port that identifies that frame. Likewise, to measure a parameter for the same frame but with respect to a different frame, connect the base frame port to the frame line or port that identifies that frame. Finally, to resolve a measurement in a different frame, select a different measurement frame in the block dialog box. For more information about measurement frames, see Measurement Frames. For more information about frame lines and ports, see Representing Frames.

Selecting a parameter from the block dialog box exposes the corresponding physical signal port in the block. Use this port to output the measurement for that parameter. To identify the port associated with each parameter, each port uses a unique label.

The table lists the port labels for each angular parameter that you can sense. The first column of the table identifies the parameters that you can select. The remaining three columns identify the port labels for the three angular parameter menus in the dialog box: Rotation, Angular Velocity, and Angular Acceleration. Certain parameters belong to one menu but not to others. N/A identifies the parameters that don't belong to a given menu—e.g. Angle, which is absent from the Angular Velocity.

ParameterRotationAngular VelocityAngular Acceleration
AngleqN/AN/A
AxisaxsN/AN/A
QuaternionQQdQdd
TransformRRdRdd
Omega X/Omega Y/Omega ZN/Awx/wy/wzN/A
Alpha X/Alpha Y/Alpha ZN/AN/Abx/by/bz

The table lists the port labels for each linear parameter that you can sense. As in the previous table, the first column identifies the parameters that you can select. The remaining three columns identify the port labels for the three linear parameter menus in the dialog box: Translation, Velocity, and Acceleration.

ParameterRotation PortAngular Velocity PortAngular Acceleration Port
X/Y/Zx/y/zvx/vy/vzax/ay/az
Radiusradvradarad
Azimuthazmvazmaazm
Distancedstvdstadst
Inclinationincvincainc

Select Transform Sensor Parameters To Sense

To select the spatial relationship parameters that you wish to sense:

  1. Open the Transform Sensor dialog box.

  2. Expand the menu for the parameter group that parameter belongs to.

    E.g. Rotation for parameter Angle.

  3. Select the check box for that parameter.

The block exposes one physical signal port for each parameter that you select. The label of each port identifies the parameter that port outputs.

Related Examples

More About

Was this topic helpful?