本文整理汇总了C++中DriverStation::GetEnhancedIO方法的典型用法代码示例。如果您正苦于以下问题:C++ DriverStation::GetEnhancedIO方法的具体用法?C++ DriverStation::GetEnhancedIO怎么用?C++ DriverStation::GetEnhancedIO使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DriverStation
的用法示例。
在下文中一共展示了DriverStation::GetEnhancedIO方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetAnalogIn
float Cypress::GetAnalogIn(int channel) {
int getchan=abs(channel-4)+1;
if (enhanced)
return m_ds->GetEnhancedIO().GetAnalogIn(getchan);
else
return m_ds->GetAnalogIn(getchan);
}
示例2:
OI::OI() :
pIO(NULL),
driverStick(DRIVER_STICK),
gunnerStick(GUNNER_STICK)
{
DriverStation *pDS = DriverStation::GetInstance();
pIO = &pDS->GetEnhancedIO();
}
示例3: SetDigitalOut
void Cypress::SetDigitalOut(int channel, bool value) {
int getchan=abs(channel-8)+1;
if (enhanced) {
getchan+=8;
m_ds->GetEnhancedIO().SetDigitalOutput(getchan, value);
} else
m_ds->SetDigitalOut(getchan, value);
}
示例4: GetDigitalIn
bool Cypress::GetDigitalIn(int channel)
{
return m_ds->GetEnhancedIO().GetDigital(channel);
}
示例5: Joystick
MedicOperatorInterface::MedicOperatorInterface()
{
joyDrive = new Joystick(1);//TODO:real value
joyManip = new Joystick(2);//TODO:real value
DriverStation *dsSimple = DriverStation::GetInstance();
ds = &dsSimple->GetEnhancedIO();
dsLCD = DriverStationLCD::GetInstance();
dashboard->init();
}
示例6: OperatorControl
void OperatorControl(void)
{
autonomous = false;
//myRobot.SetSafetyEnabled(false);
//myRobot.SetInvertedMotor(kFrontLeftMotor, true);
// myRobot.SetInvertedMotor(3, true);
//variables for great pid
double rightSpeed,leftSpeed;
float rightSP, leftSP, liftSP, lastLiftSP, gripSP, tempLeftSP, tempRightSP;
float stickY[2];
float stickYAbs[2];
bool lightOn = false;
AxisCamera &camera = AxisCamera::GetInstance();
camera.WriteResolution(AxisCameraParams::kResolution_160x120);
camera.WriteMaxFPS(5);
camera.WriteBrightness(50);
camera.WriteRotation(AxisCameraParams::kRotation_0);
rightEncoder->Start();
leftEncoder->Start();
liftEncoder->Start();
rightEncoder->Reset();
leftEncoder->Reset();
liftEncoder->Reset();
bool fastest = false; //transmission mode
float reduction = 1; //gear reduction from
bool bDrivePID = false;
//float maxSpeed = 500;
float liftPower = 0;
float liftPos = -10;
bool disengageBrake = false;
int count = 0;
//int popCount = 0;
double popStart = 0;
double popTime = 0;
int popStage = 0;
int liftCount = 0;
int liftCount2 = 0;
const float LOG17 = log(17.61093344);
float liftPowerAbs = 0;
float gripError = 0;
float gripErrorAbs = 0;
float gripPropMod = 0;
float gripIntMod = 0;
bool shiftHigh = false;
leftEncoder->SetDistancePerPulse((6 * PI / 1000)/reduction); //6-inch wheels, 1000 raw counts per revolution,
rightEncoder->SetDistancePerPulse((6 * PI / 1000)/reduction); //about 1:1 gear ratio
DriverStationEnhancedIO &myEIO = driverStation->GetEnhancedIO();
GetWatchdog().SetEnabled(true);
GetWatchdog().SetExpiration(0.3);
PIDDriveLeft->SetOutputRange(-1, 1);
PIDDriveRight->SetOutputRange(-1, 1);
//PIDDriveLeft->SetInputRange(-244,244);
//PIDDriveRight->SetInputRange(-244,244);
PIDDriveLeft->SetTolerance(5);
PIDDriveRight->SetTolerance(5);
PIDDriveLeft->SetContinuous(false);
PIDDriveRight->SetContinuous(false);
//PIDDriveLeft->Enable();
//PIDDriveRight->Enable();
PIDDriveRight->SetPID(DRIVEPROPGAIN, DRIVEINTGAIN, DRIVEDERIVGAIN);
PIDDriveLeft->SetPID(DRIVEPROPGAIN, DRIVEINTGAIN, DRIVEDERIVGAIN);
liftSP = 0;
PIDLift->SetTolerance(10);
PIDLift->SetContinuous(false);
PIDLift->SetOutputRange(-0.75, 1.); //BUGBUG
PIDLift->Enable();
gripSP = 0;
float goalGripSP = 0;
bool useGoalSP = true;
bool gripPIDOn = true;
float gripP[10];
float gripI[10];
float gripD[10];
PIDGrip->SetOutputRange(-0.5, 0.28); //Negative goes up
PIDGrip->SetTolerance(5);
PIDGrip->SetSetpoint(0);
PIDGrip->Enable();
miniDep->Set(miniDep->kForward);
int i = 0;
while(i < 10)
{
gripP[i] = GRIPPROPGAIN;
i++;
}
i = 0;
while(i < 10)
{
gripI[i] = GRIPINTGAIN;
i++;
}
i = 0;
while(i < 10)
{
gripD[i] = GRIPDERIVGAIN;
i++;
}
//.........这里部分代码省略.........
示例7: DriveArm
void Arm::DriveArm() {
float claw_target= CLAW_OPEN;
DriverStation *ds = DriverStation::GetInstance();
if(ds->GetDigitalIn(3) && !ds->GetDigitalIn(4))
{
float tower_target = (ds->GetEnhancedIO().GetAnalogInRatio(1) * (TOWER_MAX - TOWER_MIN)) + TOWER_MIN;
float wrist_target = (ds->GetEnhancedIO().GetAnalogInRatio(3) * (WRIST_MAX-WRIST_MIN)) + WRIST_MIN;
if (tower_target > TOWER_MAX)
tower_target = TOWER_MAX;
else if (tower_target < TOWER_MIN)
tower_target = TOWER_MIN;
if (wrist_target < WRIST_MIN)
wrist_target = WRIST_MIN;
if (wrist_target > WRIST_MAX)
wrist_target = WRIST_MAX;
if (ds->GetDigitalIn(1)) {
claw_target = CLAW_CLOSED;
}
float tower_voltage = towerPID->GetOutput(GetTowerPot(), tower_target, 0,
.03) * -1;
float claw_voltage = clawPID->GetOutput(GetClawPot(), claw_target, 0, .1);
float wrist_voltage = wristPID->GetOutput(GetWristPot(), wrist_target, 0,
.2) * -1;
if(!towerLimit->Get() && tower_voltage < 0)
{
tower_voltage = 0;
towerMotor->Set(0);
}
if(fabs(claw_voltage) > .5)
wrist_voltage = 0;
towerMotor->Set(tower_voltage);
wristMotor->Set(wrist_voltage);
clawMotor->Set(claw_voltage);
}
else if(ds->GetDigitalIn(3) && ds->GetDigitalIn(4))
{
float tower_voltage = towerPID->GetOutput(GetTowerPot(), TOWER_AUTO_DOWN, 0,
.03) * -1;
float claw_voltage = clawPID->GetOutput(GetClawPot(), CLAW_OPEN, 0, .1);
float wrist_voltage = wristPID->GetOutput(GetWristPot(), WRIST_AUTO_DOWN, 0,
.2) * -1;
towerMotor->Set(tower_voltage);
wristMotor->Set(wrist_voltage);
clawMotor->Set(claw_voltage);
}
else if(!ds->GetDigitalIn(3) && ds->GetDigitalIn(4))
{
float tower_voltage = towerPID->GetOutput(GetTowerPot(), TOWER_AUTO_UP, 0,
.03) * -1;
float claw_voltage = clawPID->GetOutput(GetClawPot(), CLAW_CLOSED, 0, .1);
float wrist_voltage = wristPID->GetOutput(GetWristPot(), WRIST_AUTO_UP, 0,
.2) * -1;
towerMotor->Set(tower_voltage);
wristMotor->Set(wrist_voltage);
clawMotor->Set(claw_voltage);
}
}
示例8: RobotInit
/**
* Robot-wide initialization code should go here.
*
* Use this method for default Robot-wide initialization which will
* be called when the robot is first powered on. It will be called exactly 1 time.
*/
void RobotInit()
{
printf(">>> RobotInit\n");
LogInit();
#ifdef HAVE_COMPRESSOR
compressor = new Compressor(1, 1);
#endif
#ifdef HAVE_TOP_WHEEL
#ifdef HAVE_TOP_CAN1
topWheel1 = new CANJaguar(1);
topWheel1->SetSafetyEnabled(false); // motor safety off while configuring
topWheel1->SetSpeedReference( CANJaguar::kSpeedRef_Encoder );
topWheel1->ConfigEncoderCodesPerRev( 1 );
#endif
#ifdef HAVE_TOP_PWM1
topWheel1 = new Victor(1);
topWheel1->SetSafetyEnabled(false); // motor safety off while configuring
#endif
#ifdef HAVE_TOP_CAN2
topWheel2 = new CANJaguar(2);
topWheel2->SetSafetyEnabled(false); // motor safety off while configuring
topWheel2->SetSpeedReference( CANJaguar::kSpeedRef_Encoder );
topWheel2->ConfigEncoderCodesPerRev( 1 );
#endif
topTach = new Tachometer(2);
#endif
#ifdef HAVE_BOTTOM_WHEEL
#ifdef HAVE_BOTTOM_CAN1
bottomWheel1 = new CANJaguar(3);
bottomWheel1->SetSafetyEnabled(false); // motor safety off while configuring
bottomWheel1->SetSpeedReference( CANJaguar::kSpeedRef_Encoder );
bottomWheel1->ConfigEncoderCodesPerRev( 1 );
#endif
#ifdef HAVE_BOTTOM_PWM1
bottomWheel1 = new Victor(2);
bottomWheel1->SetSafetyEnabled(false); // motor safety off while configuring
#endif
#ifdef HAVE_BOTTOM_CAN2
bottomWheel2 = new CANJaguar(4);
bottomWheel2->SetSafetyEnabled(false); // motor safety off while configuring
bottomWheel2->SetSpeedReference( CANJaguar::kSpeedRef_Encoder );
bottomWheel2->ConfigEncoderCodesPerRev( 1 );
#endif
bottomTach = new Tachometer(3);
#endif
#ifdef HAVE_ARM
arm = new DoubleSolenoid(2, 1);
#endif
#ifdef HAVE_INJECTOR
injectorL = new DoubleSolenoid(5, 3);
injectorR = new DoubleSolenoid(6, 4);
#endif
#ifdef HAVE_EJECTOR
ejector = new Solenoid(7);
#endif
#ifdef HAVE_LEGS
legs = new Solenoid(8);
#endif
ds = DriverStation::GetInstance();
eio = &ds->GetEnhancedIO();
gamepad = new Joystick(1);
LiveWindow *lw = LiveWindow::GetInstance();
#ifdef HAVE_COMPRESSOR
lw->AddActuator("K9", "Compressor", compressor);
#endif
#ifdef HAVE_TOP_WHEEL
#ifdef HAVE_TOP_CAN1
lw->AddActuator("K9", "Top1", topWheel1);
#endif
#ifdef HAVE_TOP_PWM1
lw->AddActuator("K9", "Top1", topWheel1);
#endif
#ifdef HAVE_TOP_CAN2
lw->AddActuator("K9", "Top2", topWheel2);
#endif
#endif
#ifdef HAVE_BOTTOM_WHEEL
#ifdef HAVE_BOTTOM_CAN1
lw->AddActuator("K9", "Bottom1", bottomWheel1);
#endif
#ifdef HAVE_BOTTOM_PWM1
lw->AddActuator("K9", "Bottom1", bottomWheel1);
#endif
#ifdef HAVE_BOTTOM_CAN2
lw->AddActuator("K9", "Bottom2", bottomWheel2);
#endif
#endif
//.........这里部分代码省略.........