(physics, body_elements)
Applies Cartesian forces to bodies in order to exactly counteract gravity.

  Note that this will also affect the output of pressure, force, or torque
  sensors within the kinematic chain leading from the worldbody to the bodies
  that are being gravity-compensated.

  Args:
    physics: An `mjcf.Physics` instance to modify.
    body_elements: An iterable of `mjcf.Element`s specifying the bodies to which
      gravity compensation will be applied.
Applies Cartesian forces to bodies in order to exactly counteract gravity.
Applies Cartesian forces to bodies in order to exactly counteract gravity .
def _compensate_gravity(physics, body_elements):
  """Applies Cartesian forces to bodies in order to exactly counteract gravity.

  Note that this will also affect the output of pressure, force, or torque
  sensors within the kinematic chain leading from the worldbody to the bodies
  that are being gravity-compensated.

  Args:
    physics: An `mjcf.Physics` instance to modify.
    body_elements: An iterable of `mjcf.Element`s specifying the bodies to which
      gravity compensation will be applied.
  """
  gravity = np.hstack([physics.model.opt.gravity, [0, 0, 0]])
  bodies = physics.bind(body_elements)
  bodies.xfrc_applied = -gravity * bodies.mass[..., None]
def _compensate_gravity ( physics , body_elements ) : gravity = np . hstack ( [ physics . model . opt . gravity , [ 0 , 0 , 0 ] ] ) bodies = physics . bind ( body_elements ) bodies . xfrc_applied = - gravity * bodies . mass [ ... , None ]