World
The root component for all 3D multibody models.
Every model must include exactly one World component at the top level. The frame_b is fixed at the origin with identity orientation.
Global gravity parameters (n, g, mu, point_gravity) are set here and referenced by other components via gravity_acceleration.
Usage
MultibodyComponents.World(render=true, n=[0, -1, 0], g=9.80665, mu=3.986004418e14, nominal_length=1, axis_length=nominal_length, axis_radius=nominal_length / 20, default_joint_length=nominal_length / 10, default_joint_width=nominal_length / 20, default_body_diameter=nominal_length / 9, default_width_fraction=20, default_arrow_diameter=nominal_length / 40, default_force_length=nominal_length / 10, default_force_width=nominal_length / 20, default_N_to_m=1000, default_Nm_to_m=1000, default_body_color=[0.60, 0.0, 0.5019608, 1.0], default_rod_color=[0.5019608, 0.0, 0.5019608, 1.0], default_joint_color=[1, 0, 0, 1], default_prismatic_color=[0, 0.8, 1, 1], default_spring_color=[0, 0, 1, 1], default_force_color=[0, 1, 0, 0.5], default_sensor_color=[0, 1, 0, 0.5], render_ground=false, ground_axis_u=[1, 0, 0], ground_length_u=2, ground_length_v=2, ground_color=[0.784, 0.784, 0.784, 1.0])
Parameters:
| Name | Description | Units | Default value |
|---|---|---|---|
point_gravity | Whether or not to use a point-gravity field pointing towards the origin. The default is false for a parallel gravity field in the direction of n. | – | false |
render | – | true | |
n | gravity direction | – | [0, -1, 0] |
g | gravitational acceleration of world | m/s2 | 9.80665 |
mu | Gravity field constant [m³/s²] (default = field constant of earth) | – | 3.986004418e14 |
nominal_length | Nominal length for scaling visualization defaults | – | 1 |
axis_length | Length of the world coordinate axes in rendering | – | nominal_length |
axis_radius | Radius (shaft thickness) of the world coordinate axes in rendering | – | nominal_length / 20 |
default_joint_length | Default length of joint shapes | – | nominal_length / 10 |
default_joint_width | Default width of joint shapes | – | nominal_length / 20 |
default_body_diameter | Default diameter of body spheres | – | nominal_length / 9 |
default_width_fraction | Default width fraction (width = length/fraction) | – | 20 |
default_arrow_diameter | Default arrow shaft diameter | – | nominal_length / 40 |
default_force_length | Default force visualization length | – | nominal_length / 10 |
default_force_width | Default force visualization width | – | nominal_length / 20 |
default_N_to_m | Default force arrow scaling (N/m) | – | 1000 |
default_Nm_to_m | Default torque arrow scaling (Nm/m) | – | 1000 |
default_body_color | Default body color (RGBA) | – | [0.60, 0.0,...19608, 1.0] |
default_rod_color | Default rod/translation color (RGBA) | – | [0.5019608,...19608, 1.0] |
default_joint_color | Default joint color (RGBA) | – | [1, 0, 0, 1] |
default_prismatic_color | Default prismatic joint color (RGBA) | – | [0, 0.8, 1, 1] |
default_spring_color | Default spring color (RGBA) | – | [0, 0, 1, 1] |
default_force_color | Default force/torque color (RGBA) | – | [0, 1, 0, 0.5] |
default_sensor_color | Default sensor color (RGBA) | – | [0, 1, 0, 0.5] |
render_ground | Whether to render the world ground plane | – | false |
ground_axis_u | Unit vector along 1st axis (u) of ground plane, resolved in world frame | – | [1, 0, 0] |
ground_length_u | Length of ground plane along ground_axis_u | – | 2 |
ground_length_v | Length of ground plane perpendicular to ground_axis_u | – | 2 |
ground_color | RGBA color of the ground plane | – | [0.784, 0.7...0.784, 1.0] |
Connectors
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)
Behavior
using MultibodyComponents #hide
using ModelingToolkit #hide
@variables render #hide
@variables n #hide
@variables g #hide
@variables mu #hide
@variables nominal_length #hide
@variables axis_length #hide
@variables axis_radius #hide
@variables default_joint_length #hide
@variables default_joint_width #hide
@variables default_body_diameter #hide
@variables default_width_fraction #hide
@variables default_arrow_diameter #hide
@variables default_force_length #hide
@variables default_force_width #hide
@variables default_N_to_m #hide
@variables default_Nm_to_m #hide
@variables default_body_color #hide
@variables default_rod_color #hide
@variables default_joint_color #hide
@variables default_prismatic_color #hide
@variables default_spring_color #hide
@variables default_force_color #hide
@variables default_sensor_color #hide
@variables render_ground #hide
@variables ground_axis_u #hide
@variables ground_length_u #hide
@variables ground_length_v #hide
@variables ground_color #hide
@named sys = MultibodyComponents.World(render=render, n=n, g=g, mu=mu, nominal_length=nominal_length, axis_length=axis_length, axis_radius=axis_radius, default_joint_length=default_joint_length, default_joint_width=default_joint_width, default_body_diameter=default_body_diameter, default_width_fraction=default_width_fraction, default_arrow_diameter=default_arrow_diameter, default_force_length=default_force_length, default_force_width=default_force_width, default_N_to_m=default_N_to_m, default_Nm_to_m=default_Nm_to_m, default_body_color=default_body_color, default_rod_color=default_rod_color, default_joint_color=default_joint_color, default_prismatic_color=default_prismatic_color, default_spring_color=default_spring_color, default_force_color=default_force_color, default_sensor_color=default_sensor_color, render_ground=render_ground, ground_axis_u=ground_axis_u, ground_length_u=ground_length_u, ground_length_v=ground_length_v, ground_color=ground_color) #hide
let eqs = full_equations(sys); Base.length(eqs) > 25 ? nothing : eqs end #hideSource
"""
The root component for all 3D multibody models.
Every model must include exactly one World component at the top level.
The `frame_b` is fixed at the origin with identity orientation.
Global gravity parameters (`n`, `g`, `mu`, `point_gravity`) are set here
and referenced by other components via `gravity_acceleration`.
"""
external component World
frame_b = Frame3D() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 950, "y1": 450, "x2": 1050, "y2": 550, "rot": 0}
},
"tags": []
}
}
parameter render::Boolean = true
"gravity direction"
parameter n::Real[3] = [0, -1, 0]
"gravitational acceleration of world"
parameter g::Acceleration = 9.80665
"Gravity field constant [m³/s²] (default = field constant of earth)"
parameter mu::Real = 3.986004418e14
"Whether or not to use a point-gravity field pointing towards the origin. The default is false for a parallel gravity field in the direction of `n`."
structural parameter point_gravity::Boolean = false
"Nominal length for scaling visualization defaults"
parameter nominal_length::Real = 1
"Length of the world coordinate axes in rendering"
parameter axis_length::Real = nominal_length
"Radius (shaft thickness) of the world coordinate axes in rendering"
parameter axis_radius::Real = nominal_length / 20
"Default length of joint shapes"
parameter default_joint_length::Real = nominal_length / 10
"Default width of joint shapes"
parameter default_joint_width::Real = nominal_length / 20
"Default diameter of body spheres"
parameter default_body_diameter::Real = nominal_length / 9
"Default width fraction (width = length/fraction)"
parameter default_width_fraction::Real = 20
"Default arrow shaft diameter"
parameter default_arrow_diameter::Real = nominal_length / 40
"Default force visualization length"
parameter default_force_length::Real = nominal_length / 10
"Default force visualization width"
parameter default_force_width::Real = nominal_length / 20
"Default force arrow scaling (N/m)"
parameter default_N_to_m::Real = 1000
"Default torque arrow scaling (Nm/m)"
parameter default_Nm_to_m::Real = 1000
"Default body color (RGBA)"
parameter default_body_color::Real[4] = [0.60, 0.0, 0.5019608, 1.0]
"Default rod/translation color (RGBA)"
parameter default_rod_color::Real[4] = [0.5019608, 0.0, 0.5019608, 1.0]
"Default joint color (RGBA)"
parameter default_joint_color::Real[4] = [1, 0, 0, 1]
"Default prismatic joint color (RGBA)"
parameter default_prismatic_color::Real[4] = [0, 0.8, 1, 1]
"Default spring color (RGBA)"
parameter default_spring_color::Real[4] = [0, 0, 1, 1]
"Default force/torque color (RGBA)"
parameter default_force_color::Real[4] = [0, 1, 0, 0.5]
"Default sensor color (RGBA)"
parameter default_sensor_color::Real[4] = [0, 1, 0, 0.5]
"Whether to render the world ground plane"
parameter render_ground::Boolean = false
"Unit vector along 1st axis (u) of ground plane, resolved in world frame"
parameter ground_axis_u::Real[3] = [1, 0, 0]
"Length of ground plane along ground_axis_u"
parameter ground_length_u::Real = 2
"Length of ground plane perpendicular to ground_axis_u"
parameter ground_length_v::Real = 2
"RGBA color of the ground plane"
parameter ground_color::Real[4] = [0.784, 0.784, 0.784, 1.0]
relations
metadata {
"Dyad": {
"icons": {"default": "dyad://MultibodyComponents/World3D.svg"},
"labels": [
{
"label": "g = $(g)",
"x": 70,
"y": 970,
"rot": 0,
"layer": "all",
"attrs": {
"fill": "black",
"font-size": "12",
"dominant-baseline": "central",
"text-anchor": "left"
}
},
{
"label": "n = $(n)",
"x": 930,
"y": 970,
"rot": 0,
"layer": "all",
"attrs": {
"fill": "black",
"font-size": "12",
"dominant-baseline": "central",
"text-anchor": "left"
}
}
]
}
}
endFlattened Source
"""
The root component for all 3D multibody models.
Every model must include exactly one World component at the top level.
The `frame_b` is fixed at the origin with identity orientation.
Global gravity parameters (`n`, `g`, `mu`, `point_gravity`) are set here
and referenced by other components via `gravity_acceleration`.
"""
external component World
frame_b = Frame3D() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 950, "y1": 450, "x2": 1050, "y2": 550, "rot": 0}
},
"tags": []
}
}
parameter render::Boolean = true
"gravity direction"
parameter n::Real[3] = [0, -1, 0]
"gravitational acceleration of world"
parameter g::Acceleration = 9.80665
"Gravity field constant [m³/s²] (default = field constant of earth)"
parameter mu::Real = 3.986004418e14
"Whether or not to use a point-gravity field pointing towards the origin. The default is false for a parallel gravity field in the direction of `n`."
structural parameter point_gravity::Boolean = false
"Nominal length for scaling visualization defaults"
parameter nominal_length::Real = 1
"Length of the world coordinate axes in rendering"
parameter axis_length::Real = nominal_length
"Radius (shaft thickness) of the world coordinate axes in rendering"
parameter axis_radius::Real = nominal_length / 20
"Default length of joint shapes"
parameter default_joint_length::Real = nominal_length / 10
"Default width of joint shapes"
parameter default_joint_width::Real = nominal_length / 20
"Default diameter of body spheres"
parameter default_body_diameter::Real = nominal_length / 9
"Default width fraction (width = length/fraction)"
parameter default_width_fraction::Real = 20
"Default arrow shaft diameter"
parameter default_arrow_diameter::Real = nominal_length / 40
"Default force visualization length"
parameter default_force_length::Real = nominal_length / 10
"Default force visualization width"
parameter default_force_width::Real = nominal_length / 20
"Default force arrow scaling (N/m)"
parameter default_N_to_m::Real = 1000
"Default torque arrow scaling (Nm/m)"
parameter default_Nm_to_m::Real = 1000
"Default body color (RGBA)"
parameter default_body_color::Real[4] = [0.60, 0.0, 0.5019608, 1.0]
"Default rod/translation color (RGBA)"
parameter default_rod_color::Real[4] = [0.5019608, 0.0, 0.5019608, 1.0]
"Default joint color (RGBA)"
parameter default_joint_color::Real[4] = [1, 0, 0, 1]
"Default prismatic joint color (RGBA)"
parameter default_prismatic_color::Real[4] = [0, 0.8, 1, 1]
"Default spring color (RGBA)"
parameter default_spring_color::Real[4] = [0, 0, 1, 1]
"Default force/torque color (RGBA)"
parameter default_force_color::Real[4] = [0, 1, 0, 0.5]
"Default sensor color (RGBA)"
parameter default_sensor_color::Real[4] = [0, 1, 0, 0.5]
"Whether to render the world ground plane"
parameter render_ground::Boolean = false
"Unit vector along 1st axis (u) of ground plane, resolved in world frame"
parameter ground_axis_u::Real[3] = [1, 0, 0]
"Length of ground plane along ground_axis_u"
parameter ground_length_u::Real = 2
"Length of ground plane perpendicular to ground_axis_u"
parameter ground_length_v::Real = 2
"RGBA color of the ground plane"
parameter ground_color::Real[4] = [0.784, 0.784, 0.784, 1.0]
relations
metadata {
"Dyad": {
"icons": {"default": "dyad://MultibodyComponents/World3D.svg"},
"labels": [
{
"label": "g = $(g)",
"x": 70,
"y": 970,
"rot": 0,
"layer": "all",
"attrs": {
"fill": "black",
"font-size": "12",
"dominant-baseline": "central",
"text-anchor": "left"
}
},
{
"label": "n = $(n)",
"x": 930,
"y": 970,
"rot": 0,
"layer": "all",
"attrs": {
"fill": "black",
"font-size": "12",
"dominant-baseline": "central",
"text-anchor": "left"
}
}
]
}
}
endTest Cases
No test cases defined.
Related
Examples
Experiments
Analyses
Tests