Adding force and torque sensors

Discussion in 'Modeling' started by yangs, Jul 17, 2017.

  1. Hi,

    I successfully set up the MuJoCo on Windows and now simulating human-robot interaction using C++.

    I was trying to add force and torque sensors between an arm exoskeleton and a human arm.
    The sites are supposed to be on 2-link arm exoskeleton. A 2-link human arm is programmed to push the exoskeleton at the sensors. The actuation control loop is to be later programmed.

    The documentation says "sensor/ force (*)" and "sensor/ torque (*)" output three numbers, which are the interaction force between a child and a parent body.
    I was a bit confused: since my exoskeleton and human arm are not child-parent related, what might be a good strategy to set up my .xml file? I tried adding one sensor A on exoskeleton (upper arm), and another sensor B on exoskeleton (lower arm, child of upper arm), but found the readings really big and always changing when simulated. I guess my .xml file is not in a logical kinematic tree.

    Or I should go with other sensor options?

    Thank you.
  2. Emo Todorov

    Emo Todorov Administrator Staff Member

    The force-torque sensor only works between a parent and a child body. If you want to measure forces and torques between an arbitrary pair of bodies, you first need to define how they interact. Is it through contacts? If so, you should get the contact forces. Or are they supposed to be attached to each other? If so, you should define an equality constraint, and then get the corresponding constraint forces.
    Kyokushin and danny like this.
  3. Hao


    I am a little confused now. When defining sensor, we define"site". Now suppose we need to measure the force that the parent used to hang the child, will it affect the measuring data when we define the site in a different way? Also, why it only need one definition for "site"? Don't we need both ends when measuring the force? On top of that, suppose I set a flat platform a the child, and "site" on one of the edges. Physically the platform will tilt, but in simulation it isn't. Will I measure the torque that required to balance it?

    Another question is when trying to measure the interaction force of two arbitrary pair, I add equality constraint. Nevertheless, while sensor works on site, equality works on two bodies. Should I define sites on both bodies now? If so, do I need to define the anchor in equality the same as the "site" I use in sensor?
  4. Emo Todorov

    Emo Todorov Administrator Staff Member

    The force-torque sensor measures the interaction force between the parent and child body. This force is always computed internally for physics simulation, independent of any sensors. The sensor is simply returning this force to you, expressed in the coordinate frame of the sensor site (which is why you need one site).

    As for equality constraints, read about them in the documentation -- there are different types and each requires certain model elements in order to define it. Once you have an equality constraint in the model, you can read out the force it generates and treat that force as if it is a sensor reading, without defining an actual sensor.
    Kyokushin likes this.
  5. Hi, I'm also trying to do something similar, how exactly are you model the exoskeleton? Can I take a look on your model? Thank you so much!
    rony likes this.