PlanarMechanics.TransformAbsoluteVector
Rotates an absolute vector between frames via a two-step rotation through the world frame: input frame -> world -> output frame. Supports World, FrameA, and FrameResolve. Uses the R1[3,4] matrix approach from Multibody.jl to handle both rotational and translational (phi offset) components.
Usage
MultibodyComponents.PlanarMechanics.TransformAbsoluteVector()
Parameters:
| Name | Description | Units | Default value |
|---|---|---|---|
frame_in | – | MultibodyComponents.ResolveInFrame.FrameA() | |
frame_out | – | 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_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)
x_in- This connector represents a real signal as an input to a component (RealInput)y_in- This connector represents a real signal as an input to a component (RealInput)phi_in- This connector represents a real signal as an input to a component (RealInput)x_out- This connector represents a real signal as an output from a component (RealOutput)y_out- This connector represents a real signal as an output from a component (RealOutput)phi_out- This connector represents a real signal as an output from a component (RealOutput)
Variables
| Name | Description | Units |
|---|---|---|
R1 | – | |
rotation_matrix | – | |
r_temp | – | |
r | – |
Behavior
Source
"""
Rotates an absolute vector between frames via a two-step rotation through the
world frame: input frame -> world -> output frame. Supports World, FrameA,
and FrameResolve. Uses the R1[3,4] matrix approach from Multibody.jl to handle
both rotational and translational (phi offset) components.
"""
component TransformAbsoluteVector
frame_a = Frame2D() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 450, "y1": 950, "x2": 550, "y2": 1050, "rot": 0}
},
"tags": []
}
}
frame_resolve = Frame2D() if (frame_in == MultibodyComponents.ResolveInFrame.FrameResolve()) or (frame_out == MultibodyComponents.ResolveInFrame.FrameResolve()) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 450, "y1": -40, "x2": 550, "y2": 60, "rot": 0}
},
"tags": []
}
}
x_in = RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -40, "y1": 140, "x2": 60, "y2": 240, "rot": 0}
},
"tags": []
}
}
y_in = RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -40, "y1": 450, "x2": 60, "y2": 550, "rot": 0}
},
"tags": []
}
}
phi_in = RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -40, "y1": 760, "x2": 60, "y2": 860, "rot": 0}
},
"tags": []
}
}
x_out = RealOutput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 960, "y1": 140, "x2": 1060, "y2": 240, "rot": 0}
},
"tags": []
}
}
y_out = RealOutput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 960, "y1": 450, "x2": 1060, "y2": 550, "rot": 0}
},
"tags": []
}
}
phi_out = RealOutput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 960, "y1": 770, "x2": 1060, "y2": 870, "rot": 0}
},
"tags": []
}
}
structural parameter frame_in::MultibodyComponents.ResolveInFrame = MultibodyComponents.ResolveInFrame.FrameA()
structural parameter frame_out::MultibodyComponents.ResolveInFrame = MultibodyComponents.ResolveInFrame.FrameA()
variable R1::Real[3, 4] if frame_out != frame_in
variable rotation_matrix::Real[3, 3] if frame_out != frame_in
variable r_temp::Real[3] if frame_out != frame_in
variable r::Real[3] if frame_out != frame_in
relations
frame_a.fx = 0
frame_a.fy = 0
frame_a.tau = 0
if (frame_in == MultibodyComponents.ResolveInFrame.FrameResolve()) or (frame_out == MultibodyComponents.ResolveInFrame.FrameResolve())
frame_resolve.fx = 0
frame_resolve.fy = 0
frame_resolve.tau = 0
end
if frame_out == frame_in
x_out = x_in
y_out = y_in
phi_out = phi_in
else
if frame_in == MultibodyComponents.ResolveInFrame.World()
R1 = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0]]
end
if frame_in == MultibodyComponents.ResolveInFrame.FrameA()
R1 = [[cos(frame_a.phi), -sin(frame_a.phi), 0, 0], [sin(frame_a.phi), cos(frame_a.phi), 0, 0], [0, 0, 1, frame_a.phi]]
end
if frame_in == MultibodyComponents.ResolveInFrame.FrameResolve()
R1 = [[cos(frame_resolve.phi), -sin(frame_resolve.phi), 0, 0], [sin(frame_resolve.phi), cos(frame_resolve.phi), 0, 0], [0, 0, 1, frame_resolve.phi]]
end
r_temp = R1 * [x_in, y_in, phi_in, 1]
if frame_out == MultibodyComponents.ResolveInFrame.World()
rotation_matrix = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
r = r_temp
end
if frame_out == 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 = rotation_matrix * r_temp
end
if frame_out == MultibodyComponents.ResolveInFrame.FrameResolve()
rotation_matrix = [[cos(frame_resolve.phi), sin(frame_resolve.phi), 0], [-sin(frame_resolve.phi), cos(frame_resolve.phi), 0], [0, 0, 1]]
r = rotation_matrix * r_temp
end
[x_out, y_out, phi_out] = r
end
endFlattened Source
"""
Rotates an absolute vector between frames via a two-step rotation through the
world frame: input frame -> world -> output frame. Supports World, FrameA,
and FrameResolve. Uses the R1[3,4] matrix approach from Multibody.jl to handle
both rotational and translational (phi offset) components.
"""
component TransformAbsoluteVector
frame_a = Frame2D() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 450, "y1": 950, "x2": 550, "y2": 1050, "rot": 0}
},
"tags": []
}
}
frame_resolve = Frame2D() if (frame_in == MultibodyComponents.ResolveInFrame.FrameResolve()) or (frame_out == MultibodyComponents.ResolveInFrame.FrameResolve()) {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 450, "y1": -40, "x2": 550, "y2": 60, "rot": 0}
},
"tags": []
}
}
x_in = RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -40, "y1": 140, "x2": 60, "y2": 240, "rot": 0}
},
"tags": []
}
}
y_in = RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -40, "y1": 450, "x2": 60, "y2": 550, "rot": 0}
},
"tags": []
}
}
phi_in = RealInput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -40, "y1": 760, "x2": 60, "y2": 860, "rot": 0}
},
"tags": []
}
}
x_out = RealOutput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 960, "y1": 140, "x2": 1060, "y2": 240, "rot": 0}
},
"tags": []
}
}
y_out = RealOutput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 960, "y1": 450, "x2": 1060, "y2": 550, "rot": 0}
},
"tags": []
}
}
phi_out = RealOutput() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 960, "y1": 770, "x2": 1060, "y2": 870, "rot": 0}
},
"tags": []
}
}
structural parameter frame_in::MultibodyComponents.ResolveInFrame = MultibodyComponents.ResolveInFrame.FrameA()
structural parameter frame_out::MultibodyComponents.ResolveInFrame = MultibodyComponents.ResolveInFrame.FrameA()
variable R1::Real[3, 4] if frame_out != frame_in
variable rotation_matrix::Real[3, 3] if frame_out != frame_in
variable r_temp::Real[3] if frame_out != frame_in
variable r::Real[3] if frame_out != frame_in
relations
frame_a.fx = 0
frame_a.fy = 0
frame_a.tau = 0
if (frame_in == MultibodyComponents.ResolveInFrame.FrameResolve()) or (frame_out == MultibodyComponents.ResolveInFrame.FrameResolve())
frame_resolve.fx = 0
frame_resolve.fy = 0
frame_resolve.tau = 0
end
if frame_out == frame_in
x_out = x_in
y_out = y_in
phi_out = phi_in
else
if frame_in == MultibodyComponents.ResolveInFrame.World()
R1 = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0]]
end
if frame_in == MultibodyComponents.ResolveInFrame.FrameA()
R1 = [[cos(frame_a.phi), -sin(frame_a.phi), 0, 0], [sin(frame_a.phi), cos(frame_a.phi), 0, 0], [0, 0, 1, frame_a.phi]]
end
if frame_in == MultibodyComponents.ResolveInFrame.FrameResolve()
R1 = [[cos(frame_resolve.phi), -sin(frame_resolve.phi), 0, 0], [sin(frame_resolve.phi), cos(frame_resolve.phi), 0, 0], [0, 0, 1, frame_resolve.phi]]
end
r_temp = R1 * [x_in, y_in, phi_in, 1]
if frame_out == MultibodyComponents.ResolveInFrame.World()
rotation_matrix = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
r = r_temp
end
if frame_out == 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 = rotation_matrix * r_temp
end
if frame_out == MultibodyComponents.ResolveInFrame.FrameResolve()
rotation_matrix = [[cos(frame_resolve.phi), sin(frame_resolve.phi), 0], [-sin(frame_resolve.phi), cos(frame_resolve.phi), 0], [0, 0, 1]]
r = rotation_matrix * r_temp
end
[x_out, y_out, phi_out] = r
end
metadata {}
endTest Cases
No test cases defined.
Related
Examples
Experiments
Analyses