code/WPILib/CANJaguar.cpp
/**
 * Set the P, I, and D constants for the closed loop modes.
 * 
 * @param p The proportional gain of the Jaguar's PID controller.
 * @param i The integral gain of the Jaguar's PID controller.
 * @param d The differential gain of the Jaguar's PID controller.
 */
Set the P, I, and D constants for the closed loop modes.

@param p The proportional gain of the Jaguar's PID controller.
@param i The integral gain of the Jaguar's PID controller.
@param d The differential gain of the Jaguar's PID controller.
Set the P I and D constants for the closed loop modes . @param p The proportional gain of the Jaguar ' s PID controller . @param i The integral gain of the Jaguar ' s PID controller . @param d The differential gain of the Jaguar ' s PID controller .
void CANJaguar::SetPID(double p, double i, double d)
{
	UINT8 dataBuffer[8];
	UINT8 dataSize;
	switch(m_controlMode)
	{
	case kPercentVbus:
	case kVoltage:
		break;
	case kSpeed:
		dataSize = packFXP16_16(dataBuffer, p);
		setTransaction(LM_API_SPD_PC, dataBuffer, dataSize);
		dataSize = packFXP16_16(dataBuffer, i);
		setTransaction(LM_API_SPD_IC, dataBuffer, dataSize);
		dataSize = packFXP16_16(dataBuffer, d);
		setTransaction(LM_API_SPD_DC, dataBuffer, dataSize);
		break;
	case kPosition:
		dataSize = packFXP16_16(dataBuffer, p);
		setTransaction(LM_API_POS_PC, dataBuffer, dataSize);
		dataSize = packFXP16_16(dataBuffer, i);
		setTransaction(LM_API_POS_IC, dataBuffer, dataSize);
		dataSize = packFXP16_16(dataBuffer, d);
		setTransaction(LM_API_POS_DC, dataBuffer, dataSize);
		break;
	case kCurrent:
		dataSize = packFXP16_16(dataBuffer, p);
		setTransaction(LM_API_ICTRL_PC, dataBuffer, dataSize);
		dataSize = packFXP16_16(dataBuffer, i);
		setTransaction(LM_API_ICTRL_IC, dataBuffer, dataSize);
		dataSize = packFXP16_16(dataBuffer, d);
		setTransaction(LM_API_ICTRL_DC, dataBuffer, dataSize);
		break;
	}
}
void CANJaguar :: SetPID ( double p , double i , double d ) { UINT8 dataBuffer [ 8 ] ; UINT8 dataSize ; switch ( m_controlMode ) { case kPercentVbus : case kVoltage : break ; case kSpeed : dataSize = packFXP16_16 ( dataBuffer , p ) ; setTransaction ( LM_API_SPD_PC , dataBuffer , dataSize ) ; dataSize = packFXP16_16 ( dataBuffer , i ) ; setTransaction ( LM_API_SPD_IC , dataBuffer , dataSize ) ; dataSize = packFXP16_16 ( dataBuffer , d ) ; setTransaction ( LM_API_SPD_DC , dataBuffer , dataSize ) ; break ; case kPosition : dataSize = packFXP16_16 ( dataBuffer , p ) ; setTransaction ( LM_API_POS_PC , dataBuffer , dataSize ) ; dataSize = packFXP16_16 ( dataBuffer , i ) ; setTransaction ( LM_API_POS_IC , dataBuffer , dataSize ) ; dataSize = packFXP16_16 ( dataBuffer , d ) ; setTransaction ( LM_API_POS_DC , dataBuffer , dataSize ) ; break ; case kCurrent : dataSize = packFXP16_16 ( dataBuffer , p ) ; setTransaction ( LM_API_ICTRL_PC , dataBuffer , dataSize ) ; dataSize = packFXP16_16 ( dataBuffer , i ) ; setTransaction ( LM_API_ICTRL_IC , dataBuffer , dataSize ) ; dataSize = packFXP16_16 ( dataBuffer , d ) ; setTransaction ( LM_API_ICTRL_DC , dataBuffer , dataSize ) ; break ; } }
Set the P, I, and D constants for the closed loop modes.
Set the P I and D constants for the closed loop modes .
// TODO: Error, Not Valid