public void autonomousPeriodic() { // feed the user watchdog at every period when in autonomous Watchdog.getInstance().feed(); m_autoPeriodicLoops++; // generate KITT-style LED display on the solenoids SolenoidLEDsKITT( m_autoPeriodicLoops ); /* the below code (if uncommented) would drive the robot forward at half speed * for two seconds. This code is provided as an example of how to drive the * robot in autonomous mode, but is not enabled in the default code in order * to prevent an unsuspecting team from having their robot drive autonomously! */ /* below code commented out for safety if (m_autoPeriodicLoops == 1) { // When on the first periodic loop in autonomous mode, start driving forwards at half speed m_robotDrive->Drive(0.5, 0.0); // drive forwards at half speed } if (m_autoPeriodicLoops == (2 * GetLoopsPerSec())) { // After 2 seconds, stop the robot m_robotDrive->Drive(0.0, 0.0); // stop robot } */ }
public void robotInit() { //Com.ps = new Communication.PISocket(true); /* try{ Com.ps.init(true); Com.ps.GetData(); } catch (Exception ex) { ex.printStackTrace(); } */ wd = Watchdog.getInstance(); wd.setExpiration(0.5); SI.init(); IM.init(); MC.init(); wd.feed(); }
/** * This function is called periodically during autonomous */ public void autonomousPeriodic() { try { for (int i = 0; i < components.length; ++i) components[i].tickAuto(); } catch (Exception e) { e.printStackTrace(); Watchdog.getInstance().kill(); } }
/** * This function is called periodically during operator control */ public void teleopPeriodic() { try { for (int i = 0; i < components.length; ++i) components[i].tickTeleop(); } catch (Exception e) { e.printStackTrace(); Watchdog.getInstance().kill(); } }
public void disabledPeriodic() { // feed the user watchdog at every period when disabled Watchdog.getInstance().feed(); // increment the number of disabled periodic loops completed m_disabledPeriodicLoops++; // while disabled, printout the duration of current disabled mode in seconds if ((Timer.getUsClock() / 1000000.0) > printSec) { System.out.println("Disabled seconds: " + (printSec - startSec)); printSec++; } }
/** * This function is called periodically during autonomous */ public void autonomousPeriodic() { WsInputManager.getInstance().updateOiDataAutonomous(); WsInputManager.getInstance().updateSensorData(); WsAutonomousManager.getInstance().update(); WsSubsystemContainer.getInstance().update(); WsOutputManager.getInstance().update(); Watchdog.getInstance().feed(); }
public void teleopPeriodic() { // periodTimer.endTimingSection(); // periodTimer.startTimingSection(); // durationTimer.startTimingSection(); WsInputManager.getInstance().updateOiData(); WsInputManager.getInstance().updateSensorData(); WsSubsystemContainer.getInstance().update(); WsOutputManager.getInstance().update(); Watchdog.getInstance().feed(); // durationTimer.endTimingSection(); }
/** * This function is run when the robot is first started up and should be used for any initialization code. */ public void robotInit() { watchdog = Watchdog.getInstance(); watchdog.setEnabled(false); CommandBase.init(); //initializes commands mecDrive = new DriveCommand(); info = new FrontSensorToDash(); auto = new Autonomous(); //RobotMap.camera = AxisCamera.getInstance(); }
FRC2014Java(){ //Motor Controllers leftDrive = new Talon(TALON_PORT_L); rightDrive = new Talon(TALON_PORT_R); //Joystick xbox = new Joystick(1); //Winch winch = new Talon(2); //Intake intake = new Talon(8); //Cam cam = new Talon(3); //Catapult Limit Switch catapultLimit = new DigitalInput(1); //Cam Limit Switch camLimit = new DigitalInput(2); //Intake Limit Switch intakeLimit = new DigitalInput(3); //Cameras cameraFront = AxisCamera.getInstance("10.10.2.11"); cameraBack = AxisCamera.getInstance("10.10.2.12"); //Watchdog dog = Watchdog.getInstance(); }
/** * Constructs a TitanRobot object. */ public TitanRobot() { System.out.println("Creating TitanRobot instance for 2014."); componentRegistry = new ComponentRegistry(); stateRegistry = new StateRegistry(); autonomousRunner = new AutonomousRunner(this); teleOperatedRunner = new TeleOperatedRunner(this); testRunner = new TestRunner(this); setInstance(); Watchdog.getInstance().setEnabled(WATCHDOG_ENABLE); System.out.println("TitanRobot ready for operation."); }
public void run() { /* Run in teleoperated loop as long as robot is enabled */ while (robot.isOperatorControl() && robot.isEnabled()) { /* Handle operations */ directionButtonHandler.run(); speedButtonHandler.run(); componentRegistry.getRobotDrive().drive(0.0, 0); tankDriveHandler.run(); pickupButtonHandler.run(); /* Handle shoulder operations - order of handlers is important */ shoulderButtonHandler.run(); shoulderManualPositionHandler.run(); shoulderSeekPositionHandler.run(); shoulderServoHandler.run(); /* Handle shooting operations */ hammerButtonHandler.run(); // autoShootHandler.run(); shootingHandler.run(); /* Update indicator lights */ shootingDistanceLightHandler.run(); hammerLatchedLightHandler.run(); /* Update Messages */ boolean updateNeeded = armPositionMonitor.update(); updateNeeded |= distanceMonitor.update(); if (updateNeeded) { messageDisplay.update(); } /* Feed watchdog to prevent shutdown and then wait */ Watchdog.getInstance().feed(); Timer.delay(TELEOPERATED_LOOP_DELAY); } componentRegistry.getRobotDrive().drive(0.0, 0); }
private void drive(double pSpeed, int pTurn) { boolean reverseLeftMotor = (FRONT_LEFT_DRIVE_MOTOR_DIRECTION == REVERSE); boolean reverseRightMotor = (FRONT_RIGHT_DRIVE_MOTOR_DIRECTION == REVERSE); /* Drive after adjusting for drive direction */ robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearLeft, !reverseLeftMotor); robotDrive.setInvertedMotor(RobotDrive.MotorType.kRearRight, !reverseRightMotor); robotDrive.drive(pSpeed, pTurn); Watchdog.getInstance().feed(); }
/** * This function is run when the robot is first started up and should be * used for any initialization code. */ public void robotInit() { // instantiate the command used for the autonomous period // Initialize all subsystems CommandBase.init(); Watchdog.getInstance().setEnabled(true); }
public void teleopPeriodic(){ Scheduler.getInstance().run(); //update commands SmartDashboard.putNumber("Speed", CommandBase.Drive.getSpeed()); SmartDashboard.putNumber("GyroAngle", CommandBase.Drive.getAngle()); //System.out.println("Left Speed: " + CommandBase.Drive.getLeftSpeed()); //System.out.println("Right Speed: " + CommandBase.Drive.getRightSpeed()); CommandBase.OI.updateGripSwitch(); Watchdog.getInstance().feed(); //very hungry }
public WatchdogWrapper(Watchdog w) { this.w = w; }
public void teleopPeriodic() { // feed the user watchdog at every period when in autonomous Watchdog.getInstance().feed(); // increment the number of teleop periodic loops completed m_telePeriodicLoops++; /* * Code placed in here will be called only when a new packet of information * has been received by the Driver Station. Any code which needs new information * from the DS should go in here */ m_dsPacketsReceivedInCurrentSecond++; // increment DS packets received // put Driver Station-dependent code here // put some code here that does nothing DoesNothing(); // Demonstrate the use of the Joystick buttons Solenoid[] firstGroup = new Solenoid[4]; Solenoid[] secondGroup = new Solenoid[4]; for (int i = 0; i < 4; i++) { firstGroup[i] = m_solenoids[i]; secondGroup[i] = m_solenoids[i + 4]; } DemonstrateJoystickButtons(m_rightStick, m_rightStickButtonState, "Right Stick", firstGroup); DemonstrateJoystickButtons(m_leftStick, m_leftStickButtonState, "Left Stick ", secondGroup); // determine if tank or arcade mode, based upon position of "Z" wheel on kit joystick if (m_rightStick.getZ() <= 0) { // Logitech Attack3 has z-polarity reversed; up is negative // use arcade drive m_robotDrive.arcadeDrive(m_rightStick, false); // drive with arcade style (use right stick) if (m_driveMode != ARCADE_DRIVE) { // if newly entered arcade drive, print out a message System.out.println("Arcade Drive\n"); m_driveMode = ARCADE_DRIVE; } } else { // use tank drive m_robotDrive.tankDrive(m_leftStick, m_rightStick); // drive with tank style if (m_driveMode != TANK_DRIVE) { // if newly entered tank drive, print out a message System.out.println("Tank Drive\n"); m_driveMode = TANK_DRIVE; } } }
/** * This function is called periodically during test mode */ public void testPeriodic() { Watchdog.getInstance().feed(); }
private void runAutonomousMode2(boolean pShoot) { /* Keep shoulder up, pull in ball and keep */ for (int count = 0; count < 550; count++) { if (robot.isAutonomous() && robot.isEnabled()) { shoulderMotor.set(0.4); pickupMotor.set(PICKUP_MOTOR_SPEED); if (pickupMotor.isHardLimitReached()) { break; } robotDrive.drive(0.0, 0.0); /* Feed watchdog to prevent shutdown and then wait */ Watchdog.getInstance().feed(); Timer.delay(AUTONOMOUS_LOOP_DELAY); } } // was 175 /* Keep shoulder up and drive forward */ for (int count = 0; count < 300; count++) { if (robot.isAutonomous() && robot.isEnabled()) { shoulderMotor.set(0.4); pickupMotor.set(PICKUP_MOTOR_SPEED); robotDrive.drive(-0.4, 0.0); /* Feed watchdog to prevent shutdown and then wait */ Watchdog.getInstance().feed(); Timer.delay(AUTONOMOUS_LOOP_DELAY); } } /* Stop drive and keep shoulder up and ball */ for (int count = 0; count < 100; count++) { if (robot.isAutonomous() && robot.isEnabled()) { shoulderMotor.set(0.15); pickupMotor.set(PICKUP_MOTOR_SPEED); robotDrive.drive(0.0, 0.0); } } /* Keep shoulder up and roll ball out */ pickupMotor.setNonTimedOperation(); for (int count = 0; count < 75; count++) { if (robot.isAutonomous() && robot.isEnabled()) { shoulderMotor.set(0.15); pickupMotor.set(PICKUP_MOTOR_FIRE_SPEED); robotDrive.drive(0.0, 0.0); } } /* Shoot the ball */ pickupMotor.setTimedOperation(PICKUP_MOTOR_FIRE_TIME); for (int count = 0; count < 500; count++) { if (robot.isAutonomous() && robot.isEnabled()) { shoulderMotor.set(0.15); if (pShoot) { pickupMotor.set(PICKUP_MOTOR_FIRE_SPEED); hammerMotor.set(HAMMER_FIRE_SPEED); } robotDrive.drive(0.0, 0.0); /* Feed watchdog to prevent shutdown and then wait */ Watchdog.getInstance().feed(); Timer.delay(AUTONOMOUS_LOOP_DELAY); } } /* Stop all motors */ while (robot.isAutonomous() && robot.isEnabled()) { shoulderMotor.set(0.0); pickupMotor.set(0.0); hammerMotor.set(0.0); robotDrive.drive(0.0, 0.0); /* Feed watchdog to prevent shutdown and then wait */ Watchdog.getInstance().feed(); Timer.delay(AUTONOMOUS_LOOP_DELAY); } }
private void runAutonomousMode3() { for (int count = 0; count < 500; count++) { pickupMotor.set(PICKUP_MOTOR_SPEED); if (pickupMotor.isHardLimitReached()) { break; } robotDrive.drive(0.0, 0.0); /* Feed watchdog to prevent shutdown and then wait */ Watchdog.getInstance().feed(); Timer.delay(AUTONOMOUS_LOOP_DELAY); } for (int count = 0; count < 500; count++) { if (!robot.isAutonomous() || !robot.isEnabled()) { break; } pickupMotor.set(PICKUP_MOTOR_SPEED); robotDrive.drive(-0.4, 0.0); /* Feed watchdog to prevent shutdown and then wait */ Watchdog.getInstance().feed(); Timer.delay(AUTONOMOUS_LOOP_DELAY); } for (int count = 0; count < 75; count++) { if (!robot.isAutonomous() || !robot.isEnabled()) { break; } robotDrive.drive(0.0, 0.0); pickupMotor.setTimedOperation(PICKUP_MOTOR_FIRE_TIME); pickupMotor.set(PICKUP_MOTOR_FIRE_SPEED); hammerMotor.set(HAMMER_FIRE_SPEED); /* Feed watchdog to prevent shutdown and then wait */ Watchdog.getInstance().feed(); Timer.delay(AUTONOMOUS_LOOP_DELAY); } while (robot.isAutonomous() && robot.isEnabled()) { robotDrive.drive(0.0, 0.0); hammerMotor.set(0.0); pickupMotor.set(0.0); /* Feed watchdog to prevent shutdown and then wait */ Watchdog.getInstance().feed(); Timer.delay(AUTONOMOUS_LOOP_DELAY); } }
/** * This function is called periodically during autonomous */ public void autonomousPeriodic() { Scheduler.getInstance().run(); Watchdog.getInstance().feed(); }
/** * This function is called periodically during operator control */ public void teleopPeriodic() { Scheduler.getInstance().run(); Watchdog.getInstance().feed(); }
/** * This function is called periodically during autonomous */ public void autonomousPeriodic() { FrameworkAbstraction.autonomousPeriodic(); Watchdog.getInstance().feed(); }
public void teleopPeriodic() { FrameworkAbstraction.teleopPeriodic(); Watchdog.getInstance().feed(); }
/** * This function is run when the robot is first started up and should be * used for any initialization code. */ public void robotInit() { try { //Disable the watchdog Watchdog.getInstance().setEnabled(false); //Get the drive class drive = new Drive(); //Get the shooter class shooter = new Shooter(); //Get the OI class oi = new OI(); } catch (CANTimeoutException ex) { ex.printStackTrace(); } }