Sensing Motions and Forces

About Sensors

The SimMechanics™ Sensors & Actuators library provides a set of Sensor blocks that enable you to measure

  • Body motions

  • Joint motions and forces or torques on joints

  • Constraint reaction forces and torques

All Sensor output is defined with respect to a fixed, conventional "zero." See Home Configuration and Position-Orientation Measurements following.

Home Configuration and Position-Orientation Measurements

The Body and Joint Sensor blocks can measure the position and/or orientation of bodies and degrees of freedom. They make these measurements relative to the home configuration of the machine, the machine state before the application of initial condition actuators and assembly of disassembled joints. Thus motion sensors include the effect of the latter, which act before the simulation starts.

For further discussion, see Modeling Disassembled Joints and Specifying Initial Positions and Velocities previously, and Kinematics and Machine Motion State.

Sensing Body Motions

To sense the position, velocity, or acceleration of a body represented by a Body block with a Body Sensor:

  1. If the Body block does not have a spare local coordinate system with a Body CS port, create one (see Managing Body Coordinate Systems).

  2. Drag a Body Sensor block from the Sensors & Actuators library into your model.

  3. Connect its connector port to a spare Body CS port on the Body.

  4. Open the Sensor's dialog box.

  5. Select the coordinate system relative to which the sensor measures its output from the With respect to CS list.

  6. Select the check boxes next to the motions that you want to sense (see the Body Sensor block reference page).

  7. If you have chosen to sense more than one type of motion and want the Sensor to multiplex the motions into a single output signal, select the Output selected parameters as one signal check box.

  8. Click OK or Apply.

  9. Connect the output of the Body Sensor block to a Simulink® Scope or other signal sink or to a motion feedback loop, depending on your needs.

Sensing Joint Motions and Forces

The Joint Sensor block enables you to measure the motions of degrees of freedom. It can also measure the relative forces and torques between the bodies connected to the joint. These include the computed force or torque (the force or torque needed to reproduce the joint's motion) and the reaction force and torque on a joint primitive. (You cannot measure the computed force or torque on a spherical or weld primitive.) You must connect a separate Joint Sensor block to a Joint block for each joint primitive that you want to sense.

To sense the motions, forces, and torques of a joint primitive contained by a Joint block:

  1. If the Joint block does not have a spare Sensor port, create one (see Creating Actuator and Sensor Ports on a Joint).

  2. Drag a Joint Sensor block from the Sensors & Actuators library into your model.

  3. Connect its connector port to the spare Sensor port on the joint.

  4. Use the Sensor's dialog box to configure the Sensor to measure the motions, forces, and torques that you want to measure (see the Joint Sensor block reference page).

  5. Connect the output of the Joint Sensor block to a Simulink Scope or other signal sink or to a motion feedback loop, depending on your needs.

Sensing Constraint Reaction Forces

The Constraint & Driver Sensor block enables you to measure the reaction forces and torques induced on the constraints modeled by SimMechanics Constraint and Driver blocks.

To sense the reaction force and/or torque induced by a constraint or driver,

  1. If the Constraint or Driver does not have a spare Sensor port, create one.

  2. Drag a Constraint & Driver Sensor block from the Sensors & Actuators library into your model.

  3. Connect its connector port to a Sensor port on the Constraint or Driver block.

  4. Open the Sensor block's dialog box.

  5. Select the body (follower or base) on which to measure the reaction force from the Reactions measured on list.

  6. Select the coordinate system relative to which the Sensor measures its output from the With respect to coordinate system list.

  7. Select the Reaction torque check box if you want the Sensor to output the reaction torque on the base (or follower) body.

  8. Select the Reaction force check box if you want the Sensor to output the reaction force on the base (or follower) body.

  9. If you have chosen to output both reaction force and torque and want the Sensor to multiplex them into a single output signal, select the Output selected parameters as one signal check box.

  10. Click OK or Apply. Connect the output of the Constraint & Driver Sensor block to a Simulink Scope or other signal sink or to a motion feedback loop, depending on your needs.

Not all the reaction force/torque components are significant. Only those components projected into the subspace of constrained or driven degrees of freedom (DoFs) are physical. Components orthogonal to the constrained or driven degrees of freedom are not physical.

Example: Linear Driver

In this example, you drive a body along the x-axis, but only allow it a prismatic DoF tilted at an angle in the x-y plane. Construct the following model.

Configure the Constraint & Driver Sensor to measure only the reaction force, not the torque. Configure the Linear Driver to drive the Body along the World x-axis, but set up the Prismatic with a primitive axis along (1, 2, 0). The body can then move only along this axis, but is driven along the horizontal x-axis. Measure all motions and forces in World. Leave all other settings at default.

Open the Scopes and run the model. The measured reaction force lies along the x-axis, with a value of -19.62 N (newtons) = -2mg. Because the constrained DoF is not parallel to the x-axis, you need to project the reaction force along the unit vector (1, 2, 0)/5 defining the direction of the prismatic primitive to obtain the physical part.

Add to the model the Simulink blocks that form a dot product between the reaction force signal (three components) and the prismatic unit vector (also three components). (You can define a workspace vector for this axis and use it in both the joint and the dot product.) Reconnect Scope1 to measure this physical component of the reaction force.

The physical component of the reaction force is -(19.62 N)·(1/5) = -8.77 N. The component of the reaction force orthogonal to (1, 2, 0) is not physical.

Was this topic helpful?