The SimMechanics™ Sensors & Actuators library provides a set of Sensor blocks that enable you to measure
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.
Tip You can feed Sensor output back into Actuator blocks to model springs, dampers, and other mechanical devices that depend on force feedback. See Actuating a Body, Actuating a Joint, Adding Internal Forces, and Validating Mechanical Models.
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.
To sense the position, velocity, or acceleration of a body represented by a Body block with a Body Sensor:
Drag a Body Sensor block from the Sensors & Actuators library into your model.
Connect its connector port to a spare Body CS port on the Body.
Open the Sensor's dialog box.
Select the coordinate system relative to which the sensor measures its output from the With respect to CS list.
Select the check boxes next to the motions that you want to sense (see the Body Sensor block reference page).
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.
Click OK or Apply.
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.
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:
Drag a Joint Sensor block from the Sensors & Actuators library into your model.
Connect its connector port to the spare Sensor port on the joint.
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).
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.
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,
If the Constraint or Driver does not have a spare Sensor port, create one.
Drag a Constraint & Driver Sensor block from the Sensors & Actuators library into your model.
Connect its connector port to a Sensor port on the Constraint or Driver block.
Open the Sensor block's dialog box.
Select the body (follower or base) on which to measure the reaction force from the Reactions measured on list.
Select the coordinate system relative to which the Sensor measures its output from the With respect to coordinate system list.
Select the Reaction torque check box if you want the Sensor to output the reaction torque on the base (or follower) body.
Select the Reaction force check box if you want the Sensor to output the reaction force on the base (or follower) body.
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.
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.
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)/ 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/) = -8.77 N. The component of the reaction force orthogonal to (1, 2, 0) is not physical.