LIBRARY
PlanarMechanics.FixedTranslation
A fixed translation between two components (rigid rod). The translation vector is resolved w.r.t. body frame_a at phi = 0.
This component extends from PartialTwoFrames This component extends from MultibodyComponents.Renderable
Usage
MultibodyComponents.PlanarMechanics.FixedTranslation(render=true, color=MultibodyComponents.world_default_rod_color(), specular_coefficient=1.5, r=[1, 0], l=norm(r), radius=MultibodyComponents.world_default_joint_width() / 2, z_position=0)
Parameters:
| Name | Description | Units | Default value |
|---|---|---|---|
render | – | true | |
color | – | MultibodyCo...rod_color() | |
specular_coefficient | – | 1.5 | |
r | Fixed x,y-length of the rod resolved w.r.t to body frame_a at phi = 0 | m | [1, 0] |
radius | Radius of the rod in animations | – | MultibodyCo...width() / 2 |
z_position | z-position of the rod in animations | – | 0 |
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)
Variables
| Name | Description | Units |
|---|---|---|
phi | Angle | rad |
w | Angular velocity | rad/s |
r0 | – |
Behavior
Dict{MIME{Symbol("text/plain")}, String} with 1 entry: MIME type text/plain => "Error displaying result"
Source
dyad
"""
A fixed translation between two components (rigid rod).
The translation vector is resolved w.r.t. body frame_a at phi = 0.
"""
component FixedTranslation
extends PartialTwoFrames
extends MultibodyComponents.Renderable(color = MultibodyComponents.world_default_rod_color())
"Visualization shape for the rod"
shape = MultibodyComponents.CylinderShape(render = render, color = color, r = [frame_a.x, frame_a.y, z_position], length_direction = [r0[1] / l, r0[2] / l, 0], width_direction = [0, 0, 1], length = l, width = 2 * radius, height = 2 * radius)
"Fixed x,y-length of the rod resolved w.r.t to body frame_a at phi = 0"
parameter r::Length[2] = [1, 0]
final parameter l::Length = norm(r)
"Radius of the rod in animations"
parameter radius::Real = MultibodyComponents.world_default_joint_width() / 2
"z-position of the rod in animations"
parameter z_position::Real = 0
"Angle"
variable phi::Angle
"Angular velocity"
variable w::AngularVelocity
variable r0::Real[2]
relations
phi = frame_a.phi
w = der(phi)
# rotate the rod vector by the current angle
r0 = [[cos(phi), -sin(phi)], [sin(phi), cos(phi)]] * r
# position constraint
r0 = [frame_b.x, frame_b.y] - [frame_a.x, frame_a.y]
# rigidly transfer rotation
frame_a.phi = frame_b.phi
# force balance
frame_a.fx + frame_b.fx = 0
frame_a.fy + frame_b.fy = 0
# torque balance with lever-arm contribution
frame_a.tau + frame_b.tau + dot(r0, [frame_b.fy, -frame_b.fx]) = 0
metadata {
"Dyad": {
"icons": {"default": "dyad://MultibodyComponents/FixedTranslation.svg"},
"labels": [
{
"label": "$(instance)",
"x": 500,
"y": 280,
"rot": 0,
"attrs": {"font-size": "160"}
}
]
}
}
endFlattened Source
dyad
"""
A fixed translation between two components (rigid rod).
The translation vector is resolved w.r.t. body frame_a at phi = 0.
"""
component FixedTranslation
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": []
}
}
parameter render::Boolean = true
parameter color::Real[4] = [0.5, 0.5, 0.5, 1.0]
parameter specular_coefficient::Real = 1.5
"Visualization shape for the rod"
shape = MultibodyComponents.CylinderShape(render = render, color = color, r = [frame_a.x, frame_a.y, z_position], length_direction = [r0[1] / l, r0[2] / l, 0], width_direction = [0, 0, 1], length = l, width = 2 * radius, height = 2 * radius)
"Fixed x,y-length of the rod resolved w.r.t to body frame_a at phi = 0"
parameter r::Length[2] = [1, 0]
final parameter l::Length = norm(r)
"Radius of the rod in animations"
parameter radius::Real = MultibodyComponents.world_default_joint_width() / 2
"z-position of the rod in animations"
parameter z_position::Real = 0
"Angle"
variable phi::Angle
"Angular velocity"
variable w::AngularVelocity
variable r0::Real[2]
relations
phi = frame_a.phi
w = der(phi)
# rotate the rod vector by the current angle
r0 = [[cos(phi), -sin(phi)], [sin(phi), cos(phi)]] * r
# position constraint
r0 = [frame_b.x, frame_b.y] - [frame_a.x, frame_a.y]
# rigidly transfer rotation
frame_a.phi = frame_b.phi
# force balance
frame_a.fx + frame_b.fx = 0
frame_a.fy + frame_b.fy = 0
# torque balance with lever-arm contribution
frame_a.tau + frame_b.tau + dot(r0, [frame_b.fy, -frame_b.fx]) = 0
metadata {
"Dyad": {
"icons": {"default": "dyad://MultibodyComponents/FixedTranslation.svg"},
"labels": [
{
"label": "$(instance)",
"x": 500,
"y": 280,
"rot": 0,
"attrs": {"font-size": "160"}
}
]
}
}
endTest Cases
No test cases defined.