Kinematics¶
Forward Kinematics (Pinocchio)¶
pinocchio_fk
¶
Pinocchio-based forward kinematics and Jacobian computation.
Build a context on a robot's URDF (RobotConfig.urdf_path) with the
camera link as the end-effector frame to get the camera pose of a
configuration::
from nav_planning.locobot import locobot_robot_config as config
ctx = create_pinocchio_context(config.urdf_path, config.camera.link_name)
pose = compute_forward_kinematics(ctx, q) # q: full 5-DOF config
PinocchioContext(model: Any, data: Any, end_effector_frame_id: int, joint_names: list[str], joint_ids: list[int])
dataclass
¶
Context holding Pinocchio model and data for FK/Jacobian computations.
create_pinocchio_context(urdf_path: str, end_effector_frame: str, joint_names: list[str] | None = None) -> PinocchioContext
¶
Create a Pinocchio context from URDF file.
Input
urdf_path: Path to the URDF file end_effector_frame: Name of the end effector frame/link joint_names: Optional list of joint names to control (if None, uses all joints)
Output: PinocchioContext containing model and data for FK/Jacobian computations
Source code in nav_planning/kinematics/pinocchio_fk.py
compute_forward_kinematics(context: PinocchioContext, joint_positions: np.ndarray) -> SE3Pose
¶
Compute forward kinematics for the end effector.
Input
context: Pinocchio context with model and data joint_positions: Joint positions array
Output: SE3Pose of the end effector
Source code in nav_planning/kinematics/pinocchio_fk.py
compute_jacobian(context: PinocchioContext, joint_positions: np.ndarray, local_frame: bool = False) -> np.ndarray
¶
Compute the Jacobian matrix at the end effector.
Input
context: Pinocchio context with model and data joint_positions: Joint positions array local_frame: If True, compute Jacobian in local frame; else world frame
Output: Jacobian matrix, shape (6, n_joints)