Discussion in 'MuJoCo HAPTIX Feature Requests' started by Vasu Srevatsan, Jul 10, 2017.

  1. Hey Emo,

    We had some questions trying to move the MPL hand in vertically, horizontally, etc using Matlab. We are able the fingers using hx_update, but have not figured out how to move the entire hand up and down. Our main goal is to move our hand based on our Optitrack streaming data.

    We have tried moving our hand using the Matlab API commands, mj_set_onebody and mj_set_mocap. However, when we set the bodyid and alter the position in Matlab, the position of the MPL hand does not seem to be altered in MuJoCo.

    We understand there are 27 bodies, but how can we figure out which bodyid refers to which specific joint, body, etc. of the MPL hand? Can you also provide further explanation on the mj_set_onebody function and how to alter the position of the hand, so the hand appears to move in MuJoCo? Also, if another Matlab API command should be used instead, could you recommend to us which one should be used?


    Vasu Srevatsan
  2. Emo Todorov

    Emo Todorov Administrator Staff Member

    The base of the MPL hand model is attached to a mocap body via an equality constraint. You need to move the mocap body in order to move the hand. So mj_set_mocap should work. However, if you are using the built-in mocap capabilities at the same time, the data from the Optitrack controls the mocap body, overwriting anything you send over the API at each frame.

    If you want to be able to move the hand via actuators, you need to change the XML model as follows:

    1. comment out the equality constraint that couples the base of the hand to the mocap body; this will make the hand model drop on the ground when you run the simulation, but will also allow you to control it;

    2. define 6 joint actuators attached to the free joint at the base of the hand, and set their "gear" vectors to span the 6D space of translations and rotations. Or, to make things more intuitive, you could replace the free joint with 3 slide and 3 hinge joints, and then attach regular actuators to each scalar joint.

    Ideally you will not be attaching jet actuators to a disembodied hand though. To make it more realistic, you could add an arm model made of simple capsules, with shoulder and elbow joints, and attach the MPL hand at the end of it (by making the entire MPL model a child of the new Forearm body). Now you can actuate the arm joints.