mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
People generally have expressed a dislike for the Hungarian notation used in member variables, especially in examples/templates, and our styleguide shouldn't be forced on downstream consumers, so this removes all Hungarian notation from the examples/templates. There are _some_ benefits to Hungarian for private member variables (like knowing what's a member vs. local in a PR review) so we'll keep private member variables the same for now, but public variables should no longer use Hungarian notation, since it looks much worse. A new PMD XPath rule has been added to accomplish this goal. Some other non-compliant variables were fixed for the new rule.
82 lines
2.2 KiB
C++
82 lines
2.2 KiB
C++
// Copyright (c) FIRST and other WPILib contributors.
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
// the WPILib BSD license file in the root directory of this project.
|
|
|
|
#include "Robot.hpp"
|
|
|
|
#include "wpi/commands2/CommandScheduler.hpp"
|
|
#include "wpi/driverstation/DriverStation.hpp"
|
|
#include "wpi/smartdashboard/SmartDashboard.hpp"
|
|
#include "wpi/system/DataLogManager.hpp"
|
|
|
|
Robot::Robot() {
|
|
// Start recording to data log
|
|
wpi::DataLogManager::Start();
|
|
|
|
// Record DS control and joystick data.
|
|
// Change to `false` to not record joystick data.
|
|
wpi::DriverStation::StartDataLog(wpi::DataLogManager::GetLog(), true);
|
|
}
|
|
|
|
/**
|
|
* This function is called every 20 ms, no matter the mode. Use
|
|
* this for items like diagnostics that you want to run during disabled,
|
|
* autonomous, teleoperated and utility.
|
|
*
|
|
* <p> This runs after the mode specific periodic functions, but before
|
|
* LiveWindow and SmartDashboard integrated updating.
|
|
*/
|
|
void Robot::RobotPeriodic() {
|
|
wpi::cmd::CommandScheduler::GetInstance().Run();
|
|
}
|
|
|
|
/**
|
|
* This function is called once each time the robot enters Disabled mode. You
|
|
* can use it to reset any subsystem information you want to clear when the
|
|
* robot is disabled.
|
|
*/
|
|
void Robot::DisabledInit() {}
|
|
|
|
void Robot::DisabledPeriodic() {}
|
|
|
|
/**
|
|
* This autonomous runs the autonomous command selected by your {@link
|
|
* RobotContainer} class.
|
|
*/
|
|
void Robot::AutonomousInit() {
|
|
autonomousCommand = container.GetAutonomousCommand();
|
|
|
|
if (autonomousCommand != nullptr) {
|
|
wpi::cmd::CommandScheduler::GetInstance().Schedule(autonomousCommand);
|
|
}
|
|
}
|
|
|
|
void Robot::AutonomousPeriodic() {}
|
|
|
|
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 (autonomousCommand != nullptr) {
|
|
autonomousCommand->Cancel();
|
|
autonomousCommand = nullptr;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* This function is called periodically during operator control.
|
|
*/
|
|
void Robot::TeleopPeriodic() {}
|
|
|
|
/**
|
|
* This function is called periodically during utility mode.
|
|
*/
|
|
void Robot::UtilityPeriodic() {}
|
|
|
|
#ifndef RUNNING_WPILIB_TESTS
|
|
int main() {
|
|
return wpi::StartRobot<Robot>();
|
|
}
|
|
#endif
|