コード例 #1
0
 public void autonomousPeriodic() {
   relay.set(Relay.Value.kOn);
   smart.putNumber("distance", ultrasonic.getVoltage());
   drive.setRun(false);
   loadAndShoot.setRun(false);
   //    relay.set(Relay.Value.kOn);
   if (autoTimer.get() < autoMoveForwardTime) {
     System.out.println(
         "Moving forward, Timer at "
             + autoTimer.get()
             + ", Ultrasonic at "
             + ultrasonic.getAverageVoltage());
   }
   if (autoTimer.get() >= autoMoveForwardTime && ultrasonic.getAverageVoltage() <= AUTO_DISTANCE) {
     stop();
     if (!autonomousStopped) {
       autonomousStopped = true;
       autoTimeAtStop = autoTimer.get();
     }
     System.out.println("Stopped, Ultrasonic at " + ultrasonic.getAverageVoltage());
   }
   if (autoTimer.get() >= autoTimeAtStop + 1 && ultrasonic.getAverageVoltage() <= AUTO_DISTANCE) {
     autoStop = true;
     shoot();
     System.out.println("Shooting, Ultrasonic at " + ultrasonic.getAverageVoltage());
   }
 }
コード例 #2
0
 /** This function is called periodically during operator control */
 public void teleopInit() {
   // relayCompressor.set(Relay.Value.kOn);
   relay.set(Relay.Value.kOff);
   drive.setRun(true);
   loadAndShoot.teleoperatedInit();
   loadAndShoot.setRun(true);
 }
コード例 #3
0
  /** This function is called periodically during autonomous */
  public void autonomousInit() {
    autoTimer.reset();
    autoTimer.start();

    gyro.reset();
    relay.set(Relay.Value.kOn);

    setSpeedFast();
    setLEDTeamColour();

    sol4.set(false);
    sol5.set(true);
    sol7.set(true);
    sol8.set(false);

    autoStop = false;
    autonomousStopped = false;
    autoTimeAtStop = 99999;

    drive.setRun(false);
    loadAndShoot.setRun(false);
    autoForward();
  }
コード例 #4
0
 public void disabledInit() {
   drive.setRun(false);
   loadAndShoot.resetBooleans();
   loadAndShoot.setRun(false);
 }