Skip to content
LIBRARY
PlanarMechanics.RelativeVelocity.md

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

Usage

MultibodyComponents.PlanarMechanics.RelativeVelocity()

Parameters:

NameDescriptionUnitsDefault value
resolve_in_frameMultibodyComponents.ResolveInFrame.FrameA()

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)

  • 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)

  • 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)

  • rel_v_x - This connector represents a real signal as an output from a component (RealOutput)

  • rel_v_y - This connector represents a real signal as an output from a component (RealOutput)

  • rel_w - This connector represents a real signal as an output from a component (RealOutput)

Variables

NameDescriptionUnits
rpxm
rpym
rpphirad

Behavior

julia
using MultibodyComponents #hide
using ModelingToolkit #hide
@named sys = MultibodyComponents.PlanarMechanics.RelativeVelocity() #hide
full_equations(sys) #hide
<< @example-block not executed in draft mode >>

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
Flattened 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
  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

No test cases defined.