Replace IterativeRobot in examples with TimedRobot (#1310)

Fixes #1309.
This commit is contained in:
Tyler Veness
2018-09-19 21:41:08 -07:00
committed by Peter Johnson
parent 59386635e7
commit bedef476fd
36 changed files with 75 additions and 75 deletions

View File

@@ -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};

View File

@@ -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

View File

@@ -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

View File

@@ -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.

View File

@@ -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;

View File

@@ -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);

View File

@@ -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); }

View File

@@ -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

View File

@@ -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:

View File

@@ -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

View File

@@ -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()); }

View File

@@ -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()); }

View File

@@ -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;

View File

@@ -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); }

View File

@@ -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__)

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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