def _add_velocity_actuator(joint):
  """Adds a velocity actuator to a joint, returns the new MJCF element."""
  # These parameters were adjusted to achieve a grip force of ~25 N and a finger
  # closing time of ~1.2 s, as specified in the datasheet for the hand.
  gain = 10.
  forcerange = (-1., 1.)
  ctrlrange = (-5., 5.)  # Based on Kinova's URDF.
  return joint.root.actuator.add(
      'velocity',
      joint=joint,
      name=joint.name,
      kv=gain,
      ctrllimited=True,
      ctrlrange=ctrlrange,
      forcelimited=True,
      forcerange=forcerange)