code/WPILib/CANJaguar.cpp
/**
 * Enable the closed loop controller.
 * 
 * Start actually controlling the output based on the feedback.
 * If starting a position controller with an encoder reference,
 * use the encoderInitialPosition parameter to initialize the
 * encoder state.
 * 
 * @param encoderInitialPosition Encoder position to set if position with encoder reference.  Ignored otherwise.
 */
Enable the closed loop controller.

Start actually controlling the output based on the feedback.
If starting a position controller with an encoder reference,
use the encoderInitialPosition parameter to initialize the
encoder state.

@param encoderInitialPosition Encoder position to set if position with encoder reference.  Ignored otherwise.
Enable the closed loop controller . Start actually controlling the output based on the feedback . If starting a position controller with an encoder reference use the encoderInitialPosition parameter to initialize the encoder state . @param encoderInitialPosition Encoder position to set if position with encoder reference . Ignored otherwise .
void CANJaguar::EnableControl(double encoderInitialPosition)
{
	UINT8 dataBuffer[8];
	UINT8 dataSize = 0;
	switch(m_controlMode)
	{
	case kPercentVbus:
		setTransaction(LM_API_VOLT_T_EN, dataBuffer, dataSize);
		break;
	case kSpeed:
		setTransaction(LM_API_SPD_T_EN, dataBuffer, dataSize);
		break;
	case kPosition:
		dataSize = packFXP16_16(dataBuffer, encoderInitialPosition);
		setTransaction(LM_API_POS_T_EN, dataBuffer, dataSize);
		break;
	case kCurrent:
		setTransaction(LM_API_ICTRL_T_EN, dataBuffer, dataSize);
		break;
	case kVoltage:
		setTransaction(LM_API_VCOMP_T_EN, dataBuffer, dataSize);
		break;
	}
}
void CANJaguar :: EnableControl ( double encoderInitialPosition ) { UINT8 dataBuffer [ 8 ] ; UINT8 dataSize = 0 ; switch ( m_controlMode ) { case kPercentVbus : setTransaction ( LM_API_VOLT_T_EN , dataBuffer , dataSize ) ; break ; case kSpeed : setTransaction ( LM_API_SPD_T_EN , dataBuffer , dataSize ) ; break ; case kPosition : dataSize = packFXP16_16 ( dataBuffer , encoderInitialPosition ) ; setTransaction ( LM_API_POS_T_EN , dataBuffer , dataSize ) ; break ; case kCurrent : setTransaction ( LM_API_ICTRL_T_EN , dataBuffer , dataSize ) ; break ; case kVoltage : setTransaction ( LM_API_VCOMP_T_EN , dataBuffer , dataSize ) ; break ; } }
Enable the closed loop controller.
Enable the closed loop controller .