(target, qposrange, ctrlrange=(-1, 1),
                          kp=1.0, **kwargs)
return target.root.actuator.add('general',
                                  biastype='affine',
                                  gainprm=[g0],
                                  biasprm=[b0, b1, b2],
                                  ctrllimited=True,
                                  ctrlrange=ctrlrange,
                                  **kwargs)
Adds a scaled position actuator that is bound to the specified element.

  This is equivalent to MuJoCo's built-in `<position>` actuator where an affine
  transformation is pre-applied to the control signal, such that the minimum
  control value corresponds to the minimum desired position, and the
  maximum control value corresponds to the maximum desired position.

  Args:
    target: A PyMJCF joint, tendon, or site element object that is to be
      controlled.
    qposrange: A sequence of two numbers specifying the allowed range of target
      position.
    ctrlrange: A sequence of two numbers specifying the allowed range of
      this actuator's control signal.
    kp: The gain parameter of this position actuator.
    **kwargs: Additional MJCF attributes for this actuator element.
      The following attributes are disallowed: `['biastype', 'gainprm',
      'biasprm', 'ctrllimited', 'joint', 'tendon', 'site',
      'slidersite', 'cranksite']`.

  Returns:
    A PyMJCF actuator element that has been added to the MJCF model containing
    the specified `target`.

  Raises:
    TypeError: `kwargs` contains an unrecognized or disallowed MJCF attribute,
      or `target` is not an allowed MJCF element type.
Adds a scaled position actuator that is bound to the specified element.
Adds a scaled position actuator that is bound to the specified element .
def add_position_actuator(target, qposrange, ctrlrange=(-1, 1),
                          kp=1.0, **kwargs):
  """Adds a scaled position actuator that is bound to the specified element.

  This is equivalent to MuJoCo's built-in `<position>` actuator where an affine
  transformation is pre-applied to the control signal, such that the minimum
  control value corresponds to the minimum desired position, and the
  maximum control value corresponds to the maximum desired position.

  Args:
    target: A PyMJCF joint, tendon, or site element object that is to be
      controlled.
    qposrange: A sequence of two numbers specifying the allowed range of target
      position.
    ctrlrange: A sequence of two numbers specifying the allowed range of
      this actuator's control signal.
    kp: The gain parameter of this position actuator.
    **kwargs: Additional MJCF attributes for this actuator element.
      The following attributes are disallowed: `['biastype', 'gainprm',
      'biasprm', 'ctrllimited', 'joint', 'tendon', 'site',
      'slidersite', 'cranksite']`.

  Returns:
    A PyMJCF actuator element that has been added to the MJCF model containing
    the specified `target`.

  Raises:
    TypeError: `kwargs` contains an unrecognized or disallowed MJCF attribute,
      or `target` is not an allowed MJCF element type.
  """
  _check_target_and_kwargs(target, **kwargs)
  kwargs[target.tag] = target

  slope = (qposrange[1] - qposrange[0]) / (ctrlrange[1] - ctrlrange[0])
  g0 = kp * slope
  b0 = kp * (qposrange[0] - slope * ctrlrange[0])
  b1 = -kp
  b2 = 0
  return target.root.actuator.add('general',
                                  biastype='affine',
                                  gainprm=[g0],
                                  biasprm=[b0, b1, b2],
                                  ctrllimited=True,
                                  ctrlrange=ctrlrange,
                                  **kwargs)
def add_position_actuator ( target , qposrange , ctrlrange = ( - 1 , 1 ) , kp = 1.0 , * * kwargs ) : _check_target_and_kwargs ( target , * * kwargs ) kwargs [ target . tag ] = target slope = ( qposrange [ 1 ] - qposrange [ 0 ] ) / ( ctrlrange [ 1 ] - ctrlrange [ 0 ] ) g0 = kp * slope b0 = kp * ( qposrange [ 0 ] - slope * ctrlrange [ 0 ] ) b1 = - kp b2 = 0 return target . root . actuator . add ( 'general' , biastype = 'affine' , gainprm = [ g0 ] , biasprm = [ b0 , b1 , b2 ] , ctrllimited = True , ctrlrange = ctrlrange , * * kwargs )