mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[examples] Prepare for RobotInit deprecation by updating examples (#6623)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <frc2/command/CommandScheduler.h>
|
||||
|
||||
void Robot::RobotInit() {}
|
||||
Robot::Robot() {}
|
||||
|
||||
/**
|
||||
* This function is called every 20 ms, no matter the mode. Use
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
void RobotInit() override;
|
||||
Robot();
|
||||
void RobotPeriodic() override;
|
||||
void DisabledInit() override;
|
||||
void DisabledPeriodic() override;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <frc2/command/CommandScheduler.h>
|
||||
|
||||
void Robot::RobotInit() {}
|
||||
Robot::Robot() {}
|
||||
|
||||
void Robot::RobotPeriodic() {
|
||||
frc2::CommandScheduler::GetInstance().Run();
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
void RobotInit() override;
|
||||
Robot();
|
||||
void RobotPeriodic() override;
|
||||
void DisabledInit() override;
|
||||
void DisabledPeriodic() override;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <hal/DriverStation.h>
|
||||
#include <networktables/NetworkTable.h>
|
||||
|
||||
void Robot::RobotInit() {}
|
||||
Robot::Robot() {}
|
||||
|
||||
void Robot::Disabled() {}
|
||||
|
||||
@@ -22,8 +22,6 @@ void Robot::Teleop() {}
|
||||
void Robot::Test() {}
|
||||
|
||||
void Robot::StartCompetition() {
|
||||
RobotInit();
|
||||
|
||||
frc::internal::DriverStationModeThread modeThread;
|
||||
|
||||
wpi::Event event{false, false};
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
class Robot : public frc::RobotBase {
|
||||
public:
|
||||
void RobotInit();
|
||||
Robot();
|
||||
void Disabled();
|
||||
void Autonomous();
|
||||
void Teleop();
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <frc/smartdashboard/SmartDashboard.h>
|
||||
#include <wpi/print.h>
|
||||
|
||||
void Robot::RobotInit() {
|
||||
Robot::Robot() {
|
||||
m_chooser.SetDefaultOption(kAutoNameDefault, kAutoNameDefault);
|
||||
m_chooser.AddOption(kAutoNameCustom, kAutoNameCustom);
|
||||
frc::SmartDashboard::PutData("Auto Modes", &m_chooser);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
void RobotInit() override;
|
||||
Robot();
|
||||
void RobotPeriodic() override;
|
||||
void AutonomousInit() override;
|
||||
void AutonomousPeriodic() override;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "Robot.h"
|
||||
|
||||
void Robot::RobotInit() {}
|
||||
Robot::Robot() {}
|
||||
void Robot::RobotPeriodic() {}
|
||||
|
||||
void Robot::AutonomousInit() {}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
void RobotInit() override;
|
||||
Robot();
|
||||
void RobotPeriodic() override;
|
||||
|
||||
void AutonomousInit() override;
|
||||
|
||||
@@ -23,9 +23,7 @@ Robot::Robot() : frc::TimesliceRobot{5_ms, 10_ms} {
|
||||
// Total usage:
|
||||
// 5 ms (robot) + 2 ms (controller 1) + 2 ms (controller 2) = 9 ms
|
||||
// 9 ms / 10 ms -> 90% allocated
|
||||
}
|
||||
|
||||
void Robot::RobotInit() {
|
||||
m_chooser.SetDefaultOption(kAutoNameDefault, kAutoNameDefault);
|
||||
m_chooser.AddOption(kAutoNameCustom, kAutoNameCustom);
|
||||
frc::SmartDashboard::PutData("Auto Modes", &m_chooser);
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
class Robot : public frc::TimesliceRobot {
|
||||
public:
|
||||
Robot();
|
||||
|
||||
void RobotInit() override;
|
||||
void RobotPeriodic() override;
|
||||
void AutonomousInit() override;
|
||||
void AutonomousPeriodic() override;
|
||||
|
||||
@@ -23,7 +23,6 @@ Robot::Robot() : frc::TimesliceRobot{5_ms, 10_ms} {
|
||||
// 9 ms / 10 ms -> 90% allocated
|
||||
}
|
||||
|
||||
void Robot::RobotInit() {}
|
||||
void Robot::RobotPeriodic() {}
|
||||
|
||||
void Robot::AutonomousInit() {}
|
||||
|
||||
@@ -10,7 +10,6 @@ class Robot : public frc::TimesliceRobot {
|
||||
public:
|
||||
Robot();
|
||||
|
||||
void RobotInit() override;
|
||||
void RobotPeriodic() override;
|
||||
|
||||
void AutonomousInit() override;
|
||||
|
||||
Reference in New Issue
Block a user