RelativeSensor

Measure relative kinematic quantities between two frame connectors

    RelativeSensor

Library

Modelica/Mechanics/MultiBody/Sensors

Description

Relative kinematic quantities between frame_a and frame_b aredetermined and provided at the conditional output signal connectors.For example, if parameter "get_r_rel = true", the connector"r_rel" is enabled and contains the relative vector fromframe_a to frame_b. The following quantities can be providedas output signals:

  1. Relative position vector (= r_rel)
  2. Relative velocity vector (= v_rel)
  3. Relative acceleration vector (= a_rel)
  4. Three angles to rotate frame_a into frame_b (= angles)
  5. Relative angular velocity vector (= w_rel)
  6. Relative angular acceleration vector (= z_rel)

Via parameter resolveInFrame it is defined, in which framea vector is resolved (before differentiation):

resolveInFrame =
Types.ResolveInFrameAB.
Meaning
world Resolve vectors in world frame
frame_a Resolve vectors in frame_a
frame_b Resolve vectors in frame_b
frame_resolve Resolve vectors in frame_resolve

If resolveInFrame = Types.ResolveInFrameAB.frame_resolve, the conditional connector"frame_resolve" is enabled and the vectors are resolved in the frame, towhich frame_resolve is connected. Note, if this connector is enabled, it mustbe connected.

In the following figure the animation of a RelativeSensorcomponent is shown. The light blue coordinate system isframe_a, the dark blue coordinate system is frame_b, andthe yellow arrow is the animated sensor.

Note, derivativesof relative kinematic quantities are always performed withrespect to the frame, in which the vector to be differentiatedis resolved. After differentiation, it is possible via parameterresolveInFrameAfterDifferentiation (in the "Advanced" menu)to resolve the differentiatedvector in another frame.

For example, if resolveInFrame = Types.ResolveInFrameAB.frame_b, then

   r_rel = resolve2(frame_b.R, frame_b.r_0 - frame_a.r0);   v_rel = der(r_rel);

is returned (r_rel = resolve2(frame_b.R, frame_b.r_0 - frame_a.r0)), i.e.,the derivative of the relative distance from frame_a to frame_b,resolved in frame_b. IfresolveInFrameAfterDifferentiation = Types.ResolveInFrameAB.world, thenv_rel is additionally transformed to:

   v_rel = resolve1(frame_b.R, der(r_rel))

The cut-force and the cut-torque in frame_resolve arealways zero, whether frame_resolve is connected or not.

If get_angles = true, the 3 angles to rotate frame_ainto frame_b along the axes defined by parameter sequenceare returned. For example, if sequence = {3,1,2} then frame_a isrotated around angles[1] along the z-axis, afterwards it is rotatedaround angles[2] along the x-axis, and finally it is rotated aroundangles[3] along the y-axis and is then identical to frame_b.The 3 angles are returned in the range

    -p <= angles[i] <= p

There are two solutions for "angles[1]" in this range.Via parameter guessAngle1 (default = 0) thereturned solution is selected such that |angles[1] - guessAngle1| isminimal. The relative transformation matrix between frame_a andframe_b may be in a singular configuration with respect to "sequence", i.e.,there is an infinite number of angle values leading to the same relativetransformation matrix. In this case, the returned solution isselected by setting angles[1] = guessAngle1. Then angles[2]and angles[3] can be uniquely determined in the above range.

The parameter sequence has the restriction thatonly values 1,2,3 can be used and that sequence[1] ≠ sequence[2]and sequence[2] ≠ sequence[3]. Often used values are:

  sequence = {1,2,3}  // Cardan or Tait-Bryan angle sequence           = {3,1,3}  // Euler angle sequence           = {3,2,1}

Parameters

RelativeSensor_0

NameLabelDescriptionData TypeValid Values

mo_animation

animation

= true, if animation shall be enabled (show arrow)

Scalar

true
false

mo_resolveInFrame

resolveInFrame

Frame in which vectors are resolved before differentiation (world, frame_a, frame_b, or frame_resolve)

Structure

mo_resolveInFrame/choice1

Resolve in world frame

Number

0
1

mo_resolveInFrame/choice2

Resolve in frame_a

Number

0
1

mo_resolveInFrame/choice3

Resolve in frame_b

Number

0
1

mo_resolveInFrame/choice4

Resolve in frame_resolve (frame_resolve must be connected)

Number

0
1

mo_get_r_rel

get_r_rel

= true, to measure the relative position vector from the origin of frame_a to frame_b

Number

0
1

mo_get_v_rel

get_v_rel

= true, to measure the relative velocity of the origin of frame_b with respect to frame_a

Number

0
1

mo_get_a_rel

get_a_rel

= true, to measure the relative acceleration of the origin of frame_b with respect to frame_a

Number

0
1

mo_get_w_rel

get_w_rel

= true, to measure the relative angular velocity of frame_b with respect to frame_a

Number

0
1

mo_get_z_rel

get_z_rel

= true, to measure the relative angular acceleration of frame_b with respect to frame_a

Number

0
1

mo_get_angles

get_angles

= true, to measure the 3 rotation angles

Number

0
1

mo_sequence

sequence

If get_angles=true: Angles are returned to rotate frame_a around axes sequence[1], sequence[2] and finally sequence[3] into frame_b

Vector of size 3

mo_guessAngle1

guessAngle1

If get_angles=true: Select angles[1] such that abs(angles[1] - guessAngle1) is a minimum

Scalar

RelativeSensor_1

NameLabelDescriptionData TypeValid Values

mo_arrowDiameter

arrowDiameter

Diameter of relative arrow from frame_a to frame_b

Scalar

mo_arrowColor

arrowColor

Color of relative arrow from frame_a to frame_b

Vector of size 3

mo_specularCoefficient

specularCoefficient

Reflection of ambient light (= 0: light is completely absorbed)

Scalar

RelativeSensor_2

NameLabelDescriptionData TypeValid Values

mo_resolveInFrameAfterDifferentiation

resolveInFrameAfterDifferentiation

Frame in which vectors are resolved after differentiation (world, frame_a, frame_b, or frame_resolve)

Structure

mo_resolveInFrameAfterDifferentiation/choice1

Resolve in world frame

Number

0
1

mo_resolveInFrameAfterDifferentiation/choice2

Resolve in frame_a

Number

0
1

mo_resolveInFrameAfterDifferentiation/choice3

Resolve in frame_b

Number

0
1

mo_resolveInFrameAfterDifferentiation/choice4

Resolve in frame_resolve (frame_resolve must be connected)

Number

0
1

RelativeSensor_3

NameLabelDescriptionData TypeValid Values

mo__nmodifiers

Number of Modifiers

Specifies the number of modifiers

Number

mo__modifiers

Modifiers

Add new modifier

Structure

mo__modifiers/varname

Variable name

Cell of strings

mo__modifiers/attribute

Attribute

Cell of strings

'start'
'fixed'

mo__modifiers/value

Value

Ports

NameTypeDescriptionIO TypeNumber

frame_a

implicit

Coordinate system a

input

1

frame_b

implicit

Coordinate system b

output

1

Port 3

implicit

If resolveInFrame = Types.ResolveInFrameAB.frame_resolve, the output signals are resolved in this frame

output

mo_resolveInFrame.choice4||mo_resolveInFrameAfterDifferentiation.choice4

Port 4

implicit

Relative position vector frame_b.r_0 - frame_a.r_0 resolved in frame defined by resolveInFrame

output

mo_get_r_rel

Port 5

implicit

Relative velocity vector

output

mo_get_v_rel

Port 6

implicit

Relative acceleration vector

output

mo_get_a_rel

Port 7

implicit

Angles to rotate frame_a into frame_b via 'sequence'

output

mo_get_angles

Port 8

implicit

Relative angular velocity vector

output

mo_get_w_rel

Port 9

implicit

Relative angular acceleration vector

output

mo_get_z_rel