# Joint Sensor

Joint force, torque, and motion sensor

## Library

Sensors & Actuators

## Description

The Joint Sensor block measures the position, velocity, and/or acceleration of a joint primitive in a Joint block. It also measures the reaction force and torque across the Joint.

The Joint Sensor measures the motion along/about the joint axis (or about the pivot point for a spherical primitive) in the reference coordinate system (CS) specified for that joint primitive in the Joint's dialog. The Joint connects a base and a follower Body at one body coordinate system on each body. The base-follower sequence determines the sense of the motion, which is defined as follower relative to base.

Depending on the joint primitive being sensed, you measure a combination of outputs from one of these motion types:

Motion TypeJoint Primitive TypeMeasurementsRelative Motions of Connected Follower and Base Coordinate Systems
TranslationalPrismaticLinear position
Linear velocity
Linear acceleration
Distance moved along prismatic primitive axis of
follower body CS origin relative to base body CS origin
RotationalRevoluteAngle
Angular velocity
Acceleration
Rotation angle about revolute primitive axis of
follower body CS origin relative to base body CS origin
SphericalSphericalQuaternion
Quaternion first derivative
Quaternion second derivative
Rotational orientation of follower body CS axes relative to base body CS axes

The input is the connector port connected to the Joint being sensed. The outport is a set of Simulink® signals or one bundled Simulink signal of the position, velocity, acceleration, computed force, and/or reaction force of the joint primitive.

A Joint Sensor block measures one joint primitive at a time:

• A primitive Joint (Prismatic or Revolute) has only one primitive within the Joint to sense.

• A composite Joint has multiple joint primitives within, and you must choose which primitive to sense with the Joint Sensor.

### Relative Orientation of Follower and Base Bodies in Spherical Motion

In the spherical primitive case, the joint motion is a three-dimensional rotation, which is the orientation of the base body CS axes relative to the follower body CS axes. The sensor returns a quaternion q corresponding to a rotation matrix R that represents this orientation.

The components of the same vector v as measured in the follower and base body CS axes are related by vF = RT·vB. The column vector vB lists the vector v's three components measured in the base body CS axes. The column vector vF lists the vector v's three components measured in the follower body CS axes. The columns of the rotation matrix R are the components of the follower body CS unit basis vectors measured with respect to the base body CS axes.

See Representations of Body Motion and Representations of Body Orientation for more details on representing body position and orientation, rotation matrices, and angular velocity, as well as the relationship of R and q.

### Joint Motion and the Home Configuration

The Joint Sensor block measures the state of a degree of freedom, translational or rotational. It measures this state relative to the home configuration, the machine state before the application of initial condition actuators and assembly of disassembled joints. Thus the Joint Sensor measures the effect of the latter, which act before the simulation starts.

### Reaction and Computed Force on a Joint

The reaction force and torque are three-component vectors of the force and torque that the joint transfers from the base Body to the follower Body.

The computed force is the component of the reaction force projected along the prismatic primitive axis. It is also the force along the prismatic axis that reproduces the follower motion with respect to the base.

The computed torque is the component of the reaction torque projected along the revolute primitive axis. It is also the torque about the revolute axis that reproduces the follower motion with respect to the base.

Joint Reaction and Computed Force (Prismatic Case)

## Dialog Box and Parameters

The dialog has one active area, Measurements. The block parameters are not displayed unless you connect it to a specific Joint block.

## Measurements

Connected to primitive

In the pull-down menu, choose the joint primitive within the Joint that you want to measure with the Joint Sensor. A primitive Joint block has only one joint primitive.

If the Joint Sensor is not connected to a Joint block, this menu is not shown.

Output selected parameters as one signal

Select this check box to convert all the output signals into a single bundled signal. The default is selected. If you clear it, the Joint Sensor block will grow as many Simulink outports as there are active signals selected, in the same order top to bottom, in the dialog.

If the check box is selected, the Simulink signal out has all the active signals ordered into a single row vector. The order and type of the signal components depend on the joint primitive, as listed in the Simulink signal tables following.

The Measurements tab you see in the Joint Sensor dialog depends on the type of joint primitive to which you connect the Joint Sensor.

### Measuring Prismatic Motion

In the Primitive Outputs area, select the check box(es) for each of the possible measurements you want to make: Position, Velocity, Acceleration, and Computed force.

In the Units pull-down menus, choose the units for each of the measurements you want. The defaults are `m` (meters), `m/s` (meters/second), `m/s`2 (meters/second2), `N` (newtons), respectively, for Position, Velocity, Acceleration, and Computed force.

The bundled Simulink output signal for a prismatic primitive has these measurements ordered in a row vector. Nonselected components are removed from the vector signal:

 Position Velocity Acceleration Computed Force Reaction Torque (3-vector) Reaction Force (3-vector)

### Measuring Revolute Motion

In the Primitive Outputs area, select the check box(es) for each of the possible measurements you want to make: Angle, Angular velocity, Angular acceleration, and Computed torque.

In the Units pull-down menus, choose the units for each of the measurements you want. The defaults are `deg` (degrees), `deg/s` (degrees/second), `deg/s`2 (degrees/second2), `N*m` (newton-meters), and `N` (newtons), respectively, for Angle, Angular Velocity, Angular Acceleration, and Computed torque.

The bundled Simulink output signal for a revolute primitive has these measurements ordered in a row vector. Nonselected components are removed from the vector signal:

 Angle Angular Velocity Angular Acceleration Computed Torque Reaction Torque (3-vector) Reaction Force (3-vector)

 Tip   The absolute angle of revolute motion is mapped on to the interval (-180o, +180o] degrees or (-π,+π] radians.

### Measuring Spherical Motion

In the Primitive Outputs area, select the check box(es) for each of the possible measurements you want to make: Quaternion, Quaternion, derivative, and Quaternion, second derivative.

Quaternions are dimensionless, 4-component row vectors. The time unit for the derivatives is seconds.

The bundled Simulink output signal for a spherical primitive has these quaternion measurements ordered into a larger row vector. Nonselected components are removed from the vector signal:

 Quaternion (4-vector) Quaternion, derivative (4-vector) Quaternion, second derivative (4-vector) Reaction Torque (3-vector) Reaction Force (3-vector)

### Reaction Force and Torque

In the Joint Reactions area, select the check box(es) for each of the possible measurements you want to make.

Reaction torque

Select the check box to output the reaction torque.

Reaction force

Select the check box to output the reaction force.

Reaction measured on

Choose the Body on which the reaction force and torque vectors are measured, `Base` or `Follower`. The default is `Base`.

With respect to CS

In the pull-down menu, choose the coordinate system in which the reaction torque and force vectors are measured: either the ```Local (Body CS)``` to which the Sensor is connected or the default ```Absolute (World)```.

In the `Absolute` case, the force and torque vectors have components measured relative to the inertial World CS axes. In the `Local` case, the same force and torque signals are premultiplied by the inverse orientation rotation matrix R-1 = RT for the Body selected in Reactions measured on.

## Example

Here is a Joint Sensor connected to a Prismatic that connects two Bodies:

You must add an Sensor port (connector port) to the Joint block to connect the Joint Sensor to it. The base (B)-follower (F) Body sequence on the two sides of the Joint determines the sense of the Joint Sensor data.