PlanarMechanics.BasicRelativePosition
Measures relative position and orientation (frame_b - frame_a) resolved in a configurable frame. Internal helper used by RelativePosition and by velocity/acceleration sensors.
This component extends from PartialTwoFrameSensor
Usage
MultibodyComponents.PlanarMechanics.BasicRelativePosition()
Parameters:
| Name | Description | Units | Default value |
|---|---|---|---|
resolve_in_frame | – | MultibodyComponents.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)
Variables
| Name | Description | Units |
|---|---|---|
rotation_matrix | – | |
r | – |
Behavior
Dict{MIME{Symbol("text/plain")}, String} with 1 entry: MIME type text/plain => "Error displaying result"
Source
"""
Measures relative position and orientation (frame_b - frame_a) resolved in a
configurable frame. Internal helper used by RelativePosition and by
velocity/acceleration sensors.
"""
component BasicRelativePosition
extends PartialTwoFrameSensor
frame_resolve = Frame2D() if resolve_in_frame == MultibodyComponents.ResolveInFrame.FrameResolve() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 950, "y1": 30, "x2": 1050, "y2": 130, "rot": 0}
},
"tags": []
}
}
rel_x = RealOutput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 130, "y1": 970, "x2": 230, "y2": 1070, "rot": 90}
},
"tags": []
}
}
rel_y = RealOutput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 450, "y1": 960, "x2": 550, "y2": 1060, "rot": 90}
},
"tags": []
}
}
rel_phi = RealOutput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 770, "y1": 960, "x2": 870, "y2": 1060, "rot": 90}
},
"tags": []
}
}
structural parameter resolve_in_frame::MultibodyComponents.ResolveInFrame = MultibodyComponents.ResolveInFrame.FrameA()
variable rotation_matrix::Real[3, 3] if resolve_in_frame != MultibodyComponents.ResolveInFrame.World()
variable r::Real[3]
relations
frame_a.fx = 0
frame_a.fy = 0
frame_a.tau = 0
frame_b.fx = 0
frame_b.fy = 0
frame_b.tau = 0
if resolve_in_frame == MultibodyComponents.ResolveInFrame.World()
r = [frame_b.x - frame_a.x, frame_b.y - frame_a.y, frame_b.phi - frame_a.phi]
end
if resolve_in_frame == MultibodyComponents.ResolveInFrame.FrameA()
rotation_matrix = [[cos(frame_a.phi), -sin(frame_a.phi), 0], [sin(frame_a.phi), cos(frame_a.phi), 0], [0, 0, 1]]
r = transpose(rotation_matrix) * [frame_b.x - frame_a.x, frame_b.y - frame_a.y, frame_b.phi - frame_a.phi]
end
if resolve_in_frame == MultibodyComponents.ResolveInFrame.FrameB()
rotation_matrix = [[cos(frame_b.phi), -sin(frame_b.phi), 0], [sin(frame_b.phi), cos(frame_b.phi), 0], [0, 0, 1]]
r = transpose(rotation_matrix) * [frame_b.x - frame_a.x, frame_b.y - frame_a.y, frame_b.phi - frame_a.phi]
end
if resolve_in_frame == MultibodyComponents.ResolveInFrame.FrameResolve()
frame_resolve.fx = 0
frame_resolve.fy = 0
frame_resolve.tau = 0
rotation_matrix = [[cos(frame_resolve.phi), -sin(frame_resolve.phi), 0], [sin(frame_resolve.phi), cos(frame_resolve.phi), 0], [0, 0, 1]]
r = transpose(rotation_matrix) * [frame_b.x - frame_a.x, frame_b.y - frame_a.y, frame_b.phi - frame_a.phi]
end
[rel_x, rel_y, rel_phi] = r
endFlattened Source
"""
Measures relative position and orientation (frame_b - frame_a) resolved in a
configurable frame. Internal helper used by RelativePosition and by
velocity/acceleration sensors.
"""
component BasicRelativePosition
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": 950, "y1": 30, "x2": 1050, "y2": 130, "rot": 0}
},
"tags": []
}
}
rel_x = RealOutput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 130, "y1": 970, "x2": 230, "y2": 1070, "rot": 90}
},
"tags": []
}
}
rel_y = RealOutput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 450, "y1": 960, "x2": 550, "y2": 1060, "rot": 90}
},
"tags": []
}
}
rel_phi = RealOutput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 770, "y1": 960, "x2": 870, "y2": 1060, "rot": 90}
},
"tags": []
}
}
structural parameter resolve_in_frame::MultibodyComponents.ResolveInFrame = MultibodyComponents.ResolveInFrame.FrameA()
variable rotation_matrix::Real[3, 3] if resolve_in_frame != MultibodyComponents.ResolveInFrame.World()
variable r::Real[3]
relations
frame_a.fx = 0
frame_a.fy = 0
frame_a.tau = 0
frame_b.fx = 0
frame_b.fy = 0
frame_b.tau = 0
if resolve_in_frame == MultibodyComponents.ResolveInFrame.World()
r = [frame_b.x - frame_a.x, frame_b.y - frame_a.y, frame_b.phi - frame_a.phi]
end
if resolve_in_frame == MultibodyComponents.ResolveInFrame.FrameA()
rotation_matrix = [[cos(frame_a.phi), -sin(frame_a.phi), 0], [sin(frame_a.phi), cos(frame_a.phi), 0], [0, 0, 1]]
r = transpose(rotation_matrix) * [frame_b.x - frame_a.x, frame_b.y - frame_a.y, frame_b.phi - frame_a.phi]
end
if resolve_in_frame == MultibodyComponents.ResolveInFrame.FrameB()
rotation_matrix = [[cos(frame_b.phi), -sin(frame_b.phi), 0], [sin(frame_b.phi), cos(frame_b.phi), 0], [0, 0, 1]]
r = transpose(rotation_matrix) * [frame_b.x - frame_a.x, frame_b.y - frame_a.y, frame_b.phi - frame_a.phi]
end
if resolve_in_frame == MultibodyComponents.ResolveInFrame.FrameResolve()
frame_resolve.fx = 0
frame_resolve.fy = 0
frame_resolve.tau = 0
rotation_matrix = [[cos(frame_resolve.phi), -sin(frame_resolve.phi), 0], [sin(frame_resolve.phi), cos(frame_resolve.phi), 0], [0, 0, 1]]
r = transpose(rotation_matrix) * [frame_b.x - frame_a.x, frame_b.y - frame_a.y, frame_b.phi - frame_a.phi]
end
[rel_x, rel_y, rel_phi] = r
metadata {
"Dyad": {"icons": {"default": "dyad://MultibodyComponents/TwoFrameSensor.svg"}}
}
endTest Cases
No test cases defined.
Related
Examples
Experiments
Analyses