Cable Object#
Use CableObject for a rope, wire, or hose represented by
oriented capsule segments. Segment orientation carries material twist, and
each segment has both linear and angular velocity.
Cables require Newton with DexUni on CUDA and gradients disabled. Declare
the physical scene before sim.prepare(). The current cable reset path
requires a separate scene from fluid, cloth, or soft-body particles. See
Newton Runtime Qualification for solver support.
Configuration#
Pass CableObjectCfg to sim.add_cable_object(cfg).
Field |
Default |
Meaning |
|---|---|---|
|
Required |
Unique manager-scoped asset identifier. |
|
Required |
Ordered centreline endpoints |
|
Required |
Positive segment radius in metres. |
|
|
Optional material frames in |
|
|
Request a closed cable through the native descriptor. |
|
|
Segment indices held fixed at their authored placement. |
|
|
Native filtering span for neighboring cable segments. |
|
|
Density, stretch, shear, bend, twist, damping, and contact properties. |
|
|
Permanent endpoint attachments through |
|
|
Generated appearance, either |
|
|
Generated-surface material or a custom visual mesh. |
CablePhysicsCfg uses stiffness and damping coefficients per connection.
Linear stiffness uses N/m and angular stiffness uses N m/rad. An omitted
coefficient inherits the solver value. Contact settings use
attrs.collision_props and attrs.material_props. Material changes and
physical topology changes require constructing a new simulation.
Setup and initialization#
This headless example creates a three-segment cable in two environments. It reads the prepared segment state and applies a force to the final segment in environment zero for one outer update.
from embodichain.lab.sim import SimulationManager, SimulationManagerCfg
from embodichain.lab.sim.cfg import CableObjectCfg, NewtonPhysicsCfg, RenderCfg
sim = SimulationManager(
SimulationManagerCfg(
headless=True,
num_envs=2,
physics_cfg=NewtonPhysicsCfg(
device="cuda:0",
physics_dt=1 / 120,
num_substeps=2,
solver_cfg={"solver_type": "dexuni"},
),
render_cfg=RenderCfg(renderer="no-render"),
)
)
try:
cable = sim.add_cable_object(
CableObjectCfg(
uid="wire",
points=[(0, 0, 0), (0, 0, 0.1), (0, 0, 0.2), (0, 0, 0.3)],
radius=0.01,
init_pos=(0.0, 0.0, 0.5),
)
)
sim.prepare()
state = cable.data.segment_state_w # (2, 3, 13)
cable.set_force([0.0, 0.1, 0.0], segment_index=-1, env_ids=[0])
sim.update(step=1, render_final_step=False)
sim.reset_objects_state(env_ids=[0])
finally:
sim.destroy(exit_process=False)
SimulationManager.flush_cleanup_queue()
Segment state and loads#
After preparation, cable.data returns independent snapshots. World
positions already include each environment’s origin. Let E be the batch
instance count and S = cable.data.num_segments.
Property |
Shape |
Meaning |
|---|---|---|
|
|
Segment COM position and |
|
|
Position and material frame. |
|
|
World linear velocity followed by angular velocity. |
|
|
Position, quaternion, linear velocity, and angular velocity in one snapshot. |
|
|
Immutable creation state. |
set_force() applies world-frame COM force in newtons, and set_torque()
applies world-frame torque in N m. Both accept a three-vector or one vector
per selected environment. Negative segment indices count from the tip.
Loads clear automatically after the next outer update. Call
clear_wrenches(env_ids=...) to discard pending loads before that update.
State writes and reset#
To initialize a perturbed cable after a scene reset, edit the selected
segment-state snapshot and call
write_segment_state_to_sim(state, env_ids=...). Input must be a finite,
contiguous float32 tensor (selected E, S, 13) on the cable device with
unit quaternions. Keep permanent attachment anchors consistent.
Segment writes clear solver history in the affected owning worlds, including history belonging to other cables. Controls and pending loads are preserved. Contact measurements become current after another physics update.
cable.reset(env_ids=...) restores that cable’s creation state and clears
its loads. For an episode reset including attached robots, other physical
assets, targets, and supported controls, call
sim.reset_objects_state(env_ids=...). This path resets all physical
assets in the selected environments together. Runtime material changes are
outside its reset contract.
Attachments and imported cables#
CableAttachmentCfg names a target uid, a body-local position, and
an optional link_name for an articulation. The cable endpoint must
coincide with the target anchor at preparation. These attachments are
permanent welds authored before preparation. The current engine rejects
attachments to articulations with nonzero initial joint poses.
sim.add_usd(UsdImportCfg(...)) also returns cable objects under their
source resource keys. Imported and procedural cables expose the same
state and reset methods. Keep simulation resources alive until manager
teardown, which releases the owning scene.