(self, motor_commands, motor_control_mode=None)
Clips and then apply the motor commands using the motor model.

    Args:
      motor_commands: np.array. Can be motor angles, torques, hybrid commands,
        or motor pwms (for Minitaur only).
      motor_control_mode: A MotorControlMode enum.
Clips and then apply the motor commands using the motor model.
Clips and then apply the motor commands using the motor model .
def ApplyAction(self, motor_commands, motor_control_mode=None):
    """Clips and then apply the motor commands using the motor model.

    Args:
      motor_commands: np.array. Can be motor angles, torques, hybrid commands,
        or motor pwms (for Minitaur only).
      motor_control_mode: A MotorControlMode enum.
    """
    if motor_control_mode is None:
      motor_control_mode = self._motor_control_mode

    command = np.zeros(60, dtype=np.float32)
    if motor_control_mode == robot_config.MotorControlMode.POSITION:
      for motor_id in range(NUM_MOTORS):
        command[motor_id * 5] = motor_commands[motor_id]
        command[motor_id * 5 + 1] = self.motor_kps[motor_id]
        command[motor_id * 5 + 3] = self.motor_kds[motor_id]
    elif motor_control_mode == robot_config.MotorControlMode.TORQUE:
      for motor_id in range(NUM_MOTORS):
        command[motor_id * 5 + 4] = motor_commands[motor_id]
    elif motor_control_mode == robot_config.MotorControlMode.HYBRID:
      command = np.array(motor_commands, dtype=np.float32)
    else:
      raise ValueError('Unknown motor control mode for A1 robot: {}.'.format(
          motor_control_mode))

    self._robot_interface.send_command(command)
def ApplyAction ( self , motor_commands , motor_control_mode = None ) : if motor_control_mode is None : motor_control_mode = self . _motor_control_mode command = np . zeros ( 60 , dtype = np . float32 ) if motor_control_mode == robot_config . MotorControlMode . POSITION : for motor_id in range ( NUM_MOTORS ) : command [ motor_id * 5 ] = motor_commands [ motor_id ] command [ motor_id * 5 + 1 ] = self . motor_kps [ motor_id ] command [ motor_id * 5 + 3 ] = self . motor_kds [ motor_id ] elif motor_control_mode == robot_config . MotorControlMode . TORQUE : for motor_id in range ( NUM_MOTORS ) : command [ motor_id * 5 + 4 ] = motor_commands [ motor_id ] elif motor_control_mode == robot_config . MotorControlMode . HYBRID : command = np . array ( motor_commands , dtype = np . float32 ) else : raise ValueError ( 'Unknown motor control mode for A1 robot: {}.' . format ( motor_control_mode ) ) self . _robot_interface . send_command ( command )