Kinematics

Kinematics backend of Pinker.

This module implements the kinematics functions used by Pinker:

  • models built from URDF (revolute, continuous, prismatic, planar, floating and fixed joints);

  • forward kinematics, frame placements, frame and joint Jacobians in world, local and local-world-aligned frames;

  • Lie-group operations on SE(3) and configuration spaces;

  • center of mass and its Jacobian.

Heavy computations are delegated to an internal C extension. Functions were implemented based on their homonyms in Pinocchio v4.1.0 as a reference. Their outputs are cross-validated against Pinocchio by the test suite in tests/kinematics.

Model and data

Robot model and data.

A Model describes the kinematic tree of a robot: joints, frames, inertias and limits. A Data holds the buffers written by the kinematics algorithms (joint and frame placements, Jacobians).

class pinker.kinematics.model.Data(model=None)

Buffers written by the kinematics algorithms.

J

Full model Jacobian (6 x nv), world frame, filled by compute_joint_jacobians.

Jcom

Center-of-mass Jacobian (3 x nv).

com

List whose first element is the robot’s center of mass.

mass

List whose first element is the robot’s total mass.

copy()

Copy of this data with its own buffers.

Return type:

Data

Returns:

New data with the same values in freshly allocated buffers.

property oMf: _SE3View

Frame placements in the world frame.

Returns:

List-like view of the frame placements.

property oMi: _SE3View

Joint placements in the world frame.

Returns:

List-like view of the joint placements.

class pinker.kinematics.model.Frame(name, parent_joint, parent_frame, placement, type)

Coordinate frame attached to a joint of the kinematic tree.

name

Name of the frame.

parent_joint

Index of the joint supporting the frame.

parent_frame

Index of the previous frame in the tree.

placement

Pose of the frame in the support joint frame.

type

Frame type.

class pinker.kinematics.model.FrameType(*values)

Frame types, with the same values.

class pinker.kinematics.model.Model

Kinematic model of a robot.

Joints are indexed by joint id, the first one being the universe; limits are indexed by configuration or tangent coordinate.

effort_limit

Maximum effort of each tangent coordinate.

frames

Frames of the model, indexed by frame id.

inertias

Inertia of the body attached to each joint, in the frame of that joint.

joint_placements

Placement of each joint in the frame of its parent joint.

joints

Joint models of the kinematic tree.

lower_position_limit

Lower bound of each configuration coordinate.

name

Name of the robot model.

names

Name of each joint.

nq

Dimension of the configuration vector.

nv

Dimension of the tangent vector.

parents

Index of the parent joint of each joint.

supports

Indexes of the joints supporting each joint, from the universe down to that joint.

upper_position_limit

Upper bound of each configuration coordinate.

velocity_limit

Maximum velocity of each tangent coordinate.

add_body_frame(name, parent_joint, placement=None, previous_frame=-1)

Add a BODY type frame to the model.

Parameters:
  • name (str) – Name of the new frame.

  • parent_joint (int) – Index of the joint supporting the frame.

  • placement (Optional[SE3]) – Pose of the frame in the support joint frame, defaulting to the identity.

  • previous_frame (int) – Index of the previous frame in the tree. A negative value denotes the universe frame.

Return type:

int

Returns:

Index of the new frame.

add_frame(frame)

Add a frame to the model.

Parameters:

frame (Frame) – Frame to add.

Return type:

int

Returns:

Index of the new frame.

add_joint(parent_id, joint_model, placement, name, max_effort=None, max_velocity=None, min_config=None, max_config=None)

Add a joint to the kinematic tree.

Parameters:
  • parent_id (int) – Index of the parent joint.

  • joint_model (JointModel) – Joint model, e.g. from JointModelRZ().

  • placement (SE3) – Pose of the joint frame in the parent joint frame.

  • name (str) – Name of the new joint.

  • max_effort (Optional[ndarray]) – Maximum joint efforts (default: unbounded).

  • max_velocity (Optional[ndarray]) – Maximum joint velocities (default: unbounded).

  • min_config (Optional[ndarray]) – Lower configuration limits (default: unbounded).

  • max_config (Optional[ndarray]) – Upper configuration limits (default: unbounded).

Return type:

int

Returns:

Index of the new joint.

add_joint_frame(joint_id, previous_frame=-1)

Add a JOINT type frame coinciding with a joint of the model.

Parameters:
  • joint_id (int) – Index of the joint the frame coincides with.

  • previous_frame (int) – Index of the previous frame in the tree. A negative value denotes the universe frame.

Return type:

int

Returns:

Index of the new frame.

append_body_to_joint(joint_id, inertia, placement=None)

Append body inertia to a joint of the model.

Parameters:
  • joint_id (int) – Index of the supporting joint.

  • inertia (Inertia) – Inertia of the body, in the body frame.

  • placement (Optional[SE3]) – Pose of the body frame in the joint frame.

Return type:

None

create_data()

Create a data buffer matching this model.

Return type:

Data

Returns:

New data for this model.

exist_frame(name)

Check whether a frame name exists in the model.

Parameters:

name (str) – Name of the frame to look up.

Return type:

bool

Returns:

True if the model has a frame with this name.

exist_joint_name(name)

Check whether a joint name exists in the model.

Parameters:

name (str) – Name of the joint to look up.

Return type:

bool

Returns:

True if the model has a joint with this name.

get_frame_id(name)

Index of the frame with a given name.

Parameters:

name (str) – Name of the frame to look up.

Return type:

int

Returns:

Index of the frame.

Raises:

ValueError – If the model has no frame with this name. Pinocchio returns nframes in that case; we raise so that all Model getters behave the same way.

get_joint_id(name)

Index of the joint with a given name.

Parameters:

name (str) – Name of the joint to look up.

Return type:

int

Returns:

Index of the joint.

Raises:

ValueError – If the model has no joint with this name. Pinocchio returns njoints in that case; we raise so that all Model getters behave the same way.

get_joint_tangent_id(name)

Index of a joint in the tangent vector.

Parameters:

name (str) – Name of the joint to look up.

Return type:

int

Returns:

Index of the first tangent coordinate of the joint, so that its coordinates are v[idx_v:idx_v + joint.nv].

Raises:

ValueError – If the model has no joint with this name.

get_root_joint_dim()

Count configuration and tangent dimensions of the root joint.

Return type:

Tuple[int, int]

Returns:

Pair (nq, nv) of the configuration and tangent dimensions of the root joint, or (0, 0) if the model has no root joint.

has_configuration_limit()

Boolean array flagging configuration coordinates with limits.

Return type:

ndarray

Returns:

One boolean per configuration coordinate, True if that coordinate has a position limit.

property nframes: int

Number of frames.

Returns:

Number of frames in the model.

property njoints: int

Number of joints, including the universe.

Returns:

Number of joints in the model.

class pinker.kinematics.model.ReferenceFrame(*values)

Reference frame for velocities and Jacobians.

Joints

Joint models.

Joint type identifiers match the enumeration in the C extension. Quantities per joint type (configuration and tangent dimensions, neutral configuration) follow Pinocchio’s conventions:

  • Revolute and prismatic joints have one configuration variable.

  • Unbounded (continuous) revolute joints store (cos, sin) of their angle.

  • Spherical joints store a unit quaternion (x, y, z, w).

  • Planar joints store (x, y, cos, sin).

  • Free-flyer joints store (x, y, z, qx, qy, qz, qw).

Note that quaternions are stored with their vector part coming first.

class pinker.kinematics.joints.JointModel(jtype, axis=None)

Description of a joint, before or after it is added to a model.

Index attributes are set when the joint is added to a model, and are -1 until then.

axis

Joint axis, for revolute and prismatic joints, None otherwise.

id

Index of the joint in the model it belongs to.

idx_q

Index of the joint in the configuration vector, so that its coordinates are q[idx_q:idx_q + nq].

idx_v

Index of the joint in the tangent vector, so that its coordinates are v[idx_v:idx_v + nv].

jtype

Joint type identifier.

property nq: int

Number of configuration variables.

Returns:

Dimension of the configuration segment of the joint.

property nv: int

Number of tangent (velocity) variables.

Returns:

Dimension of the tangent segment of the joint.

shortname()

Pinocchio-compatible short name, e.g. “JointModelRZ”.

Return type:

str

Returns:

Short name of the joint model.

pinker.kinematics.joints.JointModelFreeFlyer()

Free-flyer joint: full 6-DoF rigid motion.

Its configuration segment is (x, y, z, qx, qy, qz, qw): the position of the joint followed by its unit quaternion, vector part first, so that the neutral configuration of the joint is (0, 0, 0, 0, 0, 0, 1).

Return type:

JointModel

Returns:

Corresponding joint model.

pinker.kinematics.joints.JointModelPX()

Prismatic joint along the x-axis.

Return type:

JointModel

Returns:

Corresponding joint model.

pinker.kinematics.joints.JointModelPY()

Prismatic joint along the y-axis.

Return type:

JointModel

Returns:

Corresponding joint model.

pinker.kinematics.joints.JointModelPZ()

Prismatic joint along the z-axis.

Return type:

JointModel

Returns:

Corresponding joint model.

pinker.kinematics.joints.JointModelPlanar()

Planar joint: translation in the xy-plane, rotation about z.

Return type:

JointModel

Returns:

Corresponding joint model.

pinker.kinematics.joints.JointModelPrismaticUnaligned(x=1.0, y=0.0, z=0.0)

Prismatic joint along an arbitrary axis.

Parameters:
  • x – First coordinate of the joint axis.

  • y – Second coordinate of the joint axis.

  • z – Third coordinate of the joint axis.

Return type:

JointModel

Returns:

Corresponding joint model.

pinker.kinematics.joints.JointModelRX()

Revolute joint about the x-axis.

Return type:

JointModel

Returns:

Corresponding joint model.

pinker.kinematics.joints.JointModelRY()

Revolute joint about the y-axis.

Return type:

JointModel

Returns:

Corresponding joint model.

pinker.kinematics.joints.JointModelRZ()

Revolute joint about the z-axis.

Return type:

JointModel

Returns:

Corresponding joint model.

pinker.kinematics.joints.JointModelRevoluteUnaligned(x=1.0, y=0.0, z=0.0)

Revolute joint about an arbitrary axis.

Parameters:
  • x – First coordinate of the joint axis.

  • y – Second coordinate of the joint axis.

  • z – Third coordinate of the joint axis.

Return type:

JointModel

Returns:

Corresponding joint model.

pinker.kinematics.joints.JointModelSpherical()

Ball joint, parameterized by a unit quaternion.

Its configuration segment is the unit quaternion (x, y, z, w), vector part first, so that the neutral configuration of the joint is (0, 0, 0, 1).

Return type:

JointModel

Returns:

Corresponding joint model.

pinker.kinematics.joints.joint_has_configuration_limit(jtype)

Which configuration variables of a joint have position limits.

Parameters:

jtype (int) – Joint type identifier.

Return type:

list

Returns:

One boolean per configuration variable of the joint, True if that variable has a position limit.

pinker.kinematics.joints.joint_neutral(jtype)

Neutral configuration of a joint type.

Parameters:

jtype (int) – Joint type identifier.

Return type:

ndarray

Returns:

Neutral configuration segment of the joint, of size nq.

Algorithms

Kinematics algorithms.

Configuration vectors are laid out per joint as described in pinker.kinematics.joints. Functions take configuration and tangent vectors as array-likes (which they copy into contiguous float64 arrays) and return NumPy arrays.

pinker.kinematics.algorithms.Jlog6(M)

Jacobian of the SE3 logarithm at a rigid transform.

Parameters:

M (SE3) – Rigid transform.

Return type:

ndarray

Returns:

Jacobian of log6() at the transform, of shape (6, 6).

pinker.kinematics.algorithms.center_of_mass(model, data, q=None)

Center of mass of the robot, in the world frame.

Parameters:
  • model (Model) – Robot model.

  • data (Data) – Data of the model, updated in place with the center of mass and the total mass.

  • q (Optional[numpy.typing.ArrayLike]) – Configuration vector. If None, joint placements already in data are used as is.

Return type:

ndarray

Returns:

Position of the center of mass in the world frame.

pinker.kinematics.algorithms.compute_joint_jacobians(model, data, q=None)

Compute joint placements and the full model Jacobian.

As in Pinocchio, the full Jacobian data.J has one column per tangent coordinate, expressed in the world frame.

Parameters:
  • model (Model) – Robot model.

  • data (Data) – Data of the model, updated in place.

  • q (Optional[numpy.typing.ArrayLike]) – Configuration vector. If None, joint placements already in data are used as is.

Return type:

ndarray

Returns:

Full model Jacobian data.J, of shape (6, nv).

pinker.kinematics.algorithms.custom_configuration(model, **kwargs)

Generate a configuration vector where named joints have given values.

Parameters:
  • model (Model) – Robot model.

  • kwargs – Custom values for joint coordinates.

Return type:

ndarray

Returns:

Configuration vector where named joints have the values specified in keyword arguments, and other joints have their neutral value.

Raises:

ValueError – If a joint value does not have the dimension of the corresponding joint.

pinker.kinematics.algorithms.d_difference(model, q0, q1, arg=0)

Jacobian of the difference with respect to one of its arguments.

Parameters:
  • model (Model) – Robot model.

  • q0 (numpy.typing.ArrayLike) – Configuration to start from.

  • q1 (numpy.typing.ArrayLike) – Configuration to go to.

  • arg (int) – Differentiate with respect to q0 (ARG0) or q1 (ARG1).

Return type:

ndarray

Returns:

Jacobian of the difference, of shape (nv, nv).

pinker.kinematics.algorithms.difference(model, q0, q1)

Tangent-space difference going from q0 to q1.

Parameters:
  • model (Model) – Robot model.

  • q0 (numpy.typing.ArrayLike) – Configuration to start from.

  • q1 (numpy.typing.ArrayLike) – Configuration to go to.

Return type:

ndarray

Returns:

Tangent-space displacement v such that integrating v from q0 yields q1.

pinker.kinematics.algorithms.exp3(w)

Exponential map of a rotation vector.

Parameters:

w (numpy.typing.ArrayLike) – Rotation vector, whose norm is the rotation angle.

Return type:

ndarray

Returns:

Corresponding rotation matrix.

pinker.kinematics.algorithms.exp6(nu)

Exponential map of a twist.

Parameters:

nu (Union[Motion, numpy.typing.ArrayLike]) – Twist, as a Motion or a vector of size 6.

Return type:

SE3

Returns:

Rigid transform whose logarithm is the twist.

pinker.kinematics.algorithms.forward_kinematics(model, data, q)

Compute joint placements for a configuration.

Parameters:
  • model (Model) – Robot model.

  • data (Data) – Data of the model, updated in place with joint placements.

  • q (numpy.typing.ArrayLike) – Configuration vector.

Return type:

None

pinker.kinematics.algorithms.frames_forward_kinematics(model, data, q)

Compute joint and frame placements for a configuration.

Parameters:
  • model (Model) – Robot model.

  • data (Data) – Data of the model, updated in place.

  • q (numpy.typing.ArrayLike) – Configuration vector.

Return type:

None

pinker.kinematics.algorithms.get_frame_jacobian(model, data, frame_id, reference_frame=ReferenceFrame.LOCAL)

Jacobian of a frame, extracted from the full model Jacobian.

Requires compute_joint_jacobians and update_frame_placements to have been called on the data beforehand.

Parameters:
  • model (Model) – Robot model.

  • data (Data) – Data of the model, with up-to-date Jacobian and placements.

  • frame_id (int) – Index of the frame in model.frames.

  • reference_frame (ReferenceFrame) – Frame in which the Jacobian is expressed.

Return type:

ndarray

Returns:

Jacobian of the frame, of shape (6, nv).

pinker.kinematics.algorithms.get_joint_jacobian(model, data, joint_id, reference_frame=ReferenceFrame.LOCAL)

Jacobian of a joint, extracted from the full model Jacobian.

Parameters:
  • model (Model) – Robot model.

  • data (Data) – Data of the model, with an up-to-date Jacobian.

  • joint_id (int) – Index of the joint in model.joints.

  • reference_frame (ReferenceFrame) – Frame in which the Jacobian is expressed.

Return type:

ndarray

Returns:

Jacobian of the joint, of shape (6, nv).

pinker.kinematics.algorithms.integrate(model, q, v)

Integrate a tangent-space displacement from a configuration.

Parameters:
  • model (Model) – Robot model.

  • q (numpy.typing.ArrayLike) – Configuration vector to integrate from.

  • v (numpy.typing.ArrayLike) – Tangent-space displacement to integrate.

Return type:

ndarray

Returns:

Resulting configuration vector.

pinker.kinematics.algorithms.jacobian_center_of_mass(model, data, q=None)

Jacobian of the center of mass (3 x nv), in the world frame.

Parameters:
  • model (Model) – Robot model.

  • data (Data) – Data of the model, updated in place with the center-of-mass Jacobian, the center of mass and the total mass.

  • q (Optional[numpy.typing.ArrayLike]) – Configuration vector. If None, joint placements already in data are used as is.

Return type:

ndarray

Returns:

Center-of-mass Jacobian data.Jcom, of shape (3, nv).

pinker.kinematics.algorithms.log3(R)

Logarithm map of a rotation matrix.

Parameters:

R (numpy.typing.ArrayLike) – Rotation matrix.

Return type:

ndarray

Returns:

Rotation vector, whose norm is the rotation angle.

pinker.kinematics.algorithms.log6(M)

Logarithm map of a rigid transform.

Parameters:

M (SE3) – Rigid transform.

Return type:

Motion

Returns:

Twist whose exponential is the transform.

pinker.kinematics.algorithms.neutral(model)

Neutral configuration of a model.

Parameters:

model (Model) – Robot model.

Return type:

ndarray

Returns:

Neutral configuration vector of the model.

pinker.kinematics.algorithms.update_frame_placements(model, data)

Update frame placements from joint placements.

Parameters:
  • model (Model) – Robot model.

  • data (Data) – Data of the model, whose joint placements have already been computed, updated in place with frame placements.

Return type:

None

Spatial algebra

Conversions between representations of rotations.

Quaternions are laid out as (x, y, z, w), vector part first, as in configuration vectors. The one exception is quaternion_wxyz(), named after the scalar-first order that Viser expects.

pinker.kinematics.so3.quaternion_to_matrix(quat)

Rotation matrix of a unit quaternion.

Parameters:

quat (numpy.typing.ArrayLike) – Unit quaternion, as (x, y, z, w) with its vector part first, the way quaternions are laid out in configuration vectors.

Return type:

ndarray

Returns:

Corresponding rotation matrix.

pinker.kinematics.so3.quaternion_wxyz(R)

Quaternion (w, x, y, z) of a rotation matrix, by Shepperd’s method.

Parameters:

R (ndarray) – Rotation matrix.

Return type:

ndarray

Returns:

Corresponding unit quaternion, as (w, x, y, z).

pinker.kinematics.so3.rpy_to_matrix(roll, pitch, yaw)

Rotation matrix from roll-pitch-yaw angles (extrinsic x-y-z).

Parameters:
  • roll (float) – Rotation angle about the x-axis in [rad].

  • pitch (float) – Rotation angle about the y-axis in [rad].

  • yaw (float) – Rotation angle about the z-axis in [rad].

Return type:

ndarray

Returns:

Corresponding rotation matrix.

pinker.kinematics.so3.skew(v)

Skew-symmetric matrix of a 3D vector.

Parameters:

v (numpy.typing.ArrayLike) – Three-dimensional vector.

Return type:

ndarray

Returns:

Matrix such that multiplying it by a vector w yields the cross product of v and w.

Rigid transforms, spatial vectors and inertias.

class pinker.kinematics.se3.Inertia(mass=0.0, lever=None, inertia=None)

Spatial inertia: mass, center of mass and rotational inertia.

classmethod FromBox(mass, x, y, z)

Inertia of a box of a given mass and dimensions.

Parameters:
  • mass (float) – Mass of the box in [kg].

  • x (float) – Length of the box along the x-axis in [m].

  • y (float) – Length of the box along the y-axis in [m].

  • z (float) – Length of the box along the z-axis in [m].

Return type:

Inertia

Returns:

Inertia of the box at its center.

classmethod Zero()

Zero inertia.

Return type:

Inertia

Returns:

Inertia with zero mass, lever and rotational inertia.

displaced(placement)

This inertia expressed in a new frame.

Parameters:

placement (SE3) – Transform from the body frame to the new frame.

Return type:

Inertia

Returns:

Inertia in the new frame.

class pinker.kinematics.se3.Motion(vector)

Spatial velocity (linear, angular).

property angular: ndarray

Angular part.

Returns:

Angular part of the spatial velocity.

asarray()

Convert to a NumPy array as a 6-dimensional vector.

Note that this is not a copy: the returned array is directly the stored representation of the motion vector, and writing to it updates the motion directly. Copy it (or call numpy.array()) if that is not what you want.

Return type:

ndarray

Returns:

Spatial velocity as a vector of size 6.

property linear: ndarray

Linear part.

Returns:

Linear part of the spatial velocity.

class pinker.kinematics.se3.SE3(rotation=None, translation=None)

Rigid transform, represented by a rotation matrix and a translation.

classmethod Identity()

Identity transform.

Return type:

SE3

Returns:

Transform with identity rotation and zero translation.

classmethod Interpolate(A, B, alpha)

Interpolate between two transforms.

Parameters:
  • A (SE3) – First transform.

  • B (SE3) – Second transform.

  • alpha (float) – Interpolation parameter in [0, 1].

Return type:

SE3

Returns:

Transform A * exp(alpha * log(A^-1 B)).

classmethod Random()

Random transform, with translation in the unit cube.

Return type:

SE3

Returns:

Transform with a random rotation and a random translation.

act(other)

Compose with a transform, or apply to a point.

Parameters:

other (Union[SE3, ndarray]) – Transform to compose with, or point to apply this transform to.

Returns:

Composed transform, or transformed point.

act_inv(other)

Compose the inverse with a transform, or apply it to a point.

Parameters:

other (Union[SE3, ndarray]) – Transform to compose the inverse with, or point to apply the inverse transform to.

Returns:

Composed transform, or transformed point.

property action: ndarray

Adjoint 6x6 matrix, mapping (linear, angular) twists.

Returns:

Adjoint matrix of the transform.

property action_inverse: ndarray

Adjoint 6x6 matrix of the inverse transform.

Returns:

Adjoint matrix of the inverse transform.

copy()

Copy of this transform with its own memory.

Return type:

SE3

Returns:

New transform with the same value in freshly allocated arrays.

property homogeneous: ndarray

Homogeneous 4x4 matrix of the transform.

Returns:

Homogeneous matrix of the transform.

inverse()

Inverse transform.

Return type:

SE3

Returns:

Transform undoing this one.

is_approx(other, prec=1e-12)

Check if two transforms are approximately equal.

Parameters:
  • other (SE3) – Transform to compare with.

  • prec (float) – Absolute tolerance on rotation and translation coefficients.

Return type:

bool

Returns:

True if the two transforms are equal up to the tolerance.

toarray()

Convert to a NumPy array as the homogeneous 4x4 matrix.

The transform stores its rotation and translation separately, so the array returned by this function is a copy and modifying it won’t affect the transform.

Return type:

ndarray

Returns:

Homogeneous matrix of the transform.

Loading models

Build a model from a URDF file.

The conventions (joint ordering, frame ordering, default limits) follow Pinocchio’s URDF parser so that models built by pinker.kinematics match those built by Pinocchio joint by joint and frame by frame:

  • Joints are added by depth-first traversal of the kinematic tree, with child joints visited in alphabetical order of joint name.

  • Each movable joint adds a JOINT frame and a BODY frame for its child link. Fixed joints add a FIXED_JOINT frame and a BODY frame attached to the nearest movable ancestor joint, and their child link’s inertia is merged into that joint.

  • Continuous joints have their (cos, sin) configuration bounded by 1.01, like free-flyer and planar quaternion/cosine-sine coordinates.

pinker.kinematics.urdf.build_geom_from_urdf(model, filename, package_dirs=None)

Parse the visual geometries of a URDF file.

Parameters:
  • model (Model) – Model previously built from the same URDF.

  • filename (str) – Path to the URDF file.

  • package_dirs (Optional[List[str]]) – Directories where mesh files are looked up.

Return type:

GeometryModel

Returns:

Geometry model with one object per URDF <visual> element.

pinker.kinematics.urdf.build_model_from_urdf(filename, root_joint=None)

Build a model from a URDF file.

Parameters:
  • filename (str) – Path to the URDF file.

  • root_joint (Optional[JointModel]) – Optional joint model connecting the root link to the world.

Return type:

Model

Returns:

Robot model.

pinker.kinematics.urdf.build_model_from_xml(xml_string, root_joint=None)

Build a model from a URDF string.

Parameters:
  • xml_string (str) – URDF description of the robot.

  • root_joint (Optional[JointModel]) – Optional joint model connecting the root link to the world, e.g. JointModelFreeFlyer() for mobile robots.

Return type:

Model

Returns:

Robot model.

Convenience wrapper bundling a model with its data.

class pinker.kinematics.robot_wrapper.RobotWrapper(model, visual_model=None)

Robot model with its data and neutral configuration.

model

Robot model.

data

Data buffers for the model.

q0

Neutral configuration.

visual_model

Geometry model with the robot’s visuals, when built from URDF.

static BuildFromURDF(filename, package_dirs=None, root_joint=None)

Build a robot wrapper from a URDF file.

Parameters:
  • filename (str) – Path to the URDF file.

  • package_dirs (Optional[List[str]]) – Directories where mesh files are looked up.

  • root_joint (Optional[JointModel]) – Optional joint connecting the root link to the world.

Return type:

RobotWrapper

Returns:

Robot wrapper.

property nq: int

Number of configuration variables.

Returns:

Dimension of the configuration vector of the model.

property nv: int

Number of tangent-space variables.

Returns:

Dimension of the tangent vector of the model.

Geometry

Visual geometry attached to a robot model.

Each geometry object carries a primitive shape (box, sphere, cylinder) or a mesh file path, together with its placement in the frame of its parent joint.

class pinker.kinematics.geometry.GeometryModel

Collection of geometry objects attached to a robot model.

add_geometry_object(geometry_object)

Add a geometry object to the model.

Parameters:

geometry_object (GeometryObject) – Geometry object to add.

Return type:

int

Returns:

Index of the new geometry object in the model.

property ngeoms: int

Number of geometry objects.

Returns:

Number of geometry objects in the model.

class pinker.kinematics.geometry.GeometryObject(name, parent_joint, placement, shape, size=None, mesh_path='', mesh_scale=None, mesh_color=None)

One displayable shape, attached to a joint of the model.

name

Name of the geometry object, unique in its geometry model.

parent_joint

Index of the supporting joint.

placement

Pose of the shape in the parent joint frame.

shape

One of “box”, “sphere”, “cylinder” or “mesh”.

size

Shape parameters: full extents (3,) for a box, (radius,) for a sphere, (radius, length) for a cylinder, unused for a mesh.

mesh_path

Path to the mesh file, for mesh shapes.

mesh_scale

Scale applied to the mesh (3,).

mesh_color

RGBA color in [0, 1].