Hi, What is the best/fastest way to do inverse kinematics in mujoco where the goal is only getting the joint positions for a given target end-effector pose, without actually taking a simulation step or moving the robot to that target pose. Can we for example instantly take the end effector to a target pose, read the joint positions, and bring it back to its previous pose?
You would have to implement your own optimization procedure (or some other method). There is no built-in functionality to support inverse kinematics. The problem with what you proposed is there is no way to move the end-effector to a desired target. You can only set joint positions, and then the end-effector positions are derived quantities.
I noticed some ideas also about mocap bodies regarding inverse kinematic although I'm not sure yet if they may help or how to use them or how fast a solution might be. Could there be a work around with mocap bodies? for example if taking simulation step might be needed, one take another simulaton step to bring the end-effector back to its previous position
Yes you can do it via simulation. Create a soft equality constraint between the end-effector and a mocap body, move the mocap body to the desired location, and give it enough time to settle. You may want to increase joint damping, to avoid dynamic behaviors along the way. You could also disable gravity.