Skip to content
LIBRARY
URDFBodyBox.md

URDFBodyBox

Rigid body with box visualization, for URDF import.

Combines a Body with a BoxShape that honors the URDF <visual> origin.

This component extends from Renderable

Usage

MultibodyComponents.URDFBodyBox(render=true, color=world_default_body_color(), specular_coefficient=1.5, m=1, r_cm=[0.0, 0, 0], I_11=0.001, I_22=0.001, I_33=0.001, I_21=0, I_31=0, I_32=0, r_visual=[0, 0, 0], length_direction=[1, 0, 0], width_direction=[0, 1, 0], length=1, width=1, height=1)

Parameters:

NameDescriptionUnitsDefault value
rendertrue
colorworld_defau...ody_color()
specular_coefficient1.5
mmasskg1
r_cmVector from frame_a to center of mass, resolved in frame_am[0.0, 0, 0]
I_11kg.m20.001
I_22kg.m20.001
I_33kg.m20.001
I_21kg.m20
I_31kg.m20
I_32kg.m20
r_visualCenter of box visual, resolved in frame_am[0, 0, 0]
length_directionBox length direction in frame_a (local X rotated by URDF visual rpy)[1, 0, 0]
width_directionBox width direction in frame_a (local Y rotated by URDF visual rpy)[0, 1, 0]
lengthLength of box (along local X)m1
widthWidth of box (along local Y)m1
heightHeight of box (along local Z)m1

Connectors

  • frame_a - 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

julia
using MultibodyComponents #hide
using ModelingToolkit #hide
@variables render #hide
@variables color #hide
@variables specular_coefficient #hide
@variables m #hide
@variables r_cm #hide
@variables I_11 #hide
@variables I_22 #hide
@variables I_33 #hide
@variables I_21 #hide
@variables I_31 #hide
@variables I_32 #hide
@variables r_visual #hide
@variables length_direction #hide
@variables width_direction #hide
@variables length #hide
@variables width #hide
@variables height #hide
@named sys = MultibodyComponents.URDFBodyBox(render=render, color=color, specular_coefficient=specular_coefficient, m=m, r_cm=r_cm, I_11=I_11, I_22=I_22, I_33=I_33, I_21=I_21, I_31=I_31, I_32=I_32, r_visual=r_visual, length_direction=length_direction, width_direction=width_direction, length=length, width=width, height=height) #hide
let eqs = full_equations(sys); Base.length(eqs) > 25 ? nothing : eqs end #hide
<< @example-block not executed in draft mode >>

Source

dyad
"""
Rigid body with box visualization, for URDF import.

Combines a `Body` with a `BoxShape` that honors the URDF `<visual>` origin.
"""
component URDFBodyBox
  extends Renderable(color = world_default_body_color())
  frame_a = Frame3D() {}
  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, render = false)
  box_shape = BoxShape(render = render, color = color, r = frame_a.r_0, R = transpose(frame_a.R), r_shape = r_visual - 0.5 * length * length_direction, length_direction = length_direction, width_direction = width_direction, length = length, width = width, height = height)
  "mass"
  parameter m::Mass = 1
  "Vector from frame_a to center of mass, resolved in frame_a"
  parameter r_cm::Length[3] = [0.0, 0, 0]
  parameter I_11::Inertia = 0.001
  parameter I_22::Inertia = 0.001
  parameter I_33::Inertia = 0.001
  parameter I_21::Inertia = 0
  parameter I_31::Inertia = 0
  parameter I_32::Inertia = 0
  "Center of box visual, resolved in frame_a"
  parameter r_visual::Length[3] = [0, 0, 0]
  "Box length direction in frame_a (local X rotated by URDF visual rpy)"
  parameter length_direction::Real[3] = [1, 0, 0]
  "Box width direction in frame_a (local Y rotated by URDF visual rpy)"
  parameter width_direction::Real[3] = [0, 1, 0]
  "Length of box (along local X)"
  parameter length::Length = 1
  "Width of box (along local Y)"
  parameter width::Length = 1
  "Height of box (along local Z)"
  parameter height::Length = 1
relations
  connect(frame_a, body.frame_a)
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MultibodyComponents/Body.svg"},
    "labels": [
      {
        "label": "$(instance)",
        "x": 500,
        "y": 150,
        "rot": 0,
        "attrs": {"font-size": "160"}
      }
    ]
  }
}
end
Flattened Source
dyad
"""
Rigid body with box visualization, for URDF import.

Combines a `Body` with a `BoxShape` that honors the URDF `<visual>` origin.
"""
component URDFBodyBox
  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() {}
  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, render = false)
  box_shape = BoxShape(render = render, color = color, r = frame_a.r_0, R = transpose(frame_a.R), r_shape = r_visual - 0.5 * length * length_direction, length_direction = length_direction, width_direction = width_direction, length = length, width = width, height = height)
  "mass"
  parameter m::Mass = 1
  "Vector from frame_a to center of mass, resolved in frame_a"
  parameter r_cm::Length[3] = [0.0, 0, 0]
  parameter I_11::Inertia = 0.001
  parameter I_22::Inertia = 0.001
  parameter I_33::Inertia = 0.001
  parameter I_21::Inertia = 0
  parameter I_31::Inertia = 0
  parameter I_32::Inertia = 0
  "Center of box visual, resolved in frame_a"
  parameter r_visual::Length[3] = [0, 0, 0]
  "Box length direction in frame_a (local X rotated by URDF visual rpy)"
  parameter length_direction::Real[3] = [1, 0, 0]
  "Box width direction in frame_a (local Y rotated by URDF visual rpy)"
  parameter width_direction::Real[3] = [0, 1, 0]
  "Length of box (along local X)"
  parameter length::Length = 1
  "Width of box (along local Y)"
  parameter width::Length = 1
  "Height of box (along local Z)"
  parameter height::Length = 1
relations
  connect(frame_a, body.frame_a)
metadata {
  "Dyad": {
    "icons": {"default": "dyad://MultibodyComponents/Body.svg"},
    "labels": [
      {
        "label": "$(instance)",
        "x": 500,
        "y": 150,
        "rot": 0,
        "attrs": {"font-size": "160"}
      }
    ]
  }
}
end


Test Cases

No test cases defined.

  • Examples

  • Experiments

  • Analyses