mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
gitattributes: Mark C++ source files as text (#6210)
Some C++ files had been checked in with CRLF line endings. This fixes those and also fixes future commits.
This commit is contained in:
@@ -1,55 +1,55 @@
|
||||
// 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.h"
|
||||
|
||||
#include <frc2/command/CommandScheduler.h>
|
||||
|
||||
void Robot::RobotInit() {}
|
||||
|
||||
void Robot::RobotPeriodic() {
|
||||
frc2::CommandScheduler::GetInstance().Run();
|
||||
}
|
||||
|
||||
void Robot::DisabledInit() {}
|
||||
|
||||
void Robot::DisabledPeriodic() {}
|
||||
|
||||
void Robot::DisabledExit() {}
|
||||
|
||||
void Robot::AutonomousInit() {
|
||||
m_autonomousCommand = m_container.GetAutonomousCommand();
|
||||
|
||||
if (m_autonomousCommand) {
|
||||
m_autonomousCommand->Schedule();
|
||||
}
|
||||
}
|
||||
|
||||
void Robot::AutonomousPeriodic() {}
|
||||
|
||||
void Robot::AutonomousExit() {}
|
||||
|
||||
void Robot::TeleopInit() {
|
||||
if (m_autonomousCommand) {
|
||||
m_autonomousCommand->Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
void Robot::TeleopPeriodic() {}
|
||||
|
||||
void Robot::TeleopExit() {}
|
||||
|
||||
void Robot::TestInit() {
|
||||
frc2::CommandScheduler::GetInstance().CancelAll();
|
||||
}
|
||||
|
||||
void Robot::TestPeriodic() {}
|
||||
|
||||
void Robot::TestExit() {}
|
||||
|
||||
#ifndef RUNNING_FRC_TESTS
|
||||
int main() {
|
||||
return frc::StartRobot<Robot>();
|
||||
}
|
||||
#endif
|
||||
// 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.h"
|
||||
|
||||
#include <frc2/command/CommandScheduler.h>
|
||||
|
||||
void Robot::RobotInit() {}
|
||||
|
||||
void Robot::RobotPeriodic() {
|
||||
frc2::CommandScheduler::GetInstance().Run();
|
||||
}
|
||||
|
||||
void Robot::DisabledInit() {}
|
||||
|
||||
void Robot::DisabledPeriodic() {}
|
||||
|
||||
void Robot::DisabledExit() {}
|
||||
|
||||
void Robot::AutonomousInit() {
|
||||
m_autonomousCommand = m_container.GetAutonomousCommand();
|
||||
|
||||
if (m_autonomousCommand) {
|
||||
m_autonomousCommand->Schedule();
|
||||
}
|
||||
}
|
||||
|
||||
void Robot::AutonomousPeriodic() {}
|
||||
|
||||
void Robot::AutonomousExit() {}
|
||||
|
||||
void Robot::TeleopInit() {
|
||||
if (m_autonomousCommand) {
|
||||
m_autonomousCommand->Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
void Robot::TeleopPeriodic() {}
|
||||
|
||||
void Robot::TeleopExit() {}
|
||||
|
||||
void Robot::TestInit() {
|
||||
frc2::CommandScheduler::GetInstance().CancelAll();
|
||||
}
|
||||
|
||||
void Robot::TestPeriodic() {}
|
||||
|
||||
void Robot::TestExit() {}
|
||||
|
||||
#ifndef RUNNING_FRC_TESTS
|
||||
int main() {
|
||||
return frc::StartRobot<Robot>();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
// 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 "SysIdRoutineBot.h"
|
||||
|
||||
#include <frc2/command/Commands.h>
|
||||
|
||||
SysIdRoutineBot::SysIdRoutineBot() {
|
||||
ConfigureBindings();
|
||||
}
|
||||
|
||||
void SysIdRoutineBot::ConfigureBindings() {
|
||||
m_drive.SetDefaultCommand(m_drive.ArcadeDriveCommand(
|
||||
[this] { return -m_driverController.GetLeftY(); },
|
||||
[this] { return -m_driverController.GetRightX(); }));
|
||||
|
||||
m_driverController.A().WhileTrue(
|
||||
m_drive.SysIdQuasistatic(frc2::sysid::Direction::kForward));
|
||||
m_driverController.B().WhileTrue(
|
||||
m_drive.SysIdQuasistatic(frc2::sysid::Direction::kReverse));
|
||||
m_driverController.X().WhileTrue(
|
||||
m_drive.SysIdDynamic(frc2::sysid::Direction::kForward));
|
||||
m_driverController.Y().WhileTrue(
|
||||
m_drive.SysIdDynamic(frc2::sysid::Direction::kReverse));
|
||||
}
|
||||
|
||||
frc2::CommandPtr SysIdRoutineBot::GetAutonomousCommand() {
|
||||
return m_drive.Run([] {});
|
||||
}
|
||||
// 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 "SysIdRoutineBot.h"
|
||||
|
||||
#include <frc2/command/Commands.h>
|
||||
|
||||
SysIdRoutineBot::SysIdRoutineBot() {
|
||||
ConfigureBindings();
|
||||
}
|
||||
|
||||
void SysIdRoutineBot::ConfigureBindings() {
|
||||
m_drive.SetDefaultCommand(m_drive.ArcadeDriveCommand(
|
||||
[this] { return -m_driverController.GetLeftY(); },
|
||||
[this] { return -m_driverController.GetRightX(); }));
|
||||
|
||||
m_driverController.A().WhileTrue(
|
||||
m_drive.SysIdQuasistatic(frc2::sysid::Direction::kForward));
|
||||
m_driverController.B().WhileTrue(
|
||||
m_drive.SysIdQuasistatic(frc2::sysid::Direction::kReverse));
|
||||
m_driverController.X().WhileTrue(
|
||||
m_drive.SysIdDynamic(frc2::sysid::Direction::kForward));
|
||||
m_driverController.Y().WhileTrue(
|
||||
m_drive.SysIdDynamic(frc2::sysid::Direction::kReverse));
|
||||
}
|
||||
|
||||
frc2::CommandPtr SysIdRoutineBot::GetAutonomousCommand() {
|
||||
return m_drive.Run([] {});
|
||||
}
|
||||
|
||||
@@ -1,37 +1,37 @@
|
||||
// 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 "subsystems/Drive.h"
|
||||
|
||||
#include <frc2/command/Commands.h>
|
||||
|
||||
Drive::Drive() {
|
||||
m_leftMotor.AddFollower(frc::PWMSparkMax{constants::drive::kLeftMotor2Port});
|
||||
m_rightMotor.AddFollower(
|
||||
frc::PWMSparkMax{constants::drive::kRightMotor2Port});
|
||||
|
||||
m_rightMotor.SetInverted(true);
|
||||
|
||||
m_leftEncoder.SetDistancePerPulse(
|
||||
constants::drive::kEncoderDistancePerPulse.value());
|
||||
m_rightEncoder.SetDistancePerPulse(
|
||||
constants::drive::kEncoderDistancePerPulse.value());
|
||||
|
||||
m_drive.SetSafetyEnabled(false);
|
||||
}
|
||||
|
||||
frc2::CommandPtr Drive::ArcadeDriveCommand(std::function<double()> fwd,
|
||||
std::function<double()> rot) {
|
||||
return frc2::cmd::Run([this, fwd, rot] { m_drive.ArcadeDrive(fwd(), rot()); },
|
||||
{this})
|
||||
.WithName("Arcade Drive");
|
||||
}
|
||||
|
||||
frc2::CommandPtr Drive::SysIdQuasistatic(frc2::sysid::Direction direction) {
|
||||
return m_sysIdRoutine.Quasistatic(direction);
|
||||
}
|
||||
|
||||
frc2::CommandPtr Drive::SysIdDynamic(frc2::sysid::Direction direction) {
|
||||
return m_sysIdRoutine.Dynamic(direction);
|
||||
}
|
||||
// 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 "subsystems/Drive.h"
|
||||
|
||||
#include <frc2/command/Commands.h>
|
||||
|
||||
Drive::Drive() {
|
||||
m_leftMotor.AddFollower(frc::PWMSparkMax{constants::drive::kLeftMotor2Port});
|
||||
m_rightMotor.AddFollower(
|
||||
frc::PWMSparkMax{constants::drive::kRightMotor2Port});
|
||||
|
||||
m_rightMotor.SetInverted(true);
|
||||
|
||||
m_leftEncoder.SetDistancePerPulse(
|
||||
constants::drive::kEncoderDistancePerPulse.value());
|
||||
m_rightEncoder.SetDistancePerPulse(
|
||||
constants::drive::kEncoderDistancePerPulse.value());
|
||||
|
||||
m_drive.SetSafetyEnabled(false);
|
||||
}
|
||||
|
||||
frc2::CommandPtr Drive::ArcadeDriveCommand(std::function<double()> fwd,
|
||||
std::function<double()> rot) {
|
||||
return frc2::cmd::Run([this, fwd, rot] { m_drive.ArcadeDrive(fwd(), rot()); },
|
||||
{this})
|
||||
.WithName("Arcade Drive");
|
||||
}
|
||||
|
||||
frc2::CommandPtr Drive::SysIdQuasistatic(frc2::sysid::Direction direction) {
|
||||
return m_sysIdRoutine.Quasistatic(direction);
|
||||
}
|
||||
|
||||
frc2::CommandPtr Drive::SysIdDynamic(frc2::sysid::Direction direction) {
|
||||
return m_sysIdRoutine.Dynamic(direction);
|
||||
}
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
// 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc2/command/CommandPtr.h>
|
||||
|
||||
#include "SysIdRoutineBot.h"
|
||||
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
void RobotInit() override;
|
||||
void RobotPeriodic() override;
|
||||
void DisabledInit() override;
|
||||
void DisabledPeriodic() override;
|
||||
void DisabledExit() override;
|
||||
void AutonomousInit() override;
|
||||
void AutonomousPeriodic() override;
|
||||
void AutonomousExit() override;
|
||||
void TeleopInit() override;
|
||||
void TeleopPeriodic() override;
|
||||
void TeleopExit() override;
|
||||
void TestInit() override;
|
||||
void TestPeriodic() override;
|
||||
void TestExit() override;
|
||||
|
||||
private:
|
||||
std::optional<frc2::CommandPtr> m_autonomousCommand;
|
||||
|
||||
SysIdRoutineBot m_container;
|
||||
};
|
||||
// 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include <frc/TimedRobot.h>
|
||||
#include <frc2/command/CommandPtr.h>
|
||||
|
||||
#include "SysIdRoutineBot.h"
|
||||
|
||||
class Robot : public frc::TimedRobot {
|
||||
public:
|
||||
void RobotInit() override;
|
||||
void RobotPeriodic() override;
|
||||
void DisabledInit() override;
|
||||
void DisabledPeriodic() override;
|
||||
void DisabledExit() override;
|
||||
void AutonomousInit() override;
|
||||
void AutonomousPeriodic() override;
|
||||
void AutonomousExit() override;
|
||||
void TeleopInit() override;
|
||||
void TeleopPeriodic() override;
|
||||
void TeleopExit() override;
|
||||
void TestInit() override;
|
||||
void TestPeriodic() override;
|
||||
void TestExit() override;
|
||||
|
||||
private:
|
||||
std::optional<frc2::CommandPtr> m_autonomousCommand;
|
||||
|
||||
SysIdRoutineBot m_container;
|
||||
};
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
// 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <frc2/command/CommandPtr.h>
|
||||
#include <frc2/command/button/CommandXboxController.h>
|
||||
|
||||
#include "Constants.h"
|
||||
#include "subsystems/Drive.h"
|
||||
|
||||
class SysIdRoutineBot {
|
||||
public:
|
||||
SysIdRoutineBot();
|
||||
|
||||
frc2::CommandPtr GetAutonomousCommand();
|
||||
|
||||
private:
|
||||
void ConfigureBindings();
|
||||
frc2::CommandXboxController m_driverController{
|
||||
constants::oi::kDriverControllerPort};
|
||||
Drive m_drive{};
|
||||
};
|
||||
// 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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <frc2/command/CommandPtr.h>
|
||||
#include <frc2/command/button/CommandXboxController.h>
|
||||
|
||||
#include "Constants.h"
|
||||
#include "subsystems/Drive.h"
|
||||
|
||||
class SysIdRoutineBot {
|
||||
public:
|
||||
SysIdRoutineBot();
|
||||
|
||||
frc2::CommandPtr GetAutonomousCommand();
|
||||
|
||||
private:
|
||||
void ConfigureBindings();
|
||||
frc2::CommandXboxController m_driverController{
|
||||
constants::oi::kDriverControllerPort};
|
||||
Drive m_drive{};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user