mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Replace IterativeRobot in examples with TimedRobot (#1310)
Fixes #1309.
This commit is contained in:
committed by
Peter Johnson
parent
59386635e7
commit
bedef476fd
@@ -5,16 +5,16 @@
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <frc/IterativeRobot.h>
|
||||
#include <frc/Joystick.h>
|
||||
#include <frc/Spark.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/drive/DifferentialDrive.h>
|
||||
|
||||
/**
|
||||
* This is a demo program showing the use of the DifferentialDrive class.
|
||||
* Runs the motors with arcade steering.
|
||||
*/
|
||||
class Robot : public frc::IterativeRobot {
|
||||
class Robot : public frc::TimedRobot {
|
||||
frc::Spark m_leftMotor{0};
|
||||
frc::Spark m_rightMotor{1};
|
||||
frc::DifferentialDrive m_robotDrive{m_leftMotor, m_rightMotor};
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <cameraserver/CameraServer.h>
|
||||
#include <frc/IterativeRobot.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <opencv2/core/core.hpp>
|
||||
#include <opencv2/core/types.hpp>
|
||||
#include <opencv2/imgproc/imgproc.hpp>
|
||||
@@ -17,7 +17,7 @@
|
||||
* and sent to the dashboard. OpenCV has many methods for different types of
|
||||
* processing.
|
||||
*/
|
||||
class Robot : public frc::IterativeRobot {
|
||||
class Robot : public frc::TimedRobot {
|
||||
private:
|
||||
static void VisionThread() {
|
||||
// Get the Axis camera from CameraServer
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <frc/IterativeRobot.h>
|
||||
#include <frc/PowerDistributionPanel.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/smartdashboard/SmartDashboard.h>
|
||||
|
||||
/**
|
||||
@@ -14,7 +14,7 @@
|
||||
* Distribution Panel via CAN. The information will be displayed under variables
|
||||
* through the SmartDashboard.
|
||||
*/
|
||||
class Robot : public frc::IterativeRobot {
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
void TeleopPeriodic() override {
|
||||
/* Get the current going through channel 7, in Amperes. The PDP returns the
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/IterativeRobot.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/smartdashboard/SmartDashboard.h>
|
||||
|
||||
/**
|
||||
@@ -28,7 +28,7 @@
|
||||
* distance that the robot drives can be precisely controlled during the
|
||||
* autonomous mode.
|
||||
*/
|
||||
class Robot : public frc::IterativeRobot {
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
Robot() {
|
||||
/* Defines the number of samples to average when determining the rate.
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <frc/IterativeRobot.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/commands/Command.h>
|
||||
#include <frc/commands/Scheduler.h>
|
||||
#include <frc/livewindow/LiveWindow.h>
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "subsystems/Elevator.h"
|
||||
#include "subsystems/Wrist.h"
|
||||
|
||||
class Robot : public frc::IterativeRobot {
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
static DriveTrain drivetrain;
|
||||
static Elevator elevator;
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <frc/IterativeRobot.h>
|
||||
#include <frc/Joystick.h>
|
||||
#include <frc/Spark.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/Timer.h>
|
||||
#include <frc/drive/DifferentialDrive.h>
|
||||
#include <frc/livewindow/LiveWindow.h>
|
||||
|
||||
class Robot : public frc::IterativeRobot {
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
Robot() {
|
||||
m_robotDrive.SetExpiration(0.1);
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#include <cmath>
|
||||
|
||||
#include <frc/AnalogGyro.h>
|
||||
#include <frc/IterativeRobot.h>
|
||||
#include <frc/Joystick.h>
|
||||
#include <frc/Spark.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/drive/DifferentialDrive.h>
|
||||
|
||||
/**
|
||||
@@ -18,7 +18,7 @@
|
||||
* robot drive straight. This program uses a joystick to drive forwards and
|
||||
* backwards while the gyro is used for direction keeping.
|
||||
*/
|
||||
class Robot : public frc::IterativeRobot {
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
void RobotInit() override { m_gyro.SetSensitivity(kVoltsPerDegreePerSecond); }
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <frc/AnalogGyro.h>
|
||||
#include <frc/IterativeRobot.h>
|
||||
#include <frc/Joystick.h>
|
||||
#include <frc/Spark.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/drive/MecanumDrive.h>
|
||||
|
||||
/**
|
||||
@@ -16,7 +16,7 @@
|
||||
* maintian rotation vectorsin relation to the starting orientation of the robot
|
||||
* (field-oriented controls).
|
||||
*/
|
||||
class Robot : public frc::IterativeRobot {
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
void RobotInit() override {
|
||||
// Invert the left side motors. You may need to change or remove this to
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <thread>
|
||||
|
||||
#include <cameraserver/CameraServer.h>
|
||||
#include <frc/IterativeRobot.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <opencv2/core/core.hpp>
|
||||
#include <opencv2/core/types.hpp>
|
||||
#include <opencv2/imgproc/imgproc.hpp>
|
||||
@@ -20,7 +20,7 @@
|
||||
* and sent to the dashboard. OpenCV has many methods for different types of
|
||||
* processing.
|
||||
*/
|
||||
class Robot : public frc::IterativeRobot {
|
||||
class Robot : public frc::TimedRobot {
|
||||
#if defined(__linux__)
|
||||
|
||||
private:
|
||||
|
||||
@@ -5,16 +5,16 @@
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <frc/IterativeRobot.h>
|
||||
#include <frc/Joystick.h>
|
||||
#include <frc/Spark.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/drive/MecanumDrive.h>
|
||||
|
||||
/**
|
||||
* This is a demo program showing how to use Mecanum control with the
|
||||
* MecanumDrive class.
|
||||
*/
|
||||
class Robot : public frc::IterativeRobot {
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
void RobotInit() override {
|
||||
// Invert the left side motors. You may need to change or remove this to
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <frc/IterativeRobot.h>
|
||||
#include <frc/Joystick.h>
|
||||
#include <frc/Spark.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
|
||||
/**
|
||||
* This sample program shows how to control a motor using a joystick. In the
|
||||
@@ -17,7 +17,7 @@
|
||||
* Joystick analog values range from -1 to 1 and speed controller inputs as
|
||||
* range from -1 to 1 making it easy to work together.
|
||||
*/
|
||||
class Robot : public frc::IterativeRobot {
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
void TeleopPeriodic() override { m_motor.Set(m_stick.GetY()); }
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <frc/Encoder.h>
|
||||
#include <frc/IterativeRobot.h>
|
||||
#include <frc/Joystick.h>
|
||||
#include <frc/Spark.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/smartdashboard/SmartDashboard.h>
|
||||
|
||||
constexpr double kPi = 3.14159265358979;
|
||||
@@ -24,7 +24,7 @@ constexpr double kPi = 3.14159265358979;
|
||||
* In addition, the encoder value of an encoder connected to ports 0 and 1 is
|
||||
* consistently sent to the Dashboard.
|
||||
*/
|
||||
class Robot : public frc::IterativeRobot {
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
void TeleopPeriodic() override { m_motor.Set(m_stick.GetY()); }
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <frc/IterativeRobot.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/commands/Command.h>
|
||||
#include <frc/smartdashboard/SendableChooser.h>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "subsystems/Pneumatics.h"
|
||||
#include "subsystems/Shooter.h"
|
||||
|
||||
class Robot : public frc::IterativeRobot {
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
static DriveTrain drivetrain;
|
||||
static Pivot pivot;
|
||||
|
||||
@@ -8,17 +8,17 @@
|
||||
#include <array>
|
||||
|
||||
#include <frc/AnalogInput.h>
|
||||
#include <frc/IterativeRobot.h>
|
||||
#include <frc/Joystick.h>
|
||||
#include <frc/PIDController.h>
|
||||
#include <frc/Spark.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
|
||||
/**
|
||||
* This is a sample program to demonstrate how to use a soft potentiometer and a
|
||||
* PID Controller to reach and maintain position setpoints on an elevator
|
||||
* mechanism.
|
||||
*/
|
||||
class Robot : public frc::IterativeRobot {
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
void RobotInit() override { m_pidController.SetInputRange(0, 5); }
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <cameraserver/CameraServer.h>
|
||||
#include <frc/IterativeRobot.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <wpi/raw_ostream.h>
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@
|
||||
* the easiest way to get camera images to the dashboard. Just add this to the
|
||||
* RobotInit() method in your program.
|
||||
*/
|
||||
class Robot : public frc::IterativeRobot {
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
void RobotInit() override {
|
||||
#if defined(__linux__)
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <frc/IterativeRobot.h>
|
||||
#include <frc/Joystick.h>
|
||||
#include <frc/Relay.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
|
||||
/**
|
||||
* This is a sample program which uses joystick buttons to control a relay.
|
||||
@@ -20,7 +20,7 @@
|
||||
* one output; pressing the button sets the output to 12V and releasing sets it
|
||||
* to 0V.
|
||||
*/
|
||||
class Robot : public frc::IterativeRobot {
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
void TeleopPeriodic() override {
|
||||
/* Retrieve the button values. GetRawButton() will return true if the button
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <frc/DoubleSolenoid.h>
|
||||
#include <frc/IterativeRobot.h>
|
||||
#include <frc/Joystick.h>
|
||||
#include <frc/Solenoid.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
|
||||
/**
|
||||
* This is a sample program showing the use of the solenoid classes during
|
||||
@@ -30,7 +30,7 @@
|
||||
* Additionally, double solenoids take up two channels on your PCM whereas
|
||||
* single solenoids only take a single channel.
|
||||
*/
|
||||
class Robot : public frc::IterativeRobot {
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
void TeleopPeriodic() override {
|
||||
/* The output of GetRawButton is true/false depending on whether the button
|
||||
|
||||
@@ -6,15 +6,15 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <frc/AnalogInput.h>
|
||||
#include <frc/IterativeRobot.h>
|
||||
#include <frc/Spark.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/drive/DifferentialDrive.h>
|
||||
|
||||
/**
|
||||
* This is a sample program demonstrating how to use an ultrasonic sensor and
|
||||
* proportional control to maintain a set distance from an object.
|
||||
*/
|
||||
class Robot : public frc::IterativeRobot {
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
/**
|
||||
* Tells the robot to drive to a set distance (in inches) from an object using
|
||||
|
||||
@@ -6,17 +6,17 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <frc/AnalogInput.h>
|
||||
#include <frc/IterativeRobot.h>
|
||||
#include <frc/PIDController.h>
|
||||
#include <frc/PIDOutput.h>
|
||||
#include <frc/Spark.h>
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc/drive/DifferentialDrive.h>
|
||||
|
||||
/**
|
||||
* This is a sample program demonstrating how to use an ultrasonic sensor and
|
||||
* proportional control to maintain a set distance from an object.
|
||||
*/
|
||||
class Robot : public frc::IterativeRobot {
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
/**
|
||||
* Drives the robot a set distance from an object using PID control and the
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*
|
||||
* WARNING: While it may look like a good choice to use for your code if you're
|
||||
* inexperienced, don't. Unless you know what you are doing, complex code will
|
||||
* be much more difficult under this system. Use IterativeRobot or Command-Based
|
||||
* be much more difficult under this system. Use TimedRobot or Command-Based
|
||||
* instead if you're new.
|
||||
*/
|
||||
class Robot : public frc::SampleRobot {
|
||||
|
||||
@@ -16,7 +16,7 @@ import edu.wpi.cscore.AxisCamera;
|
||||
import edu.wpi.cscore.CvSink;
|
||||
import edu.wpi.cscore.CvSource;
|
||||
import edu.wpi.first.wpilibj.CameraServer;
|
||||
import edu.wpi.first.wpilibj.IterativeRobot;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
|
||||
/**
|
||||
* This is a demo program showing the use of OpenCV to do vision processing. The
|
||||
@@ -24,7 +24,7 @@ import edu.wpi.first.wpilibj.IterativeRobot;
|
||||
* and sent to the dashboard. OpenCV has many methods for different types of
|
||||
* processing.
|
||||
*/
|
||||
public class Robot extends IterativeRobot {
|
||||
public class Robot extends TimedRobot {
|
||||
Thread m_visionThread;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
package edu.wpi.first.wpilibj.examples.gearsbot;
|
||||
|
||||
import edu.wpi.first.wpilibj.IterativeRobot;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.command.Command;
|
||||
import edu.wpi.first.wpilibj.command.Scheduler;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||
@@ -20,12 +20,12 @@ import edu.wpi.first.wpilibj.examples.gearsbot.subsystems.Wrist;
|
||||
|
||||
/**
|
||||
* The VM is configured to automatically run this class, and to call the
|
||||
* functions corresponding to each mode, as described in the IterativeRobot
|
||||
* functions corresponding to each mode, as described in the TimedRobot
|
||||
* documentation. If you change the name of this class or the package after
|
||||
* creating this project, you must also update the manifest file in the resource
|
||||
* directory.
|
||||
*/
|
||||
public class Robot extends IterativeRobot {
|
||||
public class Robot extends TimedRobot {
|
||||
Command m_autonomousCommand;
|
||||
|
||||
public static DriveTrain m_drivetrain;
|
||||
|
||||
@@ -7,20 +7,20 @@
|
||||
|
||||
package edu.wpi.first.wpilibj.examples.gettingstarted;
|
||||
|
||||
import edu.wpi.first.wpilibj.IterativeRobot;
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.Spark;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.Timer;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
|
||||
/**
|
||||
* The VM is configured to automatically run this class, and to call the
|
||||
* functions corresponding to each mode, as described in the IterativeRobot
|
||||
* functions corresponding to each mode, as described in the TimedRobot
|
||||
* documentation. If you change the name of this class or the package after
|
||||
* creating this project, you must also update the manifest file in the resource
|
||||
* directory.
|
||||
*/
|
||||
public class Robot extends IterativeRobot {
|
||||
public class Robot extends TimedRobot {
|
||||
private final DifferentialDrive m_robotDrive
|
||||
= new DifferentialDrive(new Spark(0), new Spark(1));
|
||||
private final Joystick m_stick = new Joystick(0);
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
package edu.wpi.first.wpilibj.examples.gyro;
|
||||
|
||||
import edu.wpi.first.wpilibj.AnalogGyro;
|
||||
import edu.wpi.first.wpilibj.IterativeRobot;
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.Spark;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
|
||||
/**
|
||||
@@ -18,7 +18,7 @@ import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
* robot drive straight. This program uses a joystick to drive forwards and
|
||||
* backwards while the gyro is used for direction keeping.
|
||||
*/
|
||||
public class Robot extends IterativeRobot {
|
||||
public class Robot extends TimedRobot {
|
||||
private static final double kAngleSetpoint = 0.0;
|
||||
private static final double kP = 0.005; // propotional turning constant
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
package edu.wpi.first.wpilibj.examples.gyromecanum;
|
||||
|
||||
import edu.wpi.first.wpilibj.AnalogGyro;
|
||||
import edu.wpi.first.wpilibj.IterativeRobot;
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.Spark;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.drive.MecanumDrive;
|
||||
|
||||
/**
|
||||
@@ -18,7 +18,7 @@ import edu.wpi.first.wpilibj.drive.MecanumDrive;
|
||||
* maintian rotation vectorsin relation to the starting orientation of the robot
|
||||
* (field-oriented controls).
|
||||
*/
|
||||
public class Robot extends IterativeRobot {
|
||||
public class Robot extends TimedRobot {
|
||||
// gyro calibration constant, may need to be adjusted;
|
||||
// gyro value of 360 is set to correspond to one full revolution
|
||||
private static final double kVoltsPerDegreePerSecond = 0.0128;
|
||||
|
||||
@@ -16,7 +16,7 @@ import edu.wpi.cscore.CvSink;
|
||||
import edu.wpi.cscore.CvSource;
|
||||
import edu.wpi.cscore.UsbCamera;
|
||||
import edu.wpi.first.wpilibj.CameraServer;
|
||||
import edu.wpi.first.wpilibj.IterativeRobot;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
|
||||
/**
|
||||
* This is a demo program showing the use of OpenCV to do vision processing. The
|
||||
@@ -24,7 +24,7 @@ import edu.wpi.first.wpilibj.IterativeRobot;
|
||||
* and sent to the dashboard. OpenCV has many methods for different types of
|
||||
* processing.
|
||||
*/
|
||||
public class Robot extends IterativeRobot {
|
||||
public class Robot extends TimedRobot {
|
||||
Thread m_visionThread;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,16 +7,16 @@
|
||||
|
||||
package edu.wpi.first.wpilibj.examples.mecanumdrive;
|
||||
|
||||
import edu.wpi.first.wpilibj.IterativeRobot;
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.Spark;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.drive.MecanumDrive;
|
||||
|
||||
/**
|
||||
* This is a demo program showing how to use Mecanum control with the RobotDrive
|
||||
* class.
|
||||
*/
|
||||
public class Robot extends IterativeRobot {
|
||||
public class Robot extends TimedRobot {
|
||||
private static final int kFrontLeftChannel = 2;
|
||||
private static final int kRearLeftChannel = 3;
|
||||
private static final int kFrontRightChannel = 1;
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
|
||||
package edu.wpi.first.wpilibj.examples.motorcontrol;
|
||||
|
||||
import edu.wpi.first.wpilibj.IterativeRobot;
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.Spark;
|
||||
import edu.wpi.first.wpilibj.SpeedController;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
|
||||
/**
|
||||
* This sample program shows how to control a motor using a joystick. In the
|
||||
@@ -20,7 +20,7 @@ import edu.wpi.first.wpilibj.SpeedController;
|
||||
* <p>Joystick analog values range from -1 to 1 and speed controller inputs also
|
||||
* range from -1 to 1 making it easy to work together.
|
||||
*/
|
||||
public class Robot extends IterativeRobot {
|
||||
public class Robot extends TimedRobot {
|
||||
private static final int kMotorPort = 0;
|
||||
private static final int kJoystickPort = 0;
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
package edu.wpi.first.wpilibj.examples.motorcontrolencoder;
|
||||
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.IterativeRobot;
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.Spark;
|
||||
import edu.wpi.first.wpilibj.SpeedController;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||
|
||||
/**
|
||||
@@ -25,7 +25,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||
* <p>In addition, the encoder value of an encoder connected to ports 0 and 1 is
|
||||
* consistently sent to the Dashboard.
|
||||
*/
|
||||
public class Robot extends IterativeRobot {
|
||||
public class Robot extends TimedRobot {
|
||||
private static final int kMotorPort = 0;
|
||||
private static final int kJoystickPort = 0;
|
||||
private static final int kEncoderPortA = 0;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
package edu.wpi.first.wpilibj.examples.pacgoat;
|
||||
|
||||
import edu.wpi.first.wpilibj.IterativeRobot;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.command.Command;
|
||||
import edu.wpi.first.wpilibj.command.Scheduler;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
|
||||
@@ -25,12 +25,12 @@ import edu.wpi.first.wpilibj.examples.pacgoat.subsystems.Shooter;
|
||||
* This is the main class for running the PacGoat code.
|
||||
*
|
||||
* <p>The VM is configured to automatically run this class, and to call the
|
||||
* functions corresponding to each mode, as described in the IterativeRobot
|
||||
* functions corresponding to each mode, as described in the TimedRobot
|
||||
* documentation. If you change the name of this class or the package after
|
||||
* creating this project, you must also update the manifest file in the resource
|
||||
* directory.
|
||||
*/
|
||||
public class Robot extends IterativeRobot {
|
||||
public class Robot extends TimedRobot {
|
||||
Command m_autonomousCommand;
|
||||
public static OI oi;
|
||||
|
||||
|
||||
@@ -8,18 +8,18 @@
|
||||
package edu.wpi.first.wpilibj.examples.potentiometerpid;
|
||||
|
||||
import edu.wpi.first.wpilibj.AnalogInput;
|
||||
import edu.wpi.first.wpilibj.IterativeRobot;
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.PIDController;
|
||||
import edu.wpi.first.wpilibj.Spark;
|
||||
import edu.wpi.first.wpilibj.SpeedController;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
|
||||
/**
|
||||
* This is a sample program to demonstrate how to use a soft potentiometer and a
|
||||
* PID controller to reach and maintain position setpoints on an elevator
|
||||
* mechanism.
|
||||
*/
|
||||
public class Robot extends IterativeRobot {
|
||||
public class Robot extends TimedRobot {
|
||||
private static final int kPotChannel = 1;
|
||||
private static final int kMotorChannel = 7;
|
||||
private static final int kJoystickChannel = 0;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
package edu.wpi.first.wpilibj.examples.quickvision;
|
||||
|
||||
import edu.wpi.first.wpilibj.CameraServer;
|
||||
import edu.wpi.first.wpilibj.IterativeRobot;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
|
||||
/**
|
||||
* Uses the CameraServer class to automatically capture video from a USB webcam
|
||||
@@ -16,7 +16,7 @@ import edu.wpi.first.wpilibj.IterativeRobot;
|
||||
* is the easiest way to get camera images to the dashboard. Just add this to
|
||||
* the robotInit() method in your program.
|
||||
*/
|
||||
public class Robot extends IterativeRobot {
|
||||
public class Robot extends TimedRobot {
|
||||
@Override
|
||||
public void robotInit() {
|
||||
CameraServer.getInstance().startAutomaticCapture();
|
||||
|
||||
@@ -7,16 +7,16 @@
|
||||
|
||||
package edu.wpi.first.wpilibj.examples.tankdrive;
|
||||
|
||||
import edu.wpi.first.wpilibj.IterativeRobot;
|
||||
import edu.wpi.first.wpilibj.Joystick;
|
||||
import edu.wpi.first.wpilibj.Spark;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
|
||||
/**
|
||||
* This is a demo program showing the use of the RobotDrive class, specifically
|
||||
* it contains the code necessary to operate a robot with tank drive.
|
||||
*/
|
||||
public class Robot extends IterativeRobot {
|
||||
public class Robot extends TimedRobot {
|
||||
private DifferentialDrive m_myRobot;
|
||||
private Joystick m_leftStick;
|
||||
private Joystick m_rightStick;
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
package edu.wpi.first.wpilibj.examples.ultrasonic;
|
||||
|
||||
import edu.wpi.first.wpilibj.AnalogInput;
|
||||
import edu.wpi.first.wpilibj.IterativeRobot;
|
||||
import edu.wpi.first.wpilibj.Spark;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
|
||||
/**
|
||||
@@ -17,7 +17,7 @@ import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
* proportional control to maintain a set distance from an object.
|
||||
*/
|
||||
|
||||
public class Robot extends IterativeRobot {
|
||||
public class Robot extends TimedRobot {
|
||||
// distance in inches the robot wants to stay from an object
|
||||
private static final double kHoldDistance = 12.0;
|
||||
|
||||
|
||||
@@ -8,17 +8,17 @@
|
||||
package edu.wpi.first.wpilibj.examples.ultrasonicpid;
|
||||
|
||||
import edu.wpi.first.wpilibj.AnalogInput;
|
||||
import edu.wpi.first.wpilibj.IterativeRobot;
|
||||
import edu.wpi.first.wpilibj.PIDController;
|
||||
import edu.wpi.first.wpilibj.PIDOutput;
|
||||
import edu.wpi.first.wpilibj.Spark;
|
||||
import edu.wpi.first.wpilibj.TimedRobot;
|
||||
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
|
||||
|
||||
/**
|
||||
* This is a sample program to demonstrate the use of a PIDController with an
|
||||
* ultrasonic sensor to reach and maintain a set distance from an object.
|
||||
*/
|
||||
public class Robot extends IterativeRobot {
|
||||
public class Robot extends TimedRobot {
|
||||
// distance in inches the robot wants to stay from an object
|
||||
private static final double kHoldDistance = 12.0;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
||||
*
|
||||
* <p>WARNING: While it may look like a good choice to use for your code if
|
||||
* you're inexperienced, don't. Unless you know what you are doing, complex code
|
||||
* will be much more difficult under this system. Use IterativeRobot or
|
||||
* will be much more difficult under this system. Use TimedRobot or
|
||||
* Command-Based instead if you're new.
|
||||
*/
|
||||
public class Robot extends SampleRobot {
|
||||
@@ -63,7 +63,7 @@ public class Robot extends SampleRobot {
|
||||
* the if-else structure below with additional strings. If using the
|
||||
* SendableChooser make sure to add them to the chooser code above as well.
|
||||
*
|
||||
* <p>If you wanted to run a similar autonomous mode with an IterativeRobot
|
||||
* <p>If you wanted to run a similar autonomous mode with an TimedRobot
|
||||
* you would write:
|
||||
*
|
||||
* <blockquote><pre>{@code
|
||||
@@ -124,7 +124,7 @@ public class Robot extends SampleRobot {
|
||||
/**
|
||||
* Runs the motors with arcade steering.
|
||||
*
|
||||
* <p>If you wanted to run a similar teleoperated mode with an IterativeRobot
|
||||
* <p>If you wanted to run a similar teleoperated mode with an TimedRobot
|
||||
* you would write:
|
||||
*
|
||||
* <blockquote><pre>{@code
|
||||
|
||||
Reference in New Issue
Block a user