本文整理汇总了C++中CANJaguar::SetPositionReference方法的典型用法代码示例。如果您正苦于以下问题:C++ CANJaguar::SetPositionReference方法的具体用法?C++ CANJaguar::SetPositionReference怎么用?C++ CANJaguar::SetPositionReference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CANJaguar
的用法示例。
在下文中一共展示了CANJaguar::SetPositionReference方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RobotInit
void RobotInit(void) {
// Actions which would be performed once (and only once) upon initialization of the
// robot would be put here.
// Test to see if Dashboard is connected---------------------------------------------------------
// printf("HUE MIN: %d\n", SmartDashboard::GetNumber("HUE MIN"));
// Initialize exponent value from SmartDashboard
exp = 3.0;
buttonWasDown = false;
// Initialize settings for encoder drive PIDControllers
// Drive_PID_Controller->SetOutputRange(-0.2, 0.2);
// Drive_PID_Controller->SetTolerance(0.1);
// Initialize settings for RobotTurn
// Goal_Align_PID->SetOutputRange(-0.2, 0.2);
// Goal_Align_PID->SetTolerance(0.1);
// Set encoders
Front_R->ConfigEncoderCodesPerRev(360);
Front_L->ConfigEncoderCodesPerRev(360);
// Set each drive motor to have an encoder to be its friend
Front_R->SetPositionReference(CANJaguar::kPosRef_QuadEncoder);
Front_L->SetPositionReference(CANJaguar::kPosRef_QuadEncoder);
printf("RobotInit() completed.\n");
}
示例2: resetArm
void RawControl::resetArm()
{
arm->SetPID(-5, 0, 0);
arm->ConfigNeutralMode(CANJaguar::kNeutralMode_Brake);
arm->SetSafetyEnabled(false);
arm->SetPositionReference(CANJaguar::kPosRef_Potentiometer);
arm->ConfigEncoderCodesPerRev(1);
arm->EnableControl(0);
}
示例3: checkJag
void RawControl::checkJag()
{
if(frontRight->GetFaults()!=0)
{
frontRight->ConfigNeutralMode(CANJaguar::kNeutralMode_Brake);
frontRight->SetSafetyEnabled(false);
frontRight->ConfigEncoderCodesPerRev(360);
frontRight->EnableControl(0);
}
if(frontLeft->GetFaults()!=0)
{
frontLeft->ConfigNeutralMode(CANJaguar::kNeutralMode_Brake);
frontLeft->SetSafetyEnabled(false);
frontLeft->ConfigEncoderCodesPerRev(360);
frontLeft->EnableControl(0);
}
if(backLeft->GetFaults()!=0)
{
backLeft->ConfigNeutralMode(CANJaguar::kNeutralMode_Brake);
backLeft->SetSafetyEnabled(false);
backLeft->ConfigEncoderCodesPerRev(360);
backLeft->EnableControl(0);
}
if(backRight->GetFaults()!=0)
{
backRight->ConfigNeutralMode(CANJaguar::kNeutralMode_Brake);
backRight->SetSafetyEnabled(false);
backRight->ConfigEncoderCodesPerRev(360);
backRight->EnableControl(0);
}
if(arm->GetFaults()!=0)
{
arm->SetPID(ARM_P, -.02, 0);
arm->ConfigNeutralMode(CANJaguar::kNeutralMode_Brake);
arm->SetSafetyEnabled(false);
arm->ConfigMaxOutputVoltage(13);
arm->SetPositionReference(CANJaguar::kPosRef_Potentiometer);
arm->ConfigPotentiometerTurns(1);
arm->EnableControl(0);
}
}
示例4: configJags
//CHECK THIS OUT!!
void RawControl::configJags() {
//will need to be tuned on the new robot
frontLeft->SetPID(3, .07, 0);//tested values are 1,.02,0
frontRight->SetPID(3, .09, 0);
backLeft->SetPID(1, .013, 0);
backRight->SetPID(1.2, .013, 0);
arm->SetPID(ARM_P, -.02, 0);
backLeft->ConfigNeutralMode(CANJaguar::kNeutralMode_Brake);
frontLeft->ConfigNeutralMode(CANJaguar::kNeutralMode_Brake);
frontRight->ConfigNeutralMode(CANJaguar::kNeutralMode_Brake);
backRight->ConfigNeutralMode(CANJaguar::kNeutralMode_Brake);
arm->ConfigNeutralMode(CANJaguar::kNeutralMode_Brake);
//shoot everything remotely safety related
backLeft->SetSafetyEnabled(false);
backRight->SetSafetyEnabled(false);
frontLeft->SetSafetyEnabled(false);
frontRight->SetSafetyEnabled(false);
arm->SetSafetyEnabled(false);
frontLeft->ConfigMaxOutputVoltage(13);
frontRight->ConfigMaxOutputVoltage(13);
backLeft->ConfigMaxOutputVoltage(13);
backRight->ConfigMaxOutputVoltage(13);
arm->ConfigMaxOutputVoltage(13);
frontLeft->SetSpeedReference(CANJaguar::kSpeedRef_Encoder);
frontRight->SetSpeedReference(CANJaguar::kSpeedRef_Encoder);
backRight->SetSpeedReference(CANJaguar::kSpeedRef_Encoder);
backLeft->SetSpeedReference(CANJaguar::kSpeedRef_Encoder);
arm->SetPositionReference(CANJaguar::kPosRef_Potentiometer);
//not sure on these values either
frontLeft->ConfigEncoderCodesPerRev(360);
frontRight->ConfigEncoderCodesPerRev(360);
backLeft->ConfigEncoderCodesPerRev(360);
backRight->ConfigEncoderCodesPerRev(360);
arm->ConfigPotentiometerTurns(1);
frontLeft->ChangeControlMode(CANJaguar::kPercentVbus);
frontRight->ChangeControlMode(CANJaguar::kPercentVbus);
backLeft->ChangeControlMode(CANJaguar::kPercentVbus);
backRight->ChangeControlMode(CANJaguar::kPercentVbus);
frontLeft->EnableControl(0);
frontRight->EnableControl(0);
backLeft->EnableControl(0);
backRight->EnableControl(0);
frontLeft->ConfigFaultTime(0);
backLeft->ConfigFaultTime(0);
backRight->ConfigFaultTime(0);
frontRight->ConfigFaultTime(0);
arm->ConfigFaultTime(0);
arm->EnableControl(0);
arm->EnableControl(0);
/*
fl=new CANJaguar(2,CANJaguar::kSpeed);
fr=new CANJaguar(3,CANJaguar::kSpeed);
bl=new CANJaguar(4,CANJaguar::kSpeed);
br=new CANJaguar(1,CANJaguar::kSpeed);
fl->SetSpeedReference(CANJaguar::kSpeedRef_Encoder);
fr->SetSpeedReference(CANJaguar::kSpeedRef_Encoder);
br->SetSpeedReference(CANJaguar::kSpeedRef_Encoder);
bl->SetSpeedReference(CANJaguar::kSpeedRef_Encoder);
fl->ConfigEncoderCodesPerRev(1440);
fr->ConfigEncoderCodesPerRev(1440);
bl->ConfigEncoderCodesPerRev(1440);
br->ConfigEncoderCodesPerRev(1440);
*/
}