Cable
Cable / rope of total length l and mass m, modeled as n rigid BodyShape segments connected by 3-DOF Spherical joints, matching the Multibody.jl Rope.
When end_joints = true (default), the topology uses n + 1 joints: frame_a → S₁ → link₁ → S₂ → … → Sₙ → linkₙ → Sₙ₊₁ → frame_b
When end_joints = false, only the n − 1 internal joints are kept and both ends attach rigidly to the adjacent frame: frame_a → link₁ → S₁ → link₂ → … → Sₙ₋₁ → linkₙ → frame_b
Each Spherical joint uses quaternion state (Euler-angle state hits a structural-simplify cycle when chained — SciML/ModelingToolkit.jl#4608) and transmits no torque. The cable starts straight (along dir); seed an initial bend by setting a joint's non-unit quaternion Q_hat as an initial condition, e.g. a 0.9 rad bend about x on the first joint: cable.joints[1].Q_hat = [cos(0.45), sin(0.45), 0, 0].
This component extends from PartialTwoFrames This component extends from Renderable
Usage
MultibodyComponents.Cable(render=true, color=[0.5, 0.4, 0.4, 1], specular_coefficient=1.5, l=1, m=1, dir=[0, -1, 0], radius=0.05, r_segment=(l / n) * (dir / norm_(dir)), m_segment=m / n)
Parameters:
| Name | Description | Units | Default value |
|---|---|---|---|
orientation_state | – | Orientation...uaternion() | |
n | Number of rigid segments | – | 5 |
end_joints | Include Spherical joints at both ends (frame_a and frame_b) | – | true |
nj | Number of joints | – | ifelse(end_...+ 1, n - 1) |
render | – | true | |
color | – | [0.5, 0.4, 0.4, 1] | |
specular_coefficient | – | 1.5 | |
l | Total unstretched length of the rope | m | 1 |
m | Total mass of the rope (each segment gets m/n) | kg | 1 |
dir | Hanging direction; unit-normalized internally | – | [0, -1, 0] |
radius | Rendering radius of each segment | – | 0.05 |
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)
Behavior
Source
"""
Cable / rope of total length `l` and mass `m`, modeled as `n` rigid
`BodyShape` segments connected by 3-DOF `Spherical` joints, matching the
Multibody.jl `Rope`.
When `end_joints = true` (default), the topology uses `n + 1` joints:
`frame_a → S₁ → link₁ → S₂ → … → Sₙ → linkₙ → Sₙ₊₁ → frame_b`
When `end_joints = false`, only the `n − 1` internal joints are kept and
both ends attach rigidly to the adjacent frame:
`frame_a → link₁ → S₁ → link₂ → … → Sₙ₋₁ → linkₙ → frame_b`
Each `Spherical` joint uses quaternion state (Euler-angle state hits a
structural-simplify cycle when chained — SciML/ModelingToolkit.jl#4608) and
transmits no torque. The cable starts straight (along `dir`); seed an initial
bend by setting a joint's non-unit quaternion `Q_hat` as an initial condition,
e.g. a 0.9 rad bend about x on the first joint:
`cable.joints[1].Q_hat = [cos(0.45), sin(0.45), 0, 0]`.
"""
component Cable
extends PartialTwoFrames()
extends Renderable(color = [0.5, 0.4, 0.4, 1])
joints = [MultibodyComponents.Spherical(orientation_state = orientation_state, render = false) for i in 1:nj]
links = [MultibodyComponents.BodyShape(r = r_segment, m = m_segment, color = color, radius = radius) for i in 1:n]
structural parameter orientation_state::MultibodyComponents.OrientationState = OrientationState.Quaternion()
"Number of rigid segments"
structural parameter n::Integer = 5
"Include Spherical joints at both ends (frame_a and frame_b)"
structural parameter end_joints::Boolean = true
"Number of joints"
final structural parameter nj::Integer = ifelse(end_joints, n + 1, n - 1)
"Total unstretched length of the rope"
parameter l::Length = 1
"Total mass of the rope (each segment gets m/n)"
parameter m::Mass = 1
"Hanging direction; unit-normalized internally"
parameter dir::Real[3] = [0, -1, 0]
"Rendering radius of each segment"
parameter radius::Real = 0.05
final parameter r_segment::Length[3] = (l / n) * (dir / norm_(dir))
final parameter m_segment::Mass = m / n
relations
if end_joints
connect(frame_a, joints[1].frame_a)
for i in 1:n
connect(joints[i].frame_b, links[i].frame_a)
connect(links[i].frame_b, joints[i + 1].frame_a)
end
connect(joints[nj].frame_b, frame_b)
else
connect(frame_a, links[1].frame_a)
for i in 1:nj
connect(links[i].frame_b, joints[i].frame_a)
connect(joints[i].frame_b, links[i + 1].frame_a)
end
connect(links[n].frame_b, frame_b)
end
metadata {
"Dyad": {
"icons": {"default": "dyad://MultibodyComponents/Cable.svg"},
"labels": [
{
"label": "$(instance)",
"x": 500,
"y": 150,
"rot": 0,
"attrs": {"font-size": "160"}
}
]
}
}
endFlattened Source
"""
Cable / rope of total length `l` and mass `m`, modeled as `n` rigid
`BodyShape` segments connected by 3-DOF `Spherical` joints, matching the
Multibody.jl `Rope`.
When `end_joints = true` (default), the topology uses `n + 1` joints:
`frame_a → S₁ → link₁ → S₂ → … → Sₙ → linkₙ → Sₙ₊₁ → frame_b`
When `end_joints = false`, only the `n − 1` internal joints are kept and
both ends attach rigidly to the adjacent frame:
`frame_a → link₁ → S₁ → link₂ → … → Sₙ₋₁ → linkₙ → frame_b`
Each `Spherical` joint uses quaternion state (Euler-angle state hits a
structural-simplify cycle when chained — SciML/ModelingToolkit.jl#4608) and
transmits no torque. The cable starts straight (along `dir`); seed an initial
bend by setting a joint's non-unit quaternion `Q_hat` as an initial condition,
e.g. a 0.9 rad bend about x on the first joint:
`cable.joints[1].Q_hat = [cos(0.45), sin(0.45), 0, 0]`.
"""
component Cable
frame_a = Frame3D() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": -50, "y1": 450, "x2": 50, "y2": 550, "rot": 0}
},
"tags": []
}
}
frame_b = Frame3D() {
"Dyad": {
"placement": {
"diagram": {"iconName": "default", "x1": 950, "y1": 450, "x2": 1050, "y2": 550, "rot": 0}
},
"tags": []
}
}
parameter render::Boolean = true
parameter color::Real[4] = [0.5, 0.5, 0.5, 1.0]
parameter specular_coefficient::Real = 1.5
joints = [MultibodyComponents.Spherical(orientation_state = orientation_state, render = false) for i in 1:nj]
links = [MultibodyComponents.BodyShape(r = r_segment, m = m_segment, color = color, radius = radius) for i in 1:n]
structural parameter orientation_state::MultibodyComponents.OrientationState = OrientationState.Quaternion()
"Number of rigid segments"
structural parameter n::Integer = 5
"Include Spherical joints at both ends (frame_a and frame_b)"
structural parameter end_joints::Boolean = true
"Number of joints"
final structural parameter nj::Integer = ifelse(end_joints, n + 1, n - 1)
"Total unstretched length of the rope"
parameter l::Length = 1
"Total mass of the rope (each segment gets m/n)"
parameter m::Mass = 1
"Hanging direction; unit-normalized internally"
parameter dir::Real[3] = [0, -1, 0]
"Rendering radius of each segment"
parameter radius::Real = 0.05
final parameter r_segment::Length[3] = (l / n) * (dir / norm_(dir))
final parameter m_segment::Mass = m / n
relations
if end_joints
connect(frame_a, joints[1].frame_a)
for i in 1:n
connect(joints[i].frame_b, links[i].frame_a)
connect(links[i].frame_b, joints[i + 1].frame_a)
end
connect(joints[nj].frame_b, frame_b)
else
connect(frame_a, links[1].frame_a)
for i in 1:nj
connect(links[i].frame_b, joints[i].frame_a)
connect(joints[i].frame_b, links[i + 1].frame_a)
end
connect(links[n].frame_b, frame_b)
end
metadata {
"Dyad": {
"icons": {"default": "dyad://MultibodyComponents/Cable.svg"},
"labels": [
{
"label": "$(instance)",
"x": 500,
"y": 150,
"rot": 0,
"attrs": {"font-size": "160"}
}
]
}
}
endTest Cases
No test cases defined.
Related
Examples
Experiments
Analyses
Tests