For my research, I need to find the gradient with respect to control input of a specific cost function, for which I want to use an adjoint formulation I've derived by hand. In my mind, the rocedure would go as: Start with a given trajectory Use inverse kinematics to find torque inputs Use adjoint to find gradient MuJoCo is great for steps 1 and 2, but I'm not completely sure how to do the simulations for step 3. I need a lot of derivatives that I'm not sure how to extract from mjData.
Derivatives can be computed with a finite difference approximation as illustrated here: http://www.mujoco.org/book/programming.html#saDerivative There is a new product under development called Optico, which is an optimal control toolbox build on top of MuJoCo, and it will have the ability to compute gradients of cost functions (in many cases analytically). But it is not ready yet.