LIBRARY
PlanarMechanics.BodyShape
Body with shape: a rigid rod (FixedTranslation) from frame_a to frame_b with a Body attached at the center of mass via a second FixedTranslation.
This component extends from PartialTwoFrames This component extends from MultibodyComponents.Renderable
Usage
MultibodyComponents.PlanarMechanics.BodyShape(render=true, color=MultibodyComponents.world_default_body_color(), specular_coefficient=1.5, r=[1, 0], r_cm=r / 2, m=1, I=0.1, radius=MultibodyComponents.world_default_body_diameter() / 2, z_position=0, l=sqrt(r[1] ^ 2 + r[2] ^ 2))
Parameters:
| Name | Description | Units | Default value |
|---|---|---|---|
render | – | true | |
color | – | MultibodyCo...ody_color() | |
specular_coefficient | – | 1.5 | |
r | Vector from frame_a to frame_b resolved in frame_a | m | [1, 0] |
r_cm | Vector from frame_a to center of mass, resolved in frame_a | m | r / 2 |
m | Mass of the body | kg | 1 |
I | Inertia of the body with respect to the center of mass | kg.m2 | 0.1 |
radius | Radius of the body in animations | – | MultibodyCo...meter() / 2 |
z_position | z-position of the body shape 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)
Behavior
Source
dyad
"""
Body with shape: a rigid rod (FixedTranslation) from frame_a to frame_b with a
Body attached at the center of mass via a second FixedTranslation.
"""
component BodyShape
extends PartialTwoFrames
extends MultibodyComponents.Renderable(color = MultibodyComponents.world_default_body_color())
translation = FixedTranslation(final r = r, render = false)
translation_cm = FixedTranslation(final r = r_cm, render = false)
body = Body(final m = m, final I = I, render = false)
"Visualization shape for the rod (cylinder from frame_a to frame_b)"
rod_shape = MultibodyComponents.CylinderShape(render = render, color = color, r = [frame_a.x, frame_a.y, z_position], length_direction = [translation.r0[1] / l, translation.r0[2] / l, 0], width_direction = [0, 0, 1], length = l, width = 2 * radius, height = 2 * radius)
"Vector from frame_a to frame_b resolved in frame_a"
parameter r::Length[2] = [1, 0]
"Vector from frame_a to center of mass, resolved in frame_a"
parameter r_cm::Length[2] = r / 2
"Mass of the body"
parameter m::Dyad.Mass = 1
"Inertia of the body with respect to the center of mass"
parameter I::MomentOfInertia = 0.1
"Radius of the body in animations"
parameter radius::Real = MultibodyComponents.world_default_body_diameter() / 2
"z-position of the body shape in animations"
parameter z_position::Real = 0
"Length of rod"
final parameter l::Length = sqrt(r[1] ^ 2 + r[2] ^ 2)
relations
connect(frame_a, translation.frame_a, translation_cm.frame_a)
connect(frame_b, translation.frame_b)
connect(translation_cm.frame_b, body.frame_a)
metadata {
"Dyad": {
"icons": {"default": "dyad://MultibodyComponents/BodyShape.svg"},
"labels": [
{
"label": "$(instance)",
"x": 500,
"y": 240,
"rot": 0,
"attrs": {"font-size": "160"}
}
]
}
}
endFlattened Source
dyad
"""
Body with shape: a rigid rod (FixedTranslation) from frame_a to frame_b with a
Body attached at the center of mass via a second FixedTranslation.
"""
component BodyShape
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
translation = FixedTranslation(final r = r, render = false)
translation_cm = FixedTranslation(final r = r_cm, render = false)
body = Body(final m = m, final I = I, render = false)
"Visualization shape for the rod (cylinder from frame_a to frame_b)"
rod_shape = MultibodyComponents.CylinderShape(render = render, color = color, r = [frame_a.x, frame_a.y, z_position], length_direction = [translation.r0[1] / l, translation.r0[2] / l, 0], width_direction = [0, 0, 1], length = l, width = 2 * radius, height = 2 * radius)
"Vector from frame_a to frame_b resolved in frame_a"
parameter r::Length[2] = [1, 0]
"Vector from frame_a to center of mass, resolved in frame_a"
parameter r_cm::Length[2] = r / 2
"Mass of the body"
parameter m::Dyad.Mass = 1
"Inertia of the body with respect to the center of mass"
parameter I::MomentOfInertia = 0.1
"Radius of the body in animations"
parameter radius::Real = MultibodyComponents.world_default_body_diameter() / 2
"z-position of the body shape in animations"
parameter z_position::Real = 0
"Length of rod"
final parameter l::Length = sqrt(r[1] ^ 2 + r[2] ^ 2)
relations
connect(frame_a, translation.frame_a, translation_cm.frame_a)
connect(frame_b, translation.frame_b)
connect(translation_cm.frame_b, body.frame_a)
metadata {
"Dyad": {
"icons": {"default": "dyad://MultibodyComponents/BodyShape.svg"},
"labels": [
{
"label": "$(instance)",
"x": 500,
"y": 240,
"rot": 0,
"attrs": {"font-size": "160"}
}
]
}
}
endTest Cases
No test cases defined.
Related
Examples
Experiments
Analyses
Tests