---
url: /dyad/stable/stdlib/MultibodyComponents/components/PlanarMechanics.RelativeVelocity.md
description: >-
  Dyad PlanarMechanics.RelativeVelocity docs.  Measures relative velocity and
  angular velocity between the origins of two frame connectors.
---

# `PlanarMechanics.RelativeVelocity` {#PlanarMechanics.RelativeVelocity}

Measures relative velocity and angular velocity between the origins of two frame connectors.

Composes RelativePosition (FrameA) + differentiation + TransformRelativeVector to resolve the result in any supported frame. This is a sensor component: it reads kinematic quantities without exerting forces.

This component extends from [`PartialTwoFrameSensor`](../types/PartialTwoFrameSensor.md)

## Usage {#Usage}

`MultibodyComponents.PlanarMechanics.RelativeVelocity()`

## Parameters: {#Parameters:}

|               Name | Description | Units |             Default value |
| ------------------:| -----------:| -----:| -------------------------:|
| `resolve_in_frame` |             |     – | MultibodyCo...me.FrameA() |

## Connectors {#Connectors}

* `frame_a` - Coordinate system (2-dim.) fixed to the component with one cut-force and cut-torque.

All variables are resolved in the planar world frame. ([`Frame2D`](/stdlib/Dyad/connectors/Frame2D#Frame2D))

* `frame_b` - Coordinate system (2-dim.) fixed to the component with one cut-force and cut-torque.

All variables are resolved in the planar world frame. ([`Frame2D`](/stdlib/Dyad/connectors/Frame2D#Frame2D))

* `frame_resolve` - Coordinate system (2-dim.) fixed to the component with one cut-force and cut-torque.

All variables are resolved in the planar world frame. ([`Frame2D`](/stdlib/Dyad/connectors/Frame2D#Frame2D))

* `rel_v_x` - This connector represents a real signal as an output from a component ([`RealOutput`](/stdlib/Dyad/connectors/RealOutput#RealOutput))

* `rel_v_y` - This connector represents a real signal as an output from a component ([`RealOutput`](/stdlib/Dyad/connectors/RealOutput#RealOutput))

* `rel_w` - This connector represents a real signal as an output from a component ([`RealOutput`](/stdlib/Dyad/connectors/RealOutput#RealOutput))

## Variables {#Variables}

|    Name | Description | Units |
| -------:| -----------:| -----:|
|   `rpx` |             |     m |
|   `rpy` |             |     m |
| `rpphi` |             |   rad |

## Behavior {#Behavior}

## Source {#Source}

```dyad
"""
Measures relative velocity and angular velocity between the origins of two frame connectors.

Composes RelativePosition (FrameA) + differentiation + TransformRelativeVector
to resolve the result in any supported frame. This is a sensor component: it reads
kinematic quantities without exerting forces.
"""
component RelativeVelocity
  extends PartialTwoFrameSensor
  frame_resolve = Frame2D() if resolve_in_frame == MultibodyComponents.ResolveInFrame.FrameResolve()
  "Relative x velocity"
  rel_v_x = RealOutput() {}
  "Relative y velocity"
  rel_v_y = RealOutput() {}
  "Relative angular velocity"
  rel_w = RealOutput() {}
  rel_pos = RelativePosition(resolve_in_frame = MultibodyComponents.ResolveInFrame.FrameA())
  transform = TransformRelativeVector(frame_in = MultibodyComponents.ResolveInFrame.FrameA(), frame_out = resolve_in_frame)
  structural parameter resolve_in_frame::MultibodyComponents.ResolveInFrame = MultibodyComponents.ResolveInFrame.FrameA()
  variable rpx::Length
  variable rpy::Length
  variable rpphi::Angle
relations
  connect(frame_a, rel_pos.frame_a)
  connect(frame_b, rel_pos.frame_b)
  connect(frame_a, transform.frame_a)
  connect(frame_b, transform.frame_b)
  if resolve_in_frame == MultibodyComponents.ResolveInFrame.FrameResolve()
    connect(frame_resolve, transform.frame_resolve)
  end
  rpx = rel_pos.rel_x
  rpy = rel_pos.rel_y
  rpphi = rel_pos.rel_phi
  transform.x_in = der(rpx)
  transform.y_in = der(rpy)
  transform.phi_in = der(rpphi)
  rel_v_x = transform.x_out
  rel_v_y = transform.y_out
  rel_w = transform.phi_out
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MultibodyComponents/TwoFrameSensor.svg"},
    "labels": [{"label": "rel vel", "x": 500, "y": 680, "rot": 0}]
  }
}
end
```

```dyad
"""
Measures relative velocity and angular velocity between the origins of two frame connectors.

Composes RelativePosition (FrameA) + differentiation + TransformRelativeVector
to resolve the result in any supported frame. This is a sensor component: it reads
kinematic quantities without exerting forces.
"""
component RelativeVelocity
  frame_a = Frame2D() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 50, "y1": 450, "x2": 150, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  frame_b = Frame2D() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 850, "y1": 450, "x2": 950, "y2": 550, "rot": 0}
      },
      "tags": []
    }
  }
  frame_resolve = Frame2D() if resolve_in_frame == MultibodyComponents.ResolveInFrame.FrameResolve()
  "Relative x velocity"
  rel_v_x = RealOutput() {}
  "Relative y velocity"
  rel_v_y = RealOutput() {}
  "Relative angular velocity"
  rel_w = RealOutput() {}
  rel_pos = RelativePosition(resolve_in_frame = MultibodyComponents.ResolveInFrame.FrameA())
  transform = TransformRelativeVector(frame_in = MultibodyComponents.ResolveInFrame.FrameA(), frame_out = resolve_in_frame)
  structural parameter resolve_in_frame::MultibodyComponents.ResolveInFrame = MultibodyComponents.ResolveInFrame.FrameA()
  variable rpx::Length
  variable rpy::Length
  variable rpphi::Angle
relations
  connect(frame_a, rel_pos.frame_a)
  connect(frame_b, rel_pos.frame_b)
  connect(frame_a, transform.frame_a)
  connect(frame_b, transform.frame_b)
  if resolve_in_frame == MultibodyComponents.ResolveInFrame.FrameResolve()
    connect(frame_resolve, transform.frame_resolve)
  end
  rpx = rel_pos.rel_x
  rpy = rel_pos.rel_y
  rpphi = rel_pos.rel_phi
  transform.x_in = der(rpx)
  transform.y_in = der(rpy)
  transform.phi_in = der(rpphi)
  rel_v_x = transform.x_out
  rel_v_y = transform.y_out
  rel_w = transform.phi_out
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MultibodyComponents/TwoFrameSensor.svg"},
    "labels": [{"label": "rel vel", "x": 500, "y": 680, "rot": 0}]
  }
}
end
```

## Test Cases {#Test-Cases}

No test cases defined.

## Related {#Related}

* Examples

* Experiments

* Analyses

* Tests
  * [`SensorsTest`](PlanarMechanics.RelativeVelocity.md)
