Skip to content
LIBRARY
URDFBodyCylinder.md

URDFBodyCylinder

Rigid body with cylinder visualization, for URDF import.

Combines a Body (mass and inertia at the link frame) with a CylinderShape that honors the URDF <visual> origin (translation + rotation).

This component extends from Renderable

Usage

MultibodyComponents.URDFBodyCylinder(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=[0, 0, 1], length=1, radius=0.05)

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_11Element (1,1) of inertia tensor (in link frame)kg.m20.001
I_22Element (2,2) of inertia tensor (in link frame)kg.m20.001
I_33Element (3,3) of inertia tensor (in link frame)kg.m20.001
I_21Element (2,1) of inertia tensor (in link frame)kg.m20
I_31Element (3,1) of inertia tensor (in link frame)kg.m20
I_32Element (3,2) of inertia tensor (in link frame)kg.m20
r_visualCenter of cylinder visual, resolved in frame_am[0, 0, 0]
length_directionCylinder axis direction in frame_a (local Z rotated by URDF visual rpy)[0, 0, 1]
lengthLength of cylinderm1
radiusRadius of cylinderm0.05

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 length #hide
@variables radius #hide
@named sys = MultibodyComponents.URDFBodyCylinder(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, length=length, radius=radius) #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 cylinder visualization, for URDF import.

Combines a `Body` (mass and inertia at the link frame) with a `CylinderShape`
that honors the URDF `<visual>` origin (translation + rotation).
"""
component URDFBodyCylinder
  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)
  cylinder_shape = CylinderShape(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, length = length, width = 2 * radius, height = 2 * radius)
  "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]
  "Element (1,1) of inertia tensor (in link frame)"
  parameter I_11::Inertia = 0.001
  "Element (2,2) of inertia tensor (in link frame)"
  parameter I_22::Inertia = 0.001
  "Element (3,3) of inertia tensor (in link frame)"
  parameter I_33::Inertia = 0.001
  "Element (2,1) of inertia tensor (in link frame)"
  parameter I_21::Inertia = 0
  "Element (3,1) of inertia tensor (in link frame)"
  parameter I_31::Inertia = 0
  "Element (3,2) of inertia tensor (in link frame)"
  parameter I_32::Inertia = 0
  "Center of cylinder visual, resolved in frame_a"
  parameter r_visual::Length[3] = [0, 0, 0]
  "Cylinder axis direction in frame_a (local Z rotated by URDF visual rpy)"
  parameter length_direction::Real[3] = [0, 0, 1]
  "Length of cylinder"
  parameter length::Length = 1
  "Radius of cylinder"
  parameter radius::Length = 0.05
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 cylinder visualization, for URDF import.

Combines a `Body` (mass and inertia at the link frame) with a `CylinderShape`
that honors the URDF `<visual>` origin (translation + rotation).
"""
component URDFBodyCylinder
  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)
  cylinder_shape = CylinderShape(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, length = length, width = 2 * radius, height = 2 * radius)
  "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]
  "Element (1,1) of inertia tensor (in link frame)"
  parameter I_11::Inertia = 0.001
  "Element (2,2) of inertia tensor (in link frame)"
  parameter I_22::Inertia = 0.001
  "Element (3,3) of inertia tensor (in link frame)"
  parameter I_33::Inertia = 0.001
  "Element (2,1) of inertia tensor (in link frame)"
  parameter I_21::Inertia = 0
  "Element (3,1) of inertia tensor (in link frame)"
  parameter I_31::Inertia = 0
  "Element (3,2) of inertia tensor (in link frame)"
  parameter I_32::Inertia = 0
  "Center of cylinder visual, resolved in frame_a"
  parameter r_visual::Length[3] = [0, 0, 0]
  "Cylinder axis direction in frame_a (local Z rotated by URDF visual rpy)"
  parameter length_direction::Real[3] = [0, 0, 1]
  "Length of cylinder"
  parameter length::Length = 1
  "Radius of cylinder"
  parameter radius::Length = 0.05
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