mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Run wpiformat on merged repo (#1021)
This commit is contained in:
committed by
Peter Johnson
parent
0babbf317c
commit
6729a7d6b1
@@ -10,8 +10,8 @@
|
||||
#include "../Robot.h"
|
||||
|
||||
ExampleCommand::ExampleCommand() {
|
||||
// Use Requires() here to declare subsystem dependencies
|
||||
Requires(&Robot::m_subsystem);
|
||||
// Use Requires() here to declare subsystem dependencies
|
||||
Requires(&Robot::m_subsystem);
|
||||
}
|
||||
|
||||
// Called just before this Command runs the first time
|
||||
@@ -21,9 +21,7 @@ void ExampleCommand::Initialize() {}
|
||||
void ExampleCommand::Execute() {}
|
||||
|
||||
// Make this return true when this Command no longer needs to run execute()
|
||||
bool ExampleCommand::IsFinished() {
|
||||
return false;
|
||||
}
|
||||
bool ExampleCommand::IsFinished() { return false; }
|
||||
|
||||
// Called once after isFinished returns true
|
||||
void ExampleCommand::End() {}
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
#include <Commands/Command.h>
|
||||
|
||||
class ExampleCommand : public frc::Command {
|
||||
public:
|
||||
ExampleCommand();
|
||||
void Initialize() override;
|
||||
void Execute() override;
|
||||
bool IsFinished() override;
|
||||
void End() override;
|
||||
void Interrupted() override;
|
||||
public:
|
||||
ExampleCommand();
|
||||
void Initialize() override;
|
||||
void Execute() override;
|
||||
bool IsFinished() override;
|
||||
void End() override;
|
||||
void Interrupted() override;
|
||||
};
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
#include "../Robot.h"
|
||||
|
||||
MyAutoCommand::MyAutoCommand() {
|
||||
// Use Requires() here to declare subsystem dependencies
|
||||
Requires(&Robot::m_subsystem);
|
||||
// Use Requires() here to declare subsystem dependencies
|
||||
Requires(&Robot::m_subsystem);
|
||||
}
|
||||
|
||||
// Called just before this Command runs the first time
|
||||
@@ -21,9 +21,7 @@ void MyAutoCommand::Initialize() {}
|
||||
void MyAutoCommand::Execute() {}
|
||||
|
||||
// Make this return true when this Command no longer needs to run execute()
|
||||
bool MyAutoCommand::IsFinished() {
|
||||
return false;
|
||||
}
|
||||
bool MyAutoCommand::IsFinished() { return false; }
|
||||
|
||||
// Called once after isFinished returns true
|
||||
void MyAutoCommand::End() {}
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
#include <Commands/Command.h>
|
||||
|
||||
class MyAutoCommand : public frc::Command {
|
||||
public:
|
||||
MyAutoCommand();
|
||||
void Initialize() override;
|
||||
void Execute() override;
|
||||
bool IsFinished() override;
|
||||
void End() override;
|
||||
void Interrupted() override;
|
||||
public:
|
||||
MyAutoCommand();
|
||||
void Initialize() override;
|
||||
void Execute() override;
|
||||
bool IsFinished() override;
|
||||
void End() override;
|
||||
void Interrupted() override;
|
||||
};
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
#include <WPILib.h>
|
||||
|
||||
OI::OI() {
|
||||
// Process operator interface input here.
|
||||
// Process operator interface input here.
|
||||
}
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
#pragma once
|
||||
|
||||
class OI {
|
||||
public:
|
||||
OI();
|
||||
public:
|
||||
OI();
|
||||
};
|
||||
|
||||
@@ -14,9 +14,9 @@ ExampleSubsystem Robot::m_subsystem;
|
||||
OI Robot::m_oi;
|
||||
|
||||
void Robot::RobotInit() {
|
||||
m_chooser.AddDefault("Default Auto", &m_defaultAuto);
|
||||
m_chooser.AddObject("My Auto", &m_myAuto);
|
||||
frc::SmartDashboard::PutData("Auto Modes", &m_chooser);
|
||||
m_chooser.AddDefault("Default Auto", &m_defaultAuto);
|
||||
m_chooser.AddObject("My Auto", &m_myAuto);
|
||||
frc::SmartDashboard::PutData("Auto Modes", &m_chooser);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -26,9 +26,7 @@ void Robot::RobotInit() {
|
||||
*/
|
||||
void Robot::DisabledInit() {}
|
||||
|
||||
void Robot::DisabledPeriodic() {
|
||||
frc::Scheduler::GetInstance()->Run();
|
||||
}
|
||||
void Robot::DisabledPeriodic() { frc::Scheduler::GetInstance()->Run(); }
|
||||
|
||||
/**
|
||||
* This autonomous (along with the chooser code above) shows how to select
|
||||
@@ -42,39 +40,35 @@ void Robot::DisabledPeriodic() {
|
||||
* the if-else structure below with additional strings & commands.
|
||||
*/
|
||||
void Robot::AutonomousInit() {
|
||||
// std::string autoSelected = frc::SmartDashboard::GetString(
|
||||
// "Auto Selector", "Default");
|
||||
// if (autoSelected == "My Auto") {
|
||||
// m_autonomousCommand = &m_myAuto;
|
||||
// } else {
|
||||
// m_autonomousCommand = &m_defaultAuto;
|
||||
// }
|
||||
// std::string autoSelected = frc::SmartDashboard::GetString(
|
||||
// "Auto Selector", "Default");
|
||||
// if (autoSelected == "My Auto") {
|
||||
// m_autonomousCommand = &m_myAuto;
|
||||
// } else {
|
||||
// m_autonomousCommand = &m_defaultAuto;
|
||||
// }
|
||||
|
||||
m_autonomousCommand = m_chooser.GetSelected();
|
||||
m_autonomousCommand = m_chooser.GetSelected();
|
||||
|
||||
if (m_autonomousCommand != nullptr) {
|
||||
m_autonomousCommand->Start();
|
||||
}
|
||||
if (m_autonomousCommand != nullptr) {
|
||||
m_autonomousCommand->Start();
|
||||
}
|
||||
}
|
||||
|
||||
void Robot::AutonomousPeriodic() {
|
||||
frc::Scheduler::GetInstance()->Run();
|
||||
}
|
||||
void Robot::AutonomousPeriodic() { frc::Scheduler::GetInstance()->Run(); }
|
||||
|
||||
void Robot::TeleopInit() {
|
||||
// This makes sure that the autonomous stops running when
|
||||
// teleop starts running. If you want the autonomous to
|
||||
// continue until interrupted by another command, remove
|
||||
// this line or comment it out.
|
||||
if (m_autonomousCommand != nullptr) {
|
||||
m_autonomousCommand->Cancel();
|
||||
m_autonomousCommand = nullptr;
|
||||
}
|
||||
// This makes sure that the autonomous stops running when
|
||||
// teleop starts running. If you want the autonomous to
|
||||
// continue until interrupted by another command, remove
|
||||
// this line or comment it out.
|
||||
if (m_autonomousCommand != nullptr) {
|
||||
m_autonomousCommand->Cancel();
|
||||
m_autonomousCommand = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void Robot::TeleopPeriodic() {
|
||||
frc::Scheduler::GetInstance()->Run();
|
||||
}
|
||||
void Robot::TeleopPeriodic() { frc::Scheduler::GetInstance()->Run(); }
|
||||
|
||||
void Robot::TestPeriodic() {}
|
||||
|
||||
|
||||
@@ -17,24 +17,24 @@
|
||||
#include "Subsystems/ExampleSubsystem.h"
|
||||
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
static ExampleSubsystem m_subsystem;
|
||||
static OI m_oi;
|
||||
public:
|
||||
static ExampleSubsystem m_subsystem;
|
||||
static OI m_oi;
|
||||
|
||||
void RobotInit() override;
|
||||
void DisabledInit() override;
|
||||
void DisabledPeriodic() override;
|
||||
void AutonomousInit() override;
|
||||
void AutonomousPeriodic() override;
|
||||
void TeleopInit() override;
|
||||
void TeleopPeriodic() override;
|
||||
void TestPeriodic() override;
|
||||
void RobotInit() override;
|
||||
void DisabledInit() override;
|
||||
void DisabledPeriodic() override;
|
||||
void AutonomousInit() override;
|
||||
void AutonomousPeriodic() override;
|
||||
void TeleopInit() override;
|
||||
void TeleopPeriodic() override;
|
||||
void TestPeriodic() override;
|
||||
|
||||
private:
|
||||
// Have it null by default so that if testing teleop it
|
||||
// doesn't have undefined behavior and potentially crash.
|
||||
frc::Command* m_autonomousCommand = nullptr;
|
||||
ExampleCommand m_defaultAuto;
|
||||
MyAutoCommand m_myAuto;
|
||||
frc::SendableChooser<frc::Command*> m_chooser;
|
||||
private:
|
||||
// Have it null by default so that if testing teleop it
|
||||
// doesn't have undefined behavior and potentially crash.
|
||||
frc::Command* m_autonomousCommand = nullptr;
|
||||
ExampleCommand m_defaultAuto;
|
||||
MyAutoCommand m_myAuto;
|
||||
frc::SendableChooser<frc::Command*> m_chooser;
|
||||
};
|
||||
|
||||
@@ -9,12 +9,11 @@
|
||||
|
||||
#include "../RobotMap.h"
|
||||
|
||||
ExampleSubsystem::ExampleSubsystem()
|
||||
: frc::Subsystem("ExampleSubsystem") {}
|
||||
ExampleSubsystem::ExampleSubsystem() : frc::Subsystem("ExampleSubsystem") {}
|
||||
|
||||
void ExampleSubsystem::InitDefaultCommand() {
|
||||
// Set the default command for a subsystem here.
|
||||
// SetDefaultCommand(new MySpecialCommand());
|
||||
// Set the default command for a subsystem here.
|
||||
// SetDefaultCommand(new MySpecialCommand());
|
||||
}
|
||||
|
||||
// Put methods for controlling this subsystem
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
#include <Commands/Subsystem.h>
|
||||
|
||||
class ExampleSubsystem : public frc::Subsystem {
|
||||
public:
|
||||
ExampleSubsystem();
|
||||
void InitDefaultCommand() override;
|
||||
public:
|
||||
ExampleSubsystem();
|
||||
void InitDefaultCommand() override;
|
||||
|
||||
private:
|
||||
// It's desirable that everything possible under private except
|
||||
// for methods that implement subsystem capabilities
|
||||
private:
|
||||
// It's desirable that everything possible under private except
|
||||
// for methods that implement subsystem capabilities
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user