RelativeSensor
Measure relative kinematic quantities between two frame connectors
Library
Mechanics/MultiBody/Sensors
Description
Relative kinematic quantities between frame_a and frame_b are determined 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 from frame_a to frame_b. The following quantities can be provided as output signals:
- Relative position vector (= r_rel)
- Relative velocity vector (= v_rel)
- Relative acceleration vector (= a_rel)
- Three angles to rotate frame_a into frame_b (= angles)
- Relative angular velocity vector (= w_rel)
- Relative angular acceleration vector (= z_rel)
Via parameter resolveInFrame it is defined, in which frame a 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, to which frame_resolve is connected. Note, if this connector is enabled, it must be connected.
In the following figure the animation of a RelativeSensor component is shown. The light blue coordinate system is frame_a, the dark blue coordinate system is frame_b, and the yellow arrow is the animated sensor.
Note, derivatives of relative kinematic quantities are always performed with respect to the frame, in which the vector to be differentiated is resolved. After differentiation, it is possible via parameter resolveInFrameAfterDifferentiation (in the "Advanced" menu) to resolve the differentiated vector 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. If resolveInFrameAfterDifferentiation = Types.ResolveInFrameAB.world, then v_rel is additionally transformed to:
v_rel = resolve1(frame_b.R, der(r_rel))
The cut-force and the cut-torque in frame_resolve are always zero, whether frame_resolve is connected or not.
If get_angles = true, the 3 angles to rotate frame_a into frame_b along the axes defined by parameter sequence are returned. For example, if sequence = {3,1,2} then frame_a is rotated around angles[1] along the z-axis, afterwards it is rotated around angles[2] along the x-axis, and finally it is rotated around angles[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) the returned solution is selected such that |angles[1] - guessAngle1| is minimal. The relative transformation matrix between frame_a and frame_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 relative transformation matrix. In this case, the returned solution is selected 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 that only 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
Name | Label | Description | Data Type | Valid Values |
---|---|---|---|---|
mo_animation | animation | = true, if animation shall be enabled (show arrow) | Scalar | true |
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 | |
mo_resolveInFrame/choice2 | Resolve in frame_a | Number | 0 | |
mo_resolveInFrame/choice3 | Resolve in frame_b | Number | 0 | |
mo_resolveInFrame/choice4 | Resolve in frame_resolve (frame_resolve must be connected) | Number | 0 | |
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 |
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 |
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 |
mo_get_w_rel | get_w_rel | = true, to measure the relative angular velocity of frame_b with respect to frame_a | Number | 0 |
mo_get_z_rel | get_z_rel | = true, to measure the relative angular acceleration of frame_b with respect to frame_a | Number | 0 |
mo_get_angles | get_angles | = true, to measure the 3 rotation angles | Number | 0 |
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 |
Name | Label | Description | Data Type | Valid 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 |
Name | Label | Description | Data Type | Valid 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 | |
mo_resolveInFrameAfterDifferentiation/choice2 | Resolve in frame_a | Number | 0 | |
mo_resolveInFrameAfterDifferentiation/choice3 | Resolve in frame_b | Number | 0 | |
mo_resolveInFrameAfterDifferentiation/choice4 | Resolve in frame_resolve (frame_resolve must be connected) | Number | 0 |
Name | Label | Description | Data Type | Valid Values |
---|---|---|---|---|
mo_r_rel | r_rel | r_rel | Structure | |
mo_r_rel/fixed | fixed | Cell of vectors of size 3 | true | |
mo_r_rel/start | start | Cell of vectors of size 3 | ||
mo_v_rel | v_rel | v_rel | Structure | |
mo_v_rel/fixed | fixed | Cell of vectors of size 3 | true | |
mo_v_rel/start | start | Cell of vectors of size 3 | ||
mo_a_rel | a_rel | a_rel | Structure | |
mo_a_rel/fixed | fixed | Cell of vectors of size 3 | true | |
mo_a_rel/start | start | Cell of vectors of size 3 | ||
mo_angles | angles | angles | Structure | |
mo_angles/fixed | fixed | Cell of vectors of size 3 | true | |
mo_angles/start | start | Cell of vectors of size 3 | ||
mo_w_rel | w_rel | w_rel | Structure | |
mo_w_rel/fixed | fixed | Cell of vectors of size 3 | true | |
mo_w_rel/start | start | Cell of vectors of size 3 | ||
mo_z_rel | z_rel | z_rel | Structure | |
mo_z_rel/fixed | fixed | Cell of vectors of size 3 | true | |
mo_z_rel/start | start | Cell of vectors of size 3 |
Ports
Name | Type | Description | IO Type | Number |
---|---|---|---|---|
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 |