Skip to content
LIBRARY
PlanarMechanics.RelativePosition.md

PlanarMechanics.RelativePosition

Measures relative position and orientation between the origins of two frame connectors.

Computes frame_b - frame_a. This is a sensor component: it reads kinematic quantities without exerting forces. Use connect to attach to body frames (sensor forces are zero, so the force balance is unaffected).

This component extends from PartialTwoFrameSensor

Usage

MultibodyComponents.PlanarMechanics.RelativePosition()

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_x - This connector represents a real signal as an output from a component (RealOutput)

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

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

Behavior

[relx(t)=pos.relx(t)rely(t)=pos.rely(t)relphi(t)=pos.relphi(t)connect(framea,pos+framea)connect(frameb,pos+frameb)pos.framea.fx(t)=0pos.framea.fy(t)=0pos.framea.tau(t)=0pos.frameb.fx(t)=0pos.frameb.fy(t)=0pos.frameb.tau(t)=0arrayliteral([3],pos.relx(t),pos.rely(t),pos.relphi(t))=pos.r(t)pos.rotationmatrix(t)=arrayliteral([33],cos(pos.framea.phi(t)),sin(pos.framea.phi(t)),0,sin(pos.framea.phi(t)),cos(pos.framea.phi(t)),0,0,0,1)pos.r(t)=transpose(pos.rotationmatrix(t))arrayliteral([3],pos.framea.x(t)+pos.frameb.x(t),pos.frameb.y(t)pos.framea.y(t),pos.framea.phi(t)+pos.frameb.phi(t))]

Source

dyad
"""
Measures relative position and orientation between the origins of two frame connectors.

Computes frame_b - frame_a. This is a sensor component: it reads kinematic quantities
without exerting forces. Use `connect` to attach to body frames (sensor forces are zero,
so the force balance is unaffected).
"""
component RelativePosition
  extends PartialTwoFrameSensor
  frame_resolve = Frame2D() if resolve_in_frame == MultibodyComponents.ResolveInFrame.FrameResolve() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 450, "y1": -50, "x2": 550, "y2": 50, "rot": 0}
      },
      "tags": []
    }
  }
  "Relative x-position"
  rel_x = RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 120, "y1": 960, "x2": 220, "y2": 1060, "rot": 90}
      },
      "tags": []
    }
  }
  "Relative y-position"
  rel_y = RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 450, "y1": 960, "x2": 550, "y2": 1060, "rot": 90}
      },
      "tags": []
    }
  }
  "Relative rotation angle (counterclockwise)"
  rel_phi = RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 780, "y1": 960, "x2": 880, "y2": 1060, "rot": 90}
      },
      "tags": []
    }
  }
  pos = BasicRelativePosition(resolve_in_frame = resolve_in_frame)
  structural parameter resolve_in_frame::MultibodyComponents.ResolveInFrame = MultibodyComponents.ResolveInFrame.FrameA()
relations
  connect(frame_a, pos.frame_a)
  connect(frame_b, pos.frame_b)
  if resolve_in_frame == MultibodyComponents.ResolveInFrame.FrameResolve()
    connect(frame_resolve, pos.frame_resolve)
  end
  rel_x = pos.rel_x
  rel_y = pos.rel_y
  rel_phi = pos.rel_phi
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MultibodyComponents/TwoFrameSensor.svg"},
    "labels": [{"label": "rel pos", "x": 500, "y": 680, "rot": 0}]
  }
}
end
Flattened Source
dyad
"""
Measures relative position and orientation between the origins of two frame connectors.

Computes frame_b - frame_a. This is a sensor component: it reads kinematic quantities
without exerting forces. Use `connect` to attach to body frames (sensor forces are zero,
so the force balance is unaffected).
"""
component RelativePosition
  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() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 450, "y1": -50, "x2": 550, "y2": 50, "rot": 0}
      },
      "tags": []
    }
  }
  "Relative x-position"
  rel_x = RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 120, "y1": 960, "x2": 220, "y2": 1060, "rot": 90}
      },
      "tags": []
    }
  }
  "Relative y-position"
  rel_y = RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 450, "y1": 960, "x2": 550, "y2": 1060, "rot": 90}
      },
      "tags": []
    }
  }
  "Relative rotation angle (counterclockwise)"
  rel_phi = RealOutput() {
    "Dyad": {
      "placement": {
        "diagram": {"iconName": "default", "x1": 780, "y1": 960, "x2": 880, "y2": 1060, "rot": 90}
      },
      "tags": []
    }
  }
  pos = BasicRelativePosition(resolve_in_frame = resolve_in_frame)
  structural parameter resolve_in_frame::MultibodyComponents.ResolveInFrame = MultibodyComponents.ResolveInFrame.FrameA()
relations
  connect(frame_a, pos.frame_a)
  connect(frame_b, pos.frame_b)
  if resolve_in_frame == MultibodyComponents.ResolveInFrame.FrameResolve()
    connect(frame_resolve, pos.frame_resolve)
  end
  rel_x = pos.rel_x
  rel_y = pos.rel_y
  rel_phi = pos.rel_phi
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MultibodyComponents/TwoFrameSensor.svg"},
    "labels": [{"label": "rel pos", "x": 500, "y": 680, "rot": 0}]
  }
}
end


Test Cases

No test cases defined.