Elements¶
- class urdfgenpy.Origin(xyz=(0.0, 0.0, 0.0), rpy=(0.0, 0.0, 0.0))[source]¶
Bases:
objectPose of a link or joint relative to its parent frame.
- Parameters:
- classmethod above(geometry, xy=(0.0, 0.0), rpy=(0.0, 0.0, 0.0))[source]¶
Return an origin that lifts geometry so its bottom sits at z=0.
Computes the Z offset as half the height for a :class:’~urdfgenpy.Box’, half the length for a :class:’~urdfgenpy.Cylinder’, or the radius for a :class:’~urdfgenpy.Sphere’.
- Parameters:
- Return type:
- Returns:
An – class:’Origin’ with Z set so the geometry rests on the XY plane.
- Raises:
ValueError – If geometry is not a supported primitive type.
- class urdfgenpy.Material(name, rgba=None, texture=None)[source]¶
Bases:
objectVisual material - colour or texture.
- Parameters:
- class urdfgenpy.Visual(geometry, origin=<factory>, material=None, name=None)[source]¶
Bases:
objectRendered appearance of a link.
- Parameters:
- class urdfgenpy.Collision(geometry, origin=<factory>, name=None)[source]¶
Bases:
objectCollision shape of a link used by physics engines.
- Parameters:
- class urdfgenpy.Inertial(mass, matrix, origin=<factory>)[source]¶
Bases:
objectMass and inertia of a link.
Prefer the factory class methods over direct construction:
:meth:’from_geometry’ - auto-dispatch from any supported geometry
:meth:’from_box’, :meth:’from_cylinder’, :meth:’from_sphere’
- Parameters:
mass (
float) – Mass in kg.matrix (
InertiaMatrix) – 3x3 symmetric inertia tensor (upper triangle).origin (
Origin) – Pose of the centre of mass relative to the link frame.
-
matrix:
InertiaMatrix¶
- classmethod from_box(mass, length, w, h, origin=None, inertia_multiply=1.0)[source]¶
Create an :class:’Inertial’ for a solid box.
- Parameters:
mass (
float) – Mass in kg.length (
float) – Dimension along X (metres).w (
float) – Dimension along Y (metres).h (
float) – Dimension along Z (metres).origin (
Optional[Origin]) – Pose of the centre of mass; defaults to the link frame origin.inertia_multiply (
float) – Scalar multiplier on all inertia components (default 1.0).
- Return type:
- Returns:
An – class:’Inertial’ with analytically computed box inertia.
- classmethod from_sphere(mass, radius, origin=None, inertia_multiply=1.0)[source]¶
Create an :class:’Inertial’ for a solid sphere.
- Parameters:
- Return type:
- Returns:
An – class:’Inertial’ with analytically computed sphere inertia.
- classmethod from_cylinder(mass, radius, length, origin=None, inertia_multiply=1.0)[source]¶
Create an :class:’Inertial’ for a solid cylinder.
- Parameters:
mass (
float) – Mass in kg.radius (
float) – Cylinder radius in metres.length (
float) – Cylinder length (height) in metres.origin (
Optional[Origin]) – Pose of the centre of mass; defaults to the link frame origin.inertia_multiply (
float) – Scalar multiplier on all inertia components (default 1.0).
- Return type:
- Returns:
An – class:’Inertial’ with analytically computed cylinder inertia.
- classmethod from_geometry(mass, geometry, origin=None, inertia_multiply=1.0)[source]¶
Create an :class:’Inertial’ by dispatching on the geometry type.
Delegates to :meth:’from_box’, :meth:’from_sphere’, or :meth:’from_cylinder’ based on the runtime type of geometry.
- Parameters:
mass (
float) – Mass in kg.geometry (
Box|Cylinder|Sphere) – A :class:’Box’, :class:’Cylinder’, or :class:’Sphere’ instance.origin (
Optional[Origin]) – Pose of the centre of mass; defaults to the link frame origin.inertia_multiply (
float) – Scalar multiplier on all inertia components (default 1.0).
- Return type:
- Returns:
An – class:’Inertial’ with analytically computed inertia.
- Raises:
ValueError – If geometry is not a supported primitive type.