BodyBox
Rigid body with box shape. Mass properties are computed from the box geometry and density. Optionally hollow (inner_width/inner_height > 0). The two connector frames frame_a and frame_b are always parallel.
This component extends from Renderable
Usage
MultibodyComponents.BodyBox(render=true, color=world_default_body_color(), specular_coefficient=1.5, r=[0.1, 0, 0], r_shape=[0, 0, 0], width_dir=[0, 1, 0], width=0.3 * norm_(r - r_shape), height=width, inner_width=0, inner_height=0, density=7700, dir=r - r_shape, length=norm_(dir), mo=density * length * width * height, mi=density * length * inner_width * inner_height, m=mo - mi, r_cm=r_shape + normalize_(dir) * length / 2, R_body=from_nxy(r, width_dir), I_diag_1=(mo * (width ^ 2 + height ^ 2) - mi * (inner_width ^ 2 + inner_height ^ 2)) / 12, I_diag_2=(mo * (length ^ 2 + height ^ 2) - mi * (length ^ 2 + inner_height ^ 2)) / 12, I_diag_3=(mo * (length ^ 2 + width ^ 2) - mi * (length ^ 2 + inner_width ^ 2)) / 12, I_body=resolve_dyade1(R_body, [[I_diag_1, 0, 0], [0, I_diag_2, 0], [0, 0, I_diag_3]]), I_11=I_body[1, 1], I_22=I_body[2, 2], I_33=I_body[3, 3], I_21=I_body[2, 1], I_31=I_body[3, 1], I_32=I_body[3, 2], dir_normalized=dir / max(length, 1e-10))
Parameters:
| Name | Description | Units | Default value |
|---|---|---|---|
orientation_state | Orientation state carried by the internal body (None / Euler / Quaternion). Set to Euler or Quaternion to use this component as a freely-moving root body. | – | OrientationState.None() |
sequence | Euler-angle sequence used when orientation_state = Euler | – | [1, 2, 3] |
statePriority | State priority of the rotational state | – | 10 |
linearStatePriority | State priority of the linear (position/velocity) state | – | 1 |
render | – | true | |
color | – | world_defau...ody_color() | |
specular_coefficient | – | 1.5 | |
r | Vector from frame_a to frame_b resolved in frame_a | m | [0.1, 0, 0] |
r_shape | Vector from frame_a to box origin, resolved in frame_a | m | [0, 0, 0] |
width_dir | Vector in width direction of box, resolved in frame_a | – | [0, 1, 0] |
width | Width of box | m | 0.3 * norm_(r - r_shape) |
height | Height of box | m | width |
inner_width | Inner width of box surface (0 <= inner_width <= width) | m | 0 |
inner_height | Inner height of box surface (0 <= inner_height <= height) | m | 0 |
density | Density of box [kg/m³] | – | 7700 |
Connectors
frame_a- Frame3D is the fundamental 3D connector used for 6DOF motion. Most components have one or severalFrame
connectors that can be connected together (Frame3D)
frame_b- Frame3D is the fundamental 3D connector used for 6DOF motion. Most components have one or severalFrame
connectors that can be connected together (Frame3D)
Variables
| Name | Description | Units |
|---|---|---|
r_0 | Position vector from origin of world frame to origin of frame_a | m |
v_0 | Absolute velocity of frame_a, resolved in world frame (= D(r_0)) | m/s |
a_0 | Absolute acceleration of frame_a resolved in world frame (= D(v_0)) | m/s2 |
Behavior
Source
"""
Rigid body with box shape. Mass properties are computed from the
box geometry and density. Optionally hollow (inner_width/inner_height > 0).
The two connector frames `frame_a` and `frame_b` are always parallel.
"""
component BodyBox
extends Renderable(color = world_default_body_color())
frame_a = Frame3D() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 50, "y1": 450, "x2": 150, "y2": 550, "rot": 0}
},
"tags": []
}
}
frame_b = Frame3D() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 850, "y1": 450, "x2": 950, "y2": 550, "rot": 0}
},
"tags": []
}
}
# Sub-components
translation = FixedTranslation(final r = r, render = false)
body = Body(final m = m, final r_cm = r_cm, final I_11 = I_11, final I_22 = I_22, final I_33 = I_33, final I_21 = I_21, final I_31 = I_31, final I_32 = I_32, orientation_state = orientation_state, sequence = sequence, statePriority = statePriority, linearStatePriority = linearStatePriority, render = false)
# Visualization shape
box_shape = BoxShape(render = render, color = color, r = frame_a.r_0, R = transpose(frame_a.R), r_shape = r_shape, length_direction = dir_normalized, width_direction = width_dir, length = length, width = width, height = height)
"Orientation state carried by the internal body (None / Euler / Quaternion). Set to Euler or Quaternion to use this component as a freely-moving root body."
structural parameter orientation_state::OrientationState = OrientationState.None()
"Euler-angle sequence used when orientation_state = Euler"
structural parameter sequence::Integer[3] = [1, 2, 3]
"State priority of the rotational state"
structural parameter statePriority::Integer = 10
"State priority of the linear (position/velocity) state"
structural parameter linearStatePriority::Integer = 1
"Vector from frame_a to frame_b resolved in frame_a"
parameter r::Length[3] = [0.1, 0, 0]
"Vector from frame_a to box origin, resolved in frame_a"
parameter r_shape::Length[3] = [0, 0, 0]
"Vector in width direction of box, resolved in frame_a"
parameter width_dir::Real[3] = [0, 1, 0]
"Width of box"
parameter width::Length = 0.3 * norm_(r - r_shape)
"Height of box"
parameter height::Length = width
"Inner width of box surface (0 <= inner_width <= width)"
parameter inner_width::Length = 0
"Inner height of box surface (0 <= inner_height <= height)"
parameter inner_height::Length = 0
"Density of box [kg/m³]"
parameter density::Real = 7700
# Computed parameters
final parameter dir::Length[3] = r - r_shape
final parameter length::Length = norm_(dir)
final parameter mo::Mass = density * length * width * height
final parameter mi::Mass = density * length * inner_width * inner_height
final parameter m::Mass = mo - mi
final parameter r_cm::Length[3] = r_shape + normalize_(dir) * length / 2
final parameter R_body::Real[3, 3] = from_nxy(r, width_dir)
final parameter I_diag_1::Inertia = (mo * (width ^ 2 + height ^ 2) - mi * (inner_width ^ 2 + inner_height ^ 2)) / 12
final parameter I_diag_2::Inertia = (mo * (length ^ 2 + height ^ 2) - mi * (length ^ 2 + inner_height ^ 2)) / 12
final parameter I_diag_3::Inertia = (mo * (length ^ 2 + width ^ 2) - mi * (length ^ 2 + inner_width ^ 2)) / 12
final parameter I_body::Inertia[3, 3] = resolve_dyade1(R_body, [[I_diag_1, 0, 0], [0, I_diag_2, 0], [0, 0, I_diag_3]])
final parameter I_11::Inertia = I_body[1, 1]
final parameter I_22::Inertia = I_body[2, 2]
final parameter I_33::Inertia = I_body[3, 3]
final parameter I_21::Inertia = I_body[2, 1]
final parameter I_31::Inertia = I_body[3, 1]
final parameter I_32::Inertia = I_body[3, 2]
final parameter dir_normalized::Real[3] = dir / max(length, 1e-10)
"Position vector from origin of world frame to origin of frame_a"
variable r_0::Position[3]
"Absolute velocity of frame_a, resolved in world frame (= D(r_0))"
variable v_0::Velocity[3]
"Absolute acceleration of frame_a resolved in world frame (= D(v_0))"
variable a_0::Acceleration[3]
relations
r_0 = frame_a.r_0
v_0 = der(r_0)
a_0 = der(v_0)
connect(frame_a, translation.frame_a)
connect(frame_b, translation.frame_b)
connect(frame_a, body.frame_a)
metadata {
"Dyad": {
"icons": {"default": "dyad://MultibodyComponents/BodyBox.svg"},
"labels": [
{
"label": "$(instance)",
"x": 500,
"y": 240,
"rot": 0,
"attrs": {"font-size": "160"}
}
]
}
}
endFlattened Source
"""
Rigid body with box shape. Mass properties are computed from the
box geometry and density. Optionally hollow (inner_width/inner_height > 0).
The two connector frames `frame_a` and `frame_b` are always parallel.
"""
component BodyBox
parameter render::Boolean = true
parameter color::Real[4] = [0.5, 0.5, 0.5, 1.0]
parameter specular_coefficient::Real = 1.5
frame_a = Frame3D() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 50, "y1": 450, "x2": 150, "y2": 550, "rot": 0}
},
"tags": []
}
}
frame_b = Frame3D() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 850, "y1": 450, "x2": 950, "y2": 550, "rot": 0}
},
"tags": []
}
}
# Sub-components
translation = FixedTranslation(final r = r, render = false)
body = Body(final m = m, final r_cm = r_cm, final I_11 = I_11, final I_22 = I_22, final I_33 = I_33, final I_21 = I_21, final I_31 = I_31, final I_32 = I_32, orientation_state = orientation_state, sequence = sequence, statePriority = statePriority, linearStatePriority = linearStatePriority, render = false)
# Visualization shape
box_shape = BoxShape(render = render, color = color, r = frame_a.r_0, R = transpose(frame_a.R), r_shape = r_shape, length_direction = dir_normalized, width_direction = width_dir, length = length, width = width, height = height)
"Orientation state carried by the internal body (None / Euler / Quaternion). Set to Euler or Quaternion to use this component as a freely-moving root body."
structural parameter orientation_state::OrientationState = OrientationState.None()
"Euler-angle sequence used when orientation_state = Euler"
structural parameter sequence::Integer[3] = [1, 2, 3]
"State priority of the rotational state"
structural parameter statePriority::Integer = 10
"State priority of the linear (position/velocity) state"
structural parameter linearStatePriority::Integer = 1
"Vector from frame_a to frame_b resolved in frame_a"
parameter r::Length[3] = [0.1, 0, 0]
"Vector from frame_a to box origin, resolved in frame_a"
parameter r_shape::Length[3] = [0, 0, 0]
"Vector in width direction of box, resolved in frame_a"
parameter width_dir::Real[3] = [0, 1, 0]
"Width of box"
parameter width::Length = 0.3 * norm_(r - r_shape)
"Height of box"
parameter height::Length = width
"Inner width of box surface (0 <= inner_width <= width)"
parameter inner_width::Length = 0
"Inner height of box surface (0 <= inner_height <= height)"
parameter inner_height::Length = 0
"Density of box [kg/m³]"
parameter density::Real = 7700
# Computed parameters
final parameter dir::Length[3] = r - r_shape
final parameter length::Length = norm_(dir)
final parameter mo::Mass = density * length * width * height
final parameter mi::Mass = density * length * inner_width * inner_height
final parameter m::Mass = mo - mi
final parameter r_cm::Length[3] = r_shape + normalize_(dir) * length / 2
final parameter R_body::Real[3, 3] = from_nxy(r, width_dir)
final parameter I_diag_1::Inertia = (mo * (width ^ 2 + height ^ 2) - mi * (inner_width ^ 2 + inner_height ^ 2)) / 12
final parameter I_diag_2::Inertia = (mo * (length ^ 2 + height ^ 2) - mi * (length ^ 2 + inner_height ^ 2)) / 12
final parameter I_diag_3::Inertia = (mo * (length ^ 2 + width ^ 2) - mi * (length ^ 2 + inner_width ^ 2)) / 12
final parameter I_body::Inertia[3, 3] = resolve_dyade1(R_body, [[I_diag_1, 0, 0], [0, I_diag_2, 0], [0, 0, I_diag_3]])
final parameter I_11::Inertia = I_body[1, 1]
final parameter I_22::Inertia = I_body[2, 2]
final parameter I_33::Inertia = I_body[3, 3]
final parameter I_21::Inertia = I_body[2, 1]
final parameter I_31::Inertia = I_body[3, 1]
final parameter I_32::Inertia = I_body[3, 2]
final parameter dir_normalized::Real[3] = dir / max(length, 1e-10)
"Position vector from origin of world frame to origin of frame_a"
variable r_0::Position[3]
"Absolute velocity of frame_a, resolved in world frame (= D(r_0))"
variable v_0::Velocity[3]
"Absolute acceleration of frame_a resolved in world frame (= D(v_0))"
variable a_0::Acceleration[3]
relations
r_0 = frame_a.r_0
v_0 = der(r_0)
a_0 = der(v_0)
connect(frame_a, translation.frame_a)
connect(frame_b, translation.frame_b)
connect(frame_a, body.frame_a)
metadata {
"Dyad": {
"icons": {"default": "dyad://MultibodyComponents/BodyBox.svg"},
"labels": [
{
"label": "$(instance)",
"x": 500,
"y": 240,
"rot": 0,
"attrs": {"font-size": "160"}
}
]
}
}
endTest Cases
No test cases defined.
Related
Examples
Experiments
Analyses