Getting Inverse Kinematics in MuJoCo

February 06 2024

The Problem

In order to create a basic tracking controller for the UR10e robot, I wanted to transform a sequence of desired poses into desired joint angles for the robot. This problem is a very common one in robotics and is sometimes referred to as the "inverse kinematics" (IK) problem.

While I found and learned many open sourced inverse-kinematics solvers for arbitrary robots via URDF files (e.g., ikpy), I wasn't able to get very good results with any of them.

A Useful Alternative

I'll cut to the chase, and describe an IK solution that worked better for me: Deepmind's MuJoCo IK solver.

As some of you may know, Deepmind (the part of Alphabet that open-sourced MuJoCo) has used MuJoCo a lot for reinforcement learning and robotics research. Given this heavy usage, I found it strange that MuJoCo's documentation contains little mention of IK (at least at the time of this blog post).

They must have used IK at some point. How did they do it?

Well, take a look at Deepmind's control repository on GitHub . Specifically, in a file called "inverse_kinematics.py", you'll find a well-documented function that uses the Python bindings for MuJoCo to solve the IK problem.

Hopefully, this simplifies the life of a future robotic control engineer. You don't have to struggle the way I did. :)