newton.utils.create_cable_stiffness_from_elastic_moduli#
- newton.utils.create_cable_stiffness_from_elastic_moduli(youngs_modulus: float, radius: float, segment_length: float) tuple[float, float][source]#
- newton.utils.create_cable_stiffness_from_elastic_moduli(youngs_modulus: float, radius: float, segment_length: float, *, poissons_ratio: float) CableStiffness
- newton.utils.create_cable_stiffness_from_elastic_moduli(youngs_modulus: float, radius: float, segment_length: float, *, shear_modulus: float) CableStiffness
Create per-joint rod/cable stiffness from elastic moduli.
For a circular cross-section, this computes material stiffnesses and converts them to the per-joint stiffness values expected by
ModelBuilder.add_rod()andModelBuilder.add_rod_graph():stretch = E * A / L[N/m]bend = E * I / L[N*m / rad]twist = G * J / L[N*m / rad] (returned only whenpoissons_ratioorshear_modulusis supplied)
where
A = pi * r^2,I = pi * r^4 / 4(area moment of inertia about a diameter),J = pi * r^4 / 2(polar moment of area), andL = segment_length. For an isotropic material with Poisson’s rationu, the shear modulus isG = E / (2 * (1 + nu)).No separate transverse shear stiffness is returned. The split cable API defaults
shear_stiffnesstostretch_stiffnesswhen omitted; pass an explicitshear_stiffnessif that default is not desired. Theshear_moduluskeyword suppliesGfor torsion/twist only.The return shape mirrors what the caller asks for:
create_cable_stiffness_from_elastic_moduli(E, r, L)returns the plain 2-tuple(stretch, bend)– twist is not derivable fromEalone, so it is omitted. Suitable for stretch-only or bend-only rods, or when the caller managestwist_stiffnessseparately.Supplying
poissons_ratioorshear_modulusswitches the return toCableStiffnesswith the additionaltwistterm. The result both unpacks as a 3-tuple and exposes named fields.stretch,.bend,.twist.
When the 2-tuple is passed through the builder without an explicit
twist_stiffness, twist defaults tobend(the combined-stiffness model). For material-consistent torsiontwist / bend = G * J / (E * I) = 1 / (1 + nu), passpoissons_ratioorshear_modulusto get the third term.- Parameters:
youngs_modulus – Young’s modulus
E[Pa = N/m^2]. Must be finite and>= 0.radius – Rod/cable radius
r[m]. Must be finite and> 0.segment_length – Per-joint rest length
L[m]. Must be finite and> 0.poissons_ratio – Poisson’s ratio
nuused to compute the shear modulusG = E / (2 * (1 + nu)). Keyword-only. Must satisfy-1 < nu < 0.5for a stable isotropic 3D material. Mutually exclusive withshear_modulus.shear_modulus – Shear modulus
G[Pa]. Keyword-only. Mutually exclusive withpoissons_ratio.
- Returns:
2-tuple
(stretch, bend)when neitherpoissons_rationorshear_modulusis supplied; otherwise aCableStiffnessNamedTuple(stretch, bend, twist).- Raises:
ValueError – if any of
youngs_modulus,radius,segment_length,poissons_ratio, orshear_modulusis non-finite or out of range, or if bothpoissons_ratioandshear_modulusare supplied.