# Body Sensor

Body translation and rotation sensor

## Library

First Generation/Sensors & Actuators

## Description

The Body Sensor block senses the motion of a body represented by a Body block. You connect the Body Sensor to a Body coordinate system (CS) on the Body whose motion you want to sense. The sensor specifically measures the motion of the origin of this Body CS.

The Body Sensor measures the components of translational and rotational motion in any combination of:

• Position, velocity, and acceleration vectors. The position vector has its tail at the World CS origin.

• Rotation matrix, angular velocity, and acceleration vectors. Rotation matrices are output as nine-element row vectors arranged in column-major order.

In the block dialog, you choose the reference coordinate system (CS) axes in which these components are represented.

The input is the connector port connected to the Body being sensed. The outport is a set of Simulink® signals or one bundled Simulink signal of the selected matrix and/or vector components.

### Coordinate Representations and Body Orientation

A body's orientation rotation matrix R relates the components of the same vector v as measured in the inertial World CS and in the Body CS by vb = RT·vW. The column vector vW lists the vector v's three components measured in the World CS. The column vector vb lists the vector v's three components measured in the Body CS.

The columns of the rotation matrix R are the components of the Body CS unit basis vectors measured with respect to the World 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.

### Body Position-Orientation and the Home Configuration

The Body Sensor block can measure the position and/or orientation of a body. It measures these relative to the home configuration of the machine, the machine state before the application of initial condition actuators and assembly of disassembled joints. Thus the Body Sensor includes the effect of the latter, which act before the simulation starts.

## Dialog Box and Parameters

The dialog has one active area, Measurements.

## Measurements

With respect to CS

In the pull-down menu, choose the coordinate system in which the body motion components are represented: either the ```Local (Body CS)``` to which the Sensor is connected or the default ```Absolute (World)```.

In the `Absolute` case, the rotation matrix R and the motion vectors have components represented in the inertial World CS axes. In the `Local` case, the same body motion components are premultiplied by the body's inverse orientation rotation matrix R-1 = RT.

Each vector measurement is a row vector in the Simulink output signal. The selected signals are ordered in the same sequence as the dialog.

Select the check box for each of the possible measurements you want to make:

• Translational motion: Position, Velocity, and Acceleration vectors: r, v = dr/dt, and a = dv/dt, respectively.

• Rotational motion: Angular velocity and Angular acceleration vectors and Rotation matrix:

• The Rotation matrix is the 3-by-3 orthogonal rotation matrix R:

`$\left(\begin{array}{ccc}{R}_{11}& {R}_{12}& {R}_{13}\\ {R}_{21}& {R}_{22}& {R}_{23}\\ {R}_{31}& {R}_{32}& {R}_{33}\end{array}\right)$`

representing rotational orientation and satisfying RTR = RRT = I. The components are output columnwise as a 9-component row vector: (R11, R21, R31, R12, ... ).

• If you choose the With respect to coordinate system as `Absolute (World)`, the Rotation matrix measures the body's rotational orientation with respect to the World CS. Recall the relationship of vector components in the World and body coordinate axes, vW = R·vb.

• If you choose the With respect to coordinate system as `Local (Body CS)`, the Rotation matrix returns the 3-by-3 identity matrix RTR = I.

• The angular velocity is ωj = (1/2)Σik ɛijkΩik , where the matrix Ω = +(dR/dt)*RT = -R*(dRT/dt), and ɛ is the permutation symbol. The angular acceleration is α = dω/dt.

In the Units pull-down menus, choose the units for each of the measurements you want:

• Translation: the defaults are `m` (meters), `m/s` (meters/second), and `m/s`2 (meters/second2), respectively, for Position, Velocity, and Acceleration.

• Rotation: the defaults are `deg/s` (degrees/second) and `deg/s`2 (degrees/second2), respectively, for Angular velocity and Angular acceleration. The Rotation matrix is dimensionless.

Output selected parameters as one signal

Select this check box to convert the output signals into a single bundled signal. The default is selected. If you clear it, the Body Sensor block will grow as many Simulink outports as there are active signals selected, one port for each selected signal.

If the check box is selected, the Simulink signal out has all the active (selected) signals ordered into a single row vector, in the same order you see in the dialog. Nonselected components are removed from the vector signal.

The sensor outputs are ordered and labeled as follows.

Body Sensor Output SignalLabel
Positionp
Velocityv
Angular velocityav
Rotation matrix[R]
Accelerationa
Angular velocityaa

## Example

Here is a Body Sensor connected to a Body:

You must connect the Body Sensor to the Body at one of its Body CS ports. The Sensor measures the motion of that Body CS.