I have a simulation of Universal Robot 5 attached with a custom gripper. I would like to measure the torque on the finger joint created by the contacts (qfrc_constraint) while the finger is sliding over the table and objects on the table. The fingers are not actuated but damping and stiffness values are defined for the joints. However, while the finger is sliding over the flat table, the torque values increase and become zero periodically. I played with the stiffness and the damping values of the finger joints and the solimp and solref values for the geoms but it always does the same behavior. I think the finger is jumping and making contact with the table periodically. I would like to see more of constant values. To see the behavior, you can run the https://github.com/tkelestemur/diff_histogram/blob/master/env/test_env.py You will need mujoco-py and gym packages from OpenAI. The output of the qfrc_constraint for the fingers while it is sliding over the table is as below: Code: [0. 0.] [-0.04587125 0. ] [-0.05642318 0. ] [-0.06542718 0. ] [-0.07357202 0. ] [-0.0808812 0. ] [-0.08742293 0. ] [-0.09325489 0. ] [-0.09843159 0. ] [-0.10300391 0. ] [-0.1070196 0. ] [-0.11052341 0. ] [-0.11355732 0. ] [-0.11616068 0. ] [-0.11837031 0. ] [-0.12022063 0. ] [-0.1217438 0. ] [-0.12296981 0. ] [0. 0.] [-0.04579216 0. ] [-0.05632533 0. ] [-0.06531255 0. ] [-0.07344198 0. ] [-0.08073714 0. ] [-0.08726613 0. ] [-0.09308662 0. ] [-0.09825303 0. ] [-0.1028162 0. ] [-0.1068238 0. ] [-0.11032053 0. ] [-0.11334831 0. ] [-0.11594641 0. ] [-0.11815161 0. ] [-0.11999826 0. ] [-0.12151845 0. ] [-0.12274214 0. ]
The soft contact model results in stick-slip-like behavior which is always present to some extent. You can reduce the effect by making contacts softer -- by changing the contact impedance in solimp, for example "0.7 0.7 0"
This worked better. I see more consistent values now, however, the finger penetrates into the table which I guess should be expected with low contact impedance. Thanks for the help!
Yes, there is a trade-off between stick-slip and contact penetration. You may be able to reduce penetration by reducing the time constant (first parameter) in solref. But keep in mind that for stability reasons solref[0] is internally limited from below to 2*dt (unless you disable this safety feature).