Skip to content
LIBRARY
World.md

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:

NameDescriptionUnitsDefault value
point_gravityWhether 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
rendertrue
ngravity direction[0, -1, 0]
ggravitational acceleration of worldm/s29.80665
muGravity field constant [m³/s²] (default = field constant of earth)3.986004418e14
nominal_lengthNominal length for scaling visualization defaults1
axis_lengthLength of the world coordinate axes in renderingnominal_length
axis_radiusRadius (shaft thickness) of the world coordinate axes in renderingnominal_length / 20
default_joint_lengthDefault length of joint shapesnominal_length / 10
default_joint_widthDefault width of joint shapesnominal_length / 20
default_body_diameterDefault diameter of body spheresnominal_length / 9
default_width_fractionDefault width fraction (width = length/fraction)20
default_arrow_diameterDefault arrow shaft diameternominal_length / 40
default_force_lengthDefault force visualization lengthnominal_length / 10
default_force_widthDefault force visualization widthnominal_length / 20
default_N_to_mDefault force arrow scaling (N/m)1000
default_Nm_to_mDefault torque arrow scaling (Nm/m)1000
default_body_colorDefault body color (RGBA)[0.60, 0.0,...19608, 1.0]
default_rod_colorDefault rod/translation color (RGBA)[0.5019608,...19608, 1.0]
default_joint_colorDefault joint color (RGBA)[1, 0, 0, 1]
default_prismatic_colorDefault prismatic joint color (RGBA)[0, 0.8, 1, 1]
default_spring_colorDefault spring color (RGBA)[0, 0, 1, 1]
default_force_colorDefault force/torque color (RGBA)[0, 1, 0, 0.5]
default_sensor_colorDefault sensor color (RGBA)[0, 1, 0, 0.5]
render_groundWhether to render the world ground planefalse
ground_axis_uUnit vector along 1st axis (u) of ground plane, resolved in world frame[1, 0, 0]
ground_length_uLength of ground plane along ground_axis_u2
ground_length_vLength of ground plane perpendicular to ground_axis_u2
ground_colorRGBA 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 several Frame

connectors that can be connected together (Frame3D)

Behavior

@example
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 #hide

Source

dyad
"""
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"
        }
      }
    ]
  }
}
end
Flattened Source
dyad
"""
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"
        }
      }
    ]
  }
}
end


Test Cases

No test cases defined.