A lightweight, PyTorch-based Inverse Kinematics solver designed for robotics research and applications.
- Fast performance with Gauss-Newton optimization
- Parallel computation for solving multiple IK problems simultaneously
- Visualization capabilities for debugging and demonstration
- Simple structure with minimal dependencies
- Flexible architecture adaptable to various robot configurations
- End-to-end differentiability supporting gradient-based learning
pip install -r requirements.txtpython ik_example.pyThis runs a demonstration using the Franka robot model included in the repository. The result is like that:
- Create a
RobotModelinstance with your URDF file:
robot = RobotModel(
urdf_path='path/to/your/robot.urdf',
last_link_name='end_effector',
load_mesh=True,
device='cpu'
)- Define target poses and run batch inverse kinematics:
# batch size for optimization
n_samples = 1000
# Position and orientation (as quaternion) targets
targets = torch.tensor([[x, y, z, qw, qx, qy, qz]]).expand(n_samples,-1)
# Solve with multiple initial configurations for robustness
solutions = run_ik(robot, targets, n_samples=n_samples)- For visualization support, ensure your mesh files and link names align properly in the URDF.
- Leverages PyTorch for GPU acceleration and automatic differentiation
- Quaternion-based orientation representation
- Supports batch processing for parallel computation
- Simple customization through the
RobotModelclass
Please feel free to let me know if there are issues in runing the code.