本文整理汇总了C++中Encoder::SetPIDSourceParameter方法的典型用法代码示例。如果您正苦于以下问题:C++ Encoder::SetPIDSourceParameter方法的具体用法?C++ Encoder::SetPIDSourceParameter怎么用?C++ Encoder::SetPIDSourceParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Encoder
的用法示例。
在下文中一共展示了Encoder::SetPIDSourceParameter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CANTalon
Robot()
{
#if BUILD_VERSION == COMPETITION
liftMotor = new CANTalon(CHAN_LIFT_MOTOR);
liftMotor2 = new CANTalon(CHAN_LIFT_MOTOR2);
#else
liftMotor = new CANJaguar(CHAN_LIFT_MOTOR);
liftMotor2 = new CANJaguar(CHAN_LIFT_MOTOR2);
#endif
liftEncoder = new Encoder(CHAN_LIFT_ENCODER_A, CHAN_LIFT_ENCODER_B, false, Encoder::EncodingType::k4X);
liftEncoder->SetDistancePerPulse(LIFT_ENCODER_DIST_PER_PULSE);
liftEncoder->SetPIDSourceParameter(liftEncoder->kDistance);
#if BUILD_VERSION == COMPETITION
liftEncoder->SetReverseDirection(true);
#endif
controlLift = new PIDController(PID_P, PID_I, PID_D, liftEncoder, liftMotor);
controlLift->SetContinuous(true); //treat input to controller as continuous; true by default
controlLift->SetOutputRange(PID_OUT_MIN, PID_OUT_MAX);
controlLift->Disable(); //do not enable until in holding position mode
controlLift2 = new PIDController(PID_P, PID_I, PID_D, liftEncoder, liftMotor2);
controlLift2->SetContinuous(true); //treat input to controller as continuous; true by default
controlLift2->SetOutputRange(PID_OUT_MIN, PID_OUT_MAX);
controlLift2->Disable(); //do not enable until in holding position mode
liftLimitSwitchMin = new DigitalInput(CHAN_LIFT_LOW_LS);
liftLimitSwitchMax = new DigitalInput(CHAN_LIFT_HIGH_LS);
joystick = new Joystick(CHAN_JS);
}
示例2: Timer
FECLift()
{
theTimer = new Timer();
//initialized the jag
theJag = new Jaguar(JAGPORT);
fakeEncoder = new Encoder(6,6,6,7,fakeEncoder->k4X);
theEncoder = new Encoder(ENCODERSLOTA, ENCODERCHANNELA, ENCODERSLOTB, ENCODERCHANNELB, false, theEncoder->k4X);
#if RATE
theEncoder->SetPIDSourceParameter(Encoder::kRate);
#else
theEncoder->SetPIDSourceParameter(Encoder::kDistance);
#endif
theEncoder->SetDistancePerPulse(DISTANCE_PER_PULSE);
driverStation = DriverStation::GetInstance();
theLift = new PIDController(P,I,D,theEncoder,theJag);
GetWatchdog().SetExpiration(.3);
decel = false;
done = false;
writing = true;
closed = false;
initFile();
}