RobotDemo(void): myRobot(2, 3), // these must be initialized in the same order stick(1), // as they are declared above. vic(1) { myRobot.SetExpiration(0.1); }
RobotDemo(void) { kicker_in_motion = false; sol = new Solenoid(2); rightstick = new Joystick(1); leftstick = new Joystick(2); lonelystick = new Joystick (3); Motor1=new Jaguar(1); Motor2=new Jaguar(2); Motor3=new Jaguar(3); Motor4=new Jaguar(4); BallGathererMotor9 = new Jaguar(9); myRobot=new RobotDrive(Motor1,Motor2,Motor4,Motor3); rlyLED=new Relay(8,Relay::kForwardOnly); cam = &AxisCamera::GetInstance("10.8.12.11"); cam->WriteResolution(AxisCameraParams::kResolution_160x120); myRobot->SetExpiration(0.5); ControllBox = & DriverStation::GetInstance()->GetEnhancedIO(); shooter1 = new Jaguar(5); //front left shooter2 = new Jaguar(6); shooter3 = new Jaguar(7); shooter4 = new Jaguar(8); //shooterDin = new DigitalInput(1); shootercontador = new Counter(1); shootercontador->Start(); shooterspeedTask = new Task("ShooterSpeed",(FUNCPTR)&shooterspeedloop); kickerTask = new Task ("Kicker", (FUNCPTR)&kickerloop); Upperlimit = new DigitalInput(3); Lowerlimit = new DigitalInput(2); kickermotor = new Relay (6, Relay::kBothDirections); BridgeBootMotor10 = new Jaguar(10); kicker_cancel = false; kicker_down = false; }
RobotDemo(): myRobot(1, 2), // these must be initialized in the same order stick(1) // as they are declared above. { cout << "Good morning!" << endl; myRobot.SetExpiration(0.1); }
RobotDemo(): myRobot(1, 2), // these must be initialized in the same order stick(1) // as they are declared above. { myRobot.SetExpiration(0.1); this->SetPeriod(0); //Set update period to sync with robot control packets (20ms nominal) }
Robot() : timer(), robotDrive(Constants::driveFrontLeftPin, Constants::driveRearLeftPin, Constants::driveFrontRightPin, Constants::driveRearRightPin),//tells the robot where everything is plugged in i2c(I2C::kOnboard,Constants::ledAddress), driveStick(Constants::driveStickChannel), grabStick(Constants::grabStickChannel), prox(Constants::driveUltrasonicPin), grabTalon(Constants::grabTalonPin), grabInnerLimit(Constants::grabInnerLimitPin), grabOuterLimit(Constants::grabOuterLimitPin), liftTalon(Constants::liftTalonPin), liftEncoder(Constants::liftEncoderAPin, Constants::liftEncoderBPin), liftUpperLimit(Constants::liftUpperLimitPin), liftLowerLimit(Constants::liftLowerLimitPin), grabEncoder(Constants::grabEncoderAPin, Constants::grabEncoderBPin), pdp(), gyro(Constants::driveGyroRate), pickup(grabTalon, grabInnerLimit, grabOuterLimit, liftTalon, liftEncoder, liftUpperLimit, liftLowerLimit, pdp) { robotDrive.SetExpiration(0.1); // safety feature robotDrive.SetInvertedMotor(RobotDrive::kFrontRightMotor, true); // make the motors go the right way robotDrive.SetInvertedMotor(RobotDrive::kRearRightMotor, true); robotDrive.SetInvertedMotor(RobotDrive::kRearLeftMotor, true); liftEncoder.SetReverseDirection(Constants::liftEncoderReverse); }
Robot() : myRobot(0, 1), // these must be initialized in the same order joystick(0), // as they are declared above. crochets(2) { myRobot.SetExpiration(0.1); }
RobotDemo(void): myRobot(LEFT_DRIVE_PWM, RIGHT_DRIVE_PWM), // 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), 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), compressor(COMPRESSOR_PRESSURE_SW, COMPRESSOR_SPIKE) { m_collectorMotorRunning = false; m_shooterMotorRunning = false; dsLCD = DriverStationLCD::GetInstance(); dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "2013 " NAME); dsLCD->PrintfLine(DriverStationLCD::kUser_Line2, __DATE__ " "__TIME__); dsLCD->UpdateLCD(); myRobot.SetExpiration(0.1); shifter.Set(DoubleSolenoid::kReverse); }
RobotDemo(void): myRobot(1,2), // these must be initialized in the same order newStick(1) { myRobot.SetExpiration(0.1); }
Robot() : robotDrive(frontLeftChannel, rearLeftChannel, frontRightChannel, rearRightChannel), // initialize variables in same stick(joystickChannel) // order as declared above. { rotateToAngleRate = 0.0f; robotDrive.SetExpiration(0.1); robotDrive.SetInvertedMotor(RobotDrive::kFrontLeftMotor, true); // invert left side motors robotDrive.SetInvertedMotor(RobotDrive::kRearLeftMotor, true); // change to match your robot try { /* Communicate w/navX MXP via the MXP SPI Bus. */ /* Alternatively: I2C::Port::kMXP, SerialPort::Port::kMXP or SerialPort::Port::kUSB */ /* See http://navx-mxp.kauailabs.com/guidance/selecting-an-interface/ for details. */ ahrs = new AHRS(SPI::Port::kMXP); } catch (std::exception ex ) { std::string err_string = "Error instantiating navX MXP: "; err_string += ex.what(); DriverStation::ReportError(err_string.c_str()); } turnController = new PIDController(kP, kI, kD, kF, ahrs, this); turnController->SetInputRange(-180.0f, 180.0f); turnController->SetOutputRange(-1.0, 1.0); turnController->SetAbsoluteTolerance(kToleranceDegrees); turnController->SetContinuous(true); /* Add the PID Controller to the Test-mode dashboard, allowing manual */ /* tuning of the Turn Controller's P, I and D coefficients. */ /* Typically, only the P value needs to be modified. */ LiveWindow::GetInstance()->AddActuator("DriveSystem", "RotateController", turnController); if ( ahrs ) { LiveWindow::GetInstance()->AddSensor("IMU", "Gyro", ahrs); } }
RobotDemo(void) // these must be initialized in the same order, ports 8 and nine are not being used { /*Initialize all the yummy delicious variables, they are so yummy and tasty! Gotta love em :D * hoho * hoohoh * hohoho * hehehe, love it */ bar = new Servo (7); bar2= new Servo (8); stick = new Joystick(1); rightstick = new Joystick(2); //belt= new Jaguar(5); JagBelt= new RobotDrive(5,10); //Drive = new RobotDrive(2,1); myRobot = new RobotDrive(2,1); cim1 = new Jaguar(3); cim2= new Jaguar(6); pickStop= new Jaguar(4); spike = new Relay(1); window= new Relay(2); limitSwitch = new DigitalInput(1); dash = DriverStation::GetInstance(); dsLCD = DriverStationLCD::GetInstance(); rangeFinder = new AnalogChannel(5); gyro = new AnalogChannel(6); Temperature = new AnalogChannel(7); accelerometer = new ADXL345_I2C (1,ADXL345_I2C::kRange_2G); //float Ri = (Vm/9.765625); myRobot->SetExpiration(0.1); }
// The initializer of dooooooom!!!!! Robot() : myRobot(0, 1), // these must be initialized in the same order rStick(RIGHT_JOYSTICK_INPUT_CHANNEL), // as they are declared above. lStick(LEFT_JOYSTICK_INPUT_CHANNEL), gamePad(GAMEPAD_INPUT_CHANNEL), lw(LiveWindow::GetInstance()), autoLoopCounter(0), gyro(GYRO_INPUT_CHANNEL), encoder1(ENCODER_CHANNEL_1A, ENCODER_CHANNEL_1B), encoder2(ENCODER_CHANNEL_2A, ENCODER_CHANNEL_2B), lifterEncoder(LIFTER_ENCODER_CHANNEL_1, LIFTER_ENCODER_CHANNEL_2), ballManipulatorEncoder(B_MANIPULATOR_ENCODER_CHANNEL_1, B_MANIPULATOR_ENCODER_CHANNEL_2), lifter(LIFTER_CHANNEL_LIFT, LIFTER_CHANNEL_TILT, lifterEncoder), ballManipulator(B_MANIPULATOR_CHANNEL_LIFT, B_MANIPULATOR_CHANNEL_PINCH, ballManipulatorEncoder) { myRobot.SetExpiration(0.1); driveOption = TANK_GAMEPAD; gyro.InitGyro(); showGyro = true; showEncoderRaw = true; showEncoderRate = false; showEncoderIndex = false; autoTurn = 0; }
RobotDemo(void): myRobot(1, 2), // these must be initialized in the same order stick(1) // as they are declared above. { myRobot.SetExpiration(0.1); kinect = Kinect::GetInstance(); //dash = SmartDashboard::GetInstance(); //Optional SmartDashboard logging }
Robot() : myRobot(0, 1), // these must be initialized in the same order gPad(GAMEPAD_CHANNEL), // as they are declared above. lw(LiveWindow::GetInstance()), autoLoopCounter(0) { myRobot.SetExpiration(0.1); }
Robot() : myRobot(0, 1, 2, 3), //Remember to initialize things in the same order that they're declared stick(0), lw(LiveWindow::GetInstance()), autoloopcounter(0) { myRobot.SetExpiration(0.1); }
Robot() : myRobot(0, 1), // these must be initialized in the same order stick(0), // as they are declared above. chooser() { //Note SmartDashboard is not initialized here, wait until RobotInit to make SmartDashboard calls myRobot.SetExpiration(0.1); }
Robot() : robotDrive(new Talon(frontLeftChannel), new Talon(rearLeftChannel), new Talon(frontRightChannel), new Talon(rearRightChannel)), stick( STICK_CHANNEL), liftStick(LIFTSTICK_CHANNEL), chainLift( CHAINLIFT_PWM), maxUp(MAXUP_DIO), maxDown(MAXDOWN_DIO), midPoint( MIDPOINT_DIO), autoSwitch1(AUTOSWITCH1_DIO), autoSwitch2( AUTOSWITCH2_DIO), leftIR(LEFTIR_LOC), rightIR(RIGHTIR_LOC), canGrabber( CANGRAB_PWM) { SmartDashboard::init(); ds = DriverStation::GetInstance(); SmartDashboard::PutString("STATUS:", "INITIALIZING"); robotDrive.SetExpiration(0.1); robotDrive.SetInvertedMotor(RobotDrive::kFrontLeftMotor, true); robotDrive.SetInvertedMotor(RobotDrive::kRearLeftMotor, true); autoMode = new SendableChooser(); autoMode->AddDefault("00: Do Nothing", new AutonomousIndex(0)); autoMode->AddObject("01: Just Drive Forward", new AutonomousIndex(1)); autoMode->AddObject("02: Stack bin on tote, turn 90, go", new AutonomousIndex(2)); autoMode->AddObject("03: Lift up and go forward", new AutonomousIndex(3)); autoMode->AddObject("04: Lift up, turn 90, go", new AutonomousIndex(4)); autoMode->AddObject("05: Stack 3 bins w/ correction constant", new AutonomousIndex(5)); autoMode->AddObject("06: Stack 3 bins w/ acclerometer", new AutonomousIndex(6)); autoMode->AddObject("07: Grab first bin from landfill", new AutonomousIndex(7)); autoMode->AddObject("08: Grab yellow bin and back up TO RAMP", new AutonomousIndex(8)); autoMode->AddObject("09: Grab two bins from landfill, slide sideways", new AutonomousIndex(9)); autoMode->AddObject("10: Grab from landfill, over by turning", new AutonomousIndex(10)); autoMode->AddObject("11: Grab yellow bin, back up to AUTOZONE, drop", new AutonomousIndex(11)); autoMode->AddObject("12: Grab yellow bin, back up to AUTOZONE, stop", new AutonomousIndex(12)); autoMode->AddObject("13: Steal two green cans. Gottta go fast", new AutonomousIndex(13)); autoMode->AddObject("99: CUPID SHUFFLE", new AutonomousIndex(99)); SmartDashboard::PutString("Both Off", "Pick from radio list"); SmartDashboard::PutString("On-Off", "Grab yellow and back up"); SmartDashboard::PutString("Off-On", "Grab, turn right, drive, turn left"); SmartDashboard::PutString("Both On", "Lift up, turn 90, drive to auto zone"); SmartDashboard::PutData("BOTH SWITCHES ON: Pick One:", autoMode); SmartDashboard::PutData(Scheduler::GetInstance()); SmartDashboard::PutString("STATUS:", "READY"); SmartDashboard::PutBoolean("Smart Dashboard Enabled", false); tick = 0; leftIRZero = 0; rightIRZero = 0; }
Robot() : myRobot(0, 1), // initialize robot to drive on ports 0 and 1 stick(0) { myRobot.SetExpiration(0.1); camera.SetWhiteBalanceAuto(); //set the camera's white balance to auto camera.SetExposureAuto(); //set the camera's exposure to auto camera.UpdateSettings(); //make sure the camera's settings are up to date }
Wheels() { drive = new RobotDrive(0,2,4,3); //frontLeft, rearLeft, frontRight, rearRight drive->SetInvertedMotor(RobotDrive::kFrontLeftMotor, true); // 0 is front left wheel drive->SetInvertedMotor(RobotDrive::kRearLeftMotor, true); // 2 is back left wheel drive->SetExpiration(0.1); drive->SetSafetyEnabled(true); driveSafety = new MotorSafetyHelper(drive); }
void TeleopInit() override { drive->SetExpiration(200000); drive->SetSafetyEnabled(false); liftdown->Set(false); intake_hold = false; lastLiftPos = 0; manual = true; }
SixWheelBot(void): //BUGBUG This probably won't work right now--don't run it myRobot(1, 2, 3, 4), // these must be initialized in the same order stickL(1), stickR(2) // as they are declared above. { myRobot.SetExpiration(0.1); left = new DigitalInput(1); middle = new DigitalInput(2); right = new DigitalInput(3); }
RobotDemo(void): myRobot(1, 2), // these must be initialized in the same order stick(1) // as they are declared above. { dsLCD = DriverStationLCD::GetInstance(); dsLCD->Clear(); dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "XboxController2"); dsLCD->UpdateLCD(); myRobot.SetExpiration(0.1); }
/** * * * Constructor for this robot subclass. * Create an instance of a RobotDrive with left and right motors plugged into PWM * ports 1 and 2 on the first digital module. */ DefaultRobot(void) { ds = DriverStation::GetInstance(); myRobot = new RobotDrive(1, 3, 2, 4); // create robot drive base rightStick = new Joystick(1); // create the joysticks leftStick = new Joystick(2); armStick = new Joystick(3); armUpperLimit = new DigitalInput(1); // create the limit switch inputs armLowerLimit = new DigitalInput(2); //Update the motors at least every 100ms. myRobot->SetExpiration(0.1); }
RobotDemo(void): myRobot(8, 1, 9, 2), stick(1), digEncoder(13, 14), ultra(1, 1) { myRobot.SetExpiration(0.1); myRobot.SetInvertedMotor(myRobot.kFrontRightMotor, true); //myRobot.SetInvertedMotor(myRobot.kFrontLeftMotor, true); myRobot.SetInvertedMotor(myRobot.kRearRightMotor, true); //myRobot.SetInvertedMotor(myRobot.kRearLeftMotor, true); }
Robot() : myRobot(0, 1), // these must be initialized in the same order driverStick(DRIVER_CONTROL_PORT), // as they are declared above. operatorStick(OPERATOR_CONTROL_PORT), leftDrive(LEFT_DRIVE_MOTOR_PWM), rightDrive(RIGHT_DRIVE_MOTOR_PWM), leftLift(LEFT_LIFT_MOTOR_PWM), rightLift(RIGHT_LIFT_MOTOR_PWM), leftIntake(LEFT_INTAKE_MOTOR_PWM), rightIntake(RIGHT_INTAKE_MOTOR_PWM) { myRobot.SetExpiration(0.1); }
//Class constructor // Initialize the robot drive to: // Drive base: // Left Front Right // +---------------------+ // | PWM 9 PWM 7| // | Robot | // | PWM 8 PWM 6| // +---------------------+ // Back Robot() : robotDrive(9, 8, 7, 6), // these must be initialized in the same order leftStick(0), rightStick(1),// as they are declared above. lw(NULL), autoLoopCounter(0) { robotDrive.SetExpiration(0.1); robotDrive.SetInvertedMotor(robotDrive.kFrontLeftMotor,false); robotDrive.SetInvertedMotor(robotDrive.kFrontRightMotor,false); robotDrive.SetInvertedMotor(robotDrive.kRearLeftMotor,false); robotDrive.SetInvertedMotor(robotDrive.kRearRightMotor,false); }
//Constructor (initialize variables) Robot (void){ // Create a robot using standard right/left robot drive on PWMS 1, 2, 9, and 10 drivetrain = new RobotDrive(1, 2, 9, 10); // overrides the default expiration time (0.5 seconds) and sets to 15 seconds, the length of autonomous drivetrain->SetExpiration(15); //Declare compressor //(switch-GPIO, relay) compressor=new Compressor(3,1); // Acquire the Driver Station object // GetInstance gets a pointer to a driver station object m_ds = DriverStation::GetInstance(); // Define joystick USB ports on the Drivers Station gamepad = new Joystick(1); //Define encoder (channel A, channel B, true, k4X) //true tells the encoder to not invert the counting direction //right_encoder = new Encoder(1, 2, true); //left_encoder = new Encoder(1, 2, true); //Solenoids drivetrain_pressure=new Solenoid(1); drivetrain_vent=new Solenoid(8); // Define global variables here //DriveTrainValues threshold=0.2; right=0; left=0; oldright=0; oldleft=0; useright=0; useleft=0; leftchange=0; rightchange=0; leftdead=0.04; //was 0.02 rightdead=0.04; //was 0.02k //Encoder encoder_value =0; }
Robot() : frontLeftChannel(15), frontRightChannel(11), rearLeftChannel(12), rearRightChannel(10), robotDrive(frontLeftChannel, rearLeftChannel, frontRightChannel, rearRightChannel), // these must be initialized in the same order stick(joystickChannel) // as they are declared above. { robotDrive.SetExpiration(0.1); robotDrive.SetInvertedMotor(RobotDrive::kFrontLeftMotor, true); // invert the motors robotDrive.SetInvertedMotor(RobotDrive::kRearLeftMotor, true); robotDrive.SetInvertedMotor(RobotDrive::kFrontRightMotor, true); robotDrive.SetInvertedMotor(RobotDrive::kRearRightMotor, true); // you may need to change or remove this to match your robot }
Robot() : myRobot(0, 1), // initialize the RobotDrive to use motor controllers on ports 0 and 1 stick(0), lw(LiveWindow::GetInstance()), chooser(NULL), autoSelected(), imu(NULL), m_rightBumper(false), m_prevRightBumper(false), m_leftBumper(false), m_prevLeftBumper(false), m_correcting1(false), m_correcting2(false) { myRobot.SetExpiration(0.1); }
Robot() : robotDrive(Motor1, Motor2), // these must be initialized in the same order stick(5), // as they are declared above. lw(LiveWindow::GetInstance()), autoLoopCounter(0), Motor1(21), Motor2(12), Slave1(20), Slave2(14), t_motor(13), arm_Motor(23), finger_Motor(22), intake_Spin_Motor(11), intake_Winch_Motor(13), stick2(4), autoLoopCounter2(0) { robotDrive.SetExpiration(0.1); robotDrive.SetSafetyEnabled(false); Slave1.SetControlMode(CANSpeedController::kFollower); Slave1.Set(21); Slave2.SetControlMode(CANSpeedController::kFollower); Slave2.Set(12); Motor2.SetInverted(true); //12 Slave2.SetInverted(true);//14 arm_Motor.SetInverted(false);//23 t_motor.SetInverted(true);//23 // t_motor.SetControlMode(CANSpeedController::kVoltage); // t_motor.Set(0); // CameraServer::GetInstance()->SetQuality(50); // CameraServer::GetInstance()->SetSize(2); // //the camera name (ex "cam0") can be found through the roborio web interface // CameraServer::GetInstance()->StartAutomaticCapture("cam0"); t_motor.SetControlMode(CANSpeedController::kPercentVbus); // t_motor.SetVoltageCompensationRampRate(24.0); t_motor.SetFeedbackDevice(CANTalon::QuadEncoder); t_motor.SetPosition(0); // t_motor.SetPID(1, 0, 0); arm_Motor.SetControlMode(CANSpeedController::kPercentVbus); finger_Motor.SetControlMode(CANSpeedController::kPercentVbus); // ourRangefinder = new AnalogInput(0); }
RobotDemo(): myRobot(1,2,3,4), //front left, rear left, front right, rear right (10,4,3,7) for whack (purple, yellow, green, red) shoot(10), stick(1), // usb number shooter(6), forklift(5), winch(7), shooterSole(2,3),//initialize festo valves //forward channel, reverse channel compressor(3, 3), //(pressure switch channel, compressor relay channel) or //(pressure switch module number, pressure switch channel, compressor relay module number, compressor relay channel) shooterEnconder(5,6,false)//uint32_t aChannel, uint32_t bChannel, bool reverseDirection=false, EncodingType encodingType=k4X { myRobot.SetExpiration(0.1); camera = AxisCamera::GetInstance(); }