BuiltinDefaultCode() { m_robotDrive = new RobotDrive (m_lDrive, m_rDrive); m_driver = new Joystick (1); m_operator = new Joystick (2); m_rDrive = new Victor (1); m_lDrive = new Victor (2); m_climber = new Victor (3); m_plate1 = new Victor (8); m_plate2 = new Victor (10); m_launcher1 = new Victor (4); m_launcher2 = new Victor (5); m_launcher3 = new Victor (6); m_feeder = new Victor (7); m_ratchet = new Relay (1); m_left = new Encoder (1,2,true); m_left->SetDistancePerPulse(1); m_left->SetMaxPeriod(1.0); m_left->Start(); m_right = new Encoder (3,4,false); m_right->SetDistancePerPulse(1); m_right->SetMaxPeriod(1.0); m_right->Start(); m_plateh = new AnalogChannel (1); m_climberp = new AnalogChannel (2); m_dsLCD = DriverStationLCD::GetInstance(); }
void RobotInit () { lw = LiveWindow::GetInstance(); CameraServer::GetInstance()->SetQuality(50); //the camera name (ex "cam0") can be found through the roborio web interface CameraServer::GetInstance()->StartAutomaticCapture("cam1"); AutonState = 0; ballarm.Reset(); ballarm.SetMaxPeriod(.01); ballarm.SetMinRate(.02); ballarm.SetDistancePerPulse(.9); gyroOne.Calibrate(); UpdateActuatorCmnds(0,0,false,false,false,false,false,false,false,0,0,0,0,0); UpdateSmartDashboad(false, false, false, false, false, 0, 0, 0, 0, 0, 0, 0, 0, 0); }
BuiltinDefaultCode() { //Initialze drive controllers m_rDrive1 = new Talon (1); m_rDrive2 = new Talon (2); m_lDrive1 = new Talon (3); m_lDrive2 = new Talon (4); //Initialize ramrod motor m_ramMotor = new Talon (5); //Initialize Arm m_arm = new ArmWrapper (7, 6, 5, 6, 10); m_arm->StartPID(0.0, 0.0, 0.0); //initialize bGrabber motor m_roller = new Talon (8); //Initialize ramrod servo m_ramServo = new Servo (9); //Initialize drive wrappers m_rDrive = new DriveWrapper (m_rDrive1, m_rDrive2); m_lDrive = new DriveWrapper (m_lDrive1, m_lDrive2); //Initialize robot drive m_robotDrive = new RobotDrive (m_lDrive, m_rDrive); //Initialize ramrod encoder m_ramEncoder = new Encoder (7,8,false); m_ramEncoder->SetDistancePerPulse(1); m_ramEncoder->SetMaxPeriod(1.0); m_ramEncoder->Start(); //Initialize Compressor m_compressor = new Compressor(9, 1); //shifters m_shifters = new Solenoid(1); //Initialize bGrabber Solenoids m_bArm = new Solenoid (2); m_catch = new Solenoid (3); //Initialize joysticks m_driver = new JoystickWrapper (1); m_operator = new JoystickWrapper (2); //Grab driver station object m_dsLCD = DriverStationLCD::GetInstance(); }
RobotDemo(void): leftDriveMotor(LEFT_DRIVE_PWM), rightDriveMotor(RIGHT_DRIVE_PWM), myRobot(&leftDriveMotor, &rightDriveMotor), // these must be initialized in the same order stick(1), // as they are declared above. stick2(2), gamepad(3), collectorMotor(PICKUP_PWM), indexerMotor(INDEX_PWM), shooterMotor(SHOOTER_PWM), armMotor (ARM_PWM), leftDriveEncoder(LEFT_DRIVE_ENC_A, LEFT_DRIVE_ENC_B), shifter(SHIFTER_A,SHIFTER_B), greenClaw(CLAW_1_LOCKED, CLAW_1_UNLOCKED), yellowClaw(CLAW_2_LOCKED, CLAW_2_UNLOCKED), potentiometer(ARM_ROTATION_POT), indexSwitch(INDEXER_SW), greenClawLockSwitch(CLAW_1_LOCK_SENSOR), yellowClawLockSwitch(CLAW_2_LOCK_SENSOR), compressor(COMPRESSOR_PRESSURE_SW, COMPRESSOR_SPIKE), jogTimer(), shooterTimer() { m_collectorMotorRunning = false; m_shooterMotorRunning = false; m_jogTimerRunning = false; m_shiftCount = MAX_SHIFTS; dsLCD = DriverStationLCD::GetInstance(); dsLCD->Clear(); dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "2013 " NAME); dsLCD->PrintfLine(DriverStationLCD::kUser_Line2, __DATE__ " "__TIME__); dsLCD->UpdateLCD(); myRobot.SetExpiration(0.1); shifter.Set(DoubleSolenoid::kReverse); leftDriveEncoder.SetDistancePerPulse(DRIVE_ENCODER_DISTANCE_PER_PULSE); leftDriveEncoder.SetMaxPeriod(1.0); leftDriveEncoder.SetReverseDirection(true); // change to true if necessary leftDriveEncoder.Start(); }
void TeleopInit() { // Initialize the encoder sampleEncoder = new Encoder(0, 1, false, Encoder::EncodingType::k4X); sampleEncoder->SetMaxPeriod(.1); sampleEncoder->SetMinRate(10); sampleEncoder->SetDistancePerPulse(5); sampleEncoder->SetReverseDirection(true); sampleEncoder->SetSamplesToAverage(7); // Initialize the joystick joystick = new Joystick(0); // Initialize the motor motor = new Victor(9); // Initialize the gear tooth counter toothTrigger = new AnalogTrigger(3); toothTrigger->SetLimitsRaw(250, 3600); gearToothCounter = new Counter(toothTrigger); // gearToothCounter->SetUpDownCounterMode(); }
/** * Sets the maximum period for stopped detection. * Sets the value that represents the maximum period of the Encoder before it will assume * that the attached device is stopped. This timeout allows users to determine if the wheels or * other shaft has stopped rotating. * This method compensates for the decoding type. * * @deprecated Use SetEncoderMinRate() in favor of this method. This takes unscaled periods and SetMinEncoderRate() scales using value from SetEncoderDistancePerPulse(). * * @param maxPeriod The maximum time between rising and falling edges before the FPGA will * report the device stopped. This is expressed in seconds. * * @param aSlot The digital module slot for the A Channel on the encoder * @param aChannel The channel on the digital module for the A Channel of the encoder * @param bSlot The digital module slot for the B Channel on the encoder * @param bChannel The channel on the digital module for the B Channel of the encoder */ void SetMaxEncoderPeriod(UINT32 aSlot, UINT32 aChannel, UINT32 bSlot, UINT32 bChannel, double maxPeriod) { Encoder *encoder = AllocateEncoder(aSlot, aChannel, bSlot, bChannel); if (encoder != NULL) encoder->SetMaxPeriod(maxPeriod); }