Controllig force for proprioception with MoCap

Discussion in 'Support requests' started by Ishaan P, Jun 2, 2020.

  1. I'm unsure if I am missing something obvious, but I am unable to figure out if it is possible to constrain force at joints/sites while using motion capture and equality constraints together. I am using a Mujoco-py based repository, and the setup is currently working as follows:
    1. The gripper and the mocap body are welded together using a weld-equality constraint
    2. The relative position of the target to the robot is captured at each timestep. The values for the mocap body are changed in MjData and the equality weld constraint optimizer is expected to position the gripper to the mocap body.

    If I was doing control through an actuator, I understand I can modify force using forcelimited and forcerange options for the actuator. But is there any way possible to control the force applied when I am actuating in such a way. As a second question, I am also generally confused about the physical implications of simulating in this way. Does the weld equality constraint respect all the model parameters in robot.xml when it forces the move in this setting?

    Here is the MuJoco reference XML from OpenAI Gym:

    Consider push.xml (final xml to be loaded into MjSim), robot.xml (gripper and mocap), and shared.xml (equality constraint)

    Many thanks,
  2. Vikash Kumar

    Vikash Kumar Staff Member

    MoCap bodies can be used to model objects that are being tracked by a motion capture system. Much like how markers used in motion-capture systems do not influence the underlying motion being captured, mocap bodies are passive entities that do not directly take part in the simulation.

    Constraints can however be defined between a "Mocap body" and "physical body" to enable tracking between the two bodies. MuJoCo constraint solver computes the constraint forces and adds them to the rest of the forces in the simulation. Note that these constrain forces do not have any force generation mechanism (i.e. actuators) explicitly modeled in the simulation. MuJoCo considers these constraints/ forces as being imposes by the world on the simulation without caring too much about its fine-grained details. The simulation is fully consistent with respect to all the model details except the source of the constraints force.

    For the mentioned example, the constraints are defined as :-
    <weld body1="robot0:mocap" body2="robot0:gripper_link" solimp="0.9 0.95 0.001" solref="0.02 1"></weld>
    These constraints forces can be interpreted as the forces that the arm (using arm motors) applies to the gripper_link.

    One can use solimp and solref parameters to configuring the constraint force generation.