SCRIPT namespace replacements

This commit is contained in:
PJ Reiniger
2025-11-07 20:00:05 -05:00
committed by Peter Johnson
parent ae6c043632
commit 9aca8e0fd6
2622 changed files with 22275 additions and 22275 deletions

View File

@@ -9,7 +9,7 @@
#include "RobotContainer.hpp"
class Robot : public frc::TimedRobot {
class Robot : public wpi::TimedRobot {
public:
Robot();
void RobotPeriodic() override;
@@ -24,6 +24,6 @@ class Robot : public frc::TimedRobot {
private:
// Have it null by default so that if testing teleop it
// doesn't have undefined behavior and potentially crash.
frc2::Command* m_autonomousCommand = nullptr;
wpi::cmd::Command* m_autonomousCommand = nullptr;
RobotContainer m_container;
};

View File

@@ -39,20 +39,20 @@ class RobotContainer {
// Your subsystem configuration should take the overlays into account
public:
RobotContainer();
frc2::Command* GetAutonomousCommand();
wpi::cmd::Command* GetAutonomousCommand();
private:
// Assumes a gamepad plugged into channel 0
frc::Joystick m_controller{0};
frc::SendableChooser<frc2::Command*> m_chooser;
wpi::Joystick m_controller{0};
wpi::SendableChooser<wpi::cmd::Command*> m_chooser;
// The robot's subsystems
Drivetrain m_drive;
Arm m_arm;
frc::XRPOnBoardIO m_onboardIO;
wpi::xrp::XRPOnBoardIO m_onboardIO;
// Example button
frc2::Trigger m_userButton{
wpi::cmd::Trigger m_userButton{
[this] { return m_onboardIO.GetUserButtonPressed(); }};
// Autonomous commands.

View File

@@ -12,7 +12,7 @@
#include "subsystems/Drivetrain.hpp"
class AutonomousDistance
: public frc2::CommandHelper<frc2::SequentialCommandGroup,
: public wpi::cmd::CommandHelper<wpi::cmd::SequentialCommandGroup,
AutonomousDistance> {
public:
/**

View File

@@ -12,7 +12,7 @@
#include "subsystems/Drivetrain.hpp"
class AutonomousTime
: public frc2::CommandHelper<frc2::SequentialCommandGroup, AutonomousTime> {
: public wpi::cmd::CommandHelper<wpi::cmd::SequentialCommandGroup, AutonomousTime> {
public:
/**
* Creates a new Autonomous Drive based on time. This will drive out for a

View File

@@ -10,7 +10,7 @@
#include "subsystems/Drivetrain.hpp"
class DriveDistance : public frc2::CommandHelper<frc2::Command, DriveDistance> {
class DriveDistance : public wpi::cmd::CommandHelper<wpi::cmd::Command, DriveDistance> {
public:
/**
* Creates a new DriveDistance. This command will drive your your robot for a
@@ -20,7 +20,7 @@ class DriveDistance : public frc2::CommandHelper<frc2::Command, DriveDistance> {
* @param distance The distance the robot will drive
* @param drive The drivetrain subsystem on which this command will run
*/
DriveDistance(double speed, units::meter_t distance, Drivetrain* drive)
DriveDistance(double speed, wpi::units::meter_t distance, Drivetrain* drive)
: m_speed(speed), m_distance(distance), m_drive(drive) {
AddRequirements(m_drive);
}
@@ -32,6 +32,6 @@ class DriveDistance : public frc2::CommandHelper<frc2::Command, DriveDistance> {
private:
double m_speed;
units::meter_t m_distance;
wpi::units::meter_t m_distance;
Drivetrain* m_drive;
};

View File

@@ -11,7 +11,7 @@
#include "subsystems/Drivetrain.hpp"
class DriveTime : public frc2::CommandHelper<frc2::Command, DriveTime> {
class DriveTime : public wpi::cmd::CommandHelper<wpi::cmd::Command, DriveTime> {
public:
/**
* Creates a new DriveTime. This command will drive your robot for a desired
@@ -21,7 +21,7 @@ class DriveTime : public frc2::CommandHelper<frc2::Command, DriveTime> {
* @param time How much time to drive
* @param drive The drivetrain subsystem on which this command will run
*/
DriveTime(double speed, units::second_t time, Drivetrain* drive)
DriveTime(double speed, wpi::units::second_t time, Drivetrain* drive)
: m_speed(speed), m_duration(time), m_drive(drive) {
AddRequirements(m_drive);
}
@@ -33,7 +33,7 @@ class DriveTime : public frc2::CommandHelper<frc2::Command, DriveTime> {
private:
double m_speed;
units::second_t m_duration;
wpi::units::second_t m_duration;
Drivetrain* m_drive;
frc::Timer m_timer;
wpi::Timer m_timer;
};

View File

@@ -12,7 +12,7 @@
#include "subsystems/Drivetrain.hpp"
class TeleopArcadeDrive
: public frc2::CommandHelper<frc2::Command, TeleopArcadeDrive> {
: public wpi::cmd::CommandHelper<wpi::cmd::Command, TeleopArcadeDrive> {
public:
/**
* Creates a new ArcadeDrive. This command will drive your robot according to

View File

@@ -11,7 +11,7 @@
#include "subsystems/Drivetrain.hpp"
class TurnDegrees : public frc2::CommandHelper<frc2::Command, TurnDegrees> {
class TurnDegrees : public wpi::cmd::CommandHelper<wpi::cmd::Command, TurnDegrees> {
public:
/**
* Creates a new TurnDegrees. This command will turn your robot for a desired
@@ -21,7 +21,7 @@ class TurnDegrees : public frc2::CommandHelper<frc2::Command, TurnDegrees> {
* @param angle Degrees to turn. Leverages encoders to compare distance.
* @param drive The drive subsystem on which this command will run
*/
TurnDegrees(double speed, units::degree_t angle, Drivetrain* drive)
TurnDegrees(double speed, wpi::units::degree_t angle, Drivetrain* drive)
: m_speed(speed), m_angle(angle), m_drive(drive) {
AddRequirements(m_drive);
}
@@ -33,8 +33,8 @@ class TurnDegrees : public frc2::CommandHelper<frc2::Command, TurnDegrees> {
private:
double m_speed;
units::degree_t m_angle;
wpi::units::degree_t m_angle;
Drivetrain* m_drive;
units::meter_t GetAverageTurningDistance();
wpi::units::meter_t GetAverageTurningDistance();
};

View File

@@ -11,7 +11,7 @@
#include "subsystems/Drivetrain.hpp"
class TurnTime : public frc2::CommandHelper<frc2::Command, TurnTime> {
class TurnTime : public wpi::cmd::CommandHelper<wpi::cmd::Command, TurnTime> {
public:
/**
* Creates a new TurnTime.
@@ -20,7 +20,7 @@ class TurnTime : public frc2::CommandHelper<frc2::Command, TurnTime> {
* @param time How much time to turn
* @param drive The drive subsystem on which this command will run
*/
TurnTime(double speed, units::second_t time, Drivetrain* drive)
TurnTime(double speed, wpi::units::second_t time, Drivetrain* drive)
: m_speed(speed), m_duration(time), m_drive(drive) {
AddRequirements(m_drive);
}
@@ -32,7 +32,7 @@ class TurnTime : public frc2::CommandHelper<frc2::Command, TurnTime> {
private:
double m_speed;
units::second_t m_duration;
wpi::units::second_t m_duration;
Drivetrain* m_drive;
frc::Timer m_timer;
wpi::Timer m_timer;
};

View File

@@ -8,7 +8,7 @@
#include <wpi/units/angle.hpp>
#include <wpi/xrp/XRPServo.hpp>
class Arm : public frc2::SubsystemBase {
class Arm : public wpi::cmd::SubsystemBase {
public:
/**
* Will be called periodically whenever the CommandScheduler runs.
@@ -20,8 +20,8 @@ class Arm : public frc2::SubsystemBase {
*
* @param angle the commanded angle
*/
void SetAngle(units::radian_t angle);
void SetAngle(wpi::units::radian_t angle);
private:
frc::XRPServo m_armServo{4};
wpi::xrp::XRPServo m_armServo{4};
};

View File

@@ -13,14 +13,14 @@
#include <wpi/xrp/XRPGyro.hpp>
#include <wpi/xrp/XRPMotor.hpp>
class Drivetrain : public frc2::SubsystemBase {
class Drivetrain : public wpi::cmd::SubsystemBase {
public:
static constexpr double kGearRatio =
(30.0 / 14.0) * (28.0 / 16.0) * (36.0 / 9.0) * (26.0 / 8.0); // 48.75:1
static constexpr double kCountsPerMotorShaftRev = 12.0;
static constexpr double kCountsPerRevolution =
kCountsPerMotorShaftRev * kGearRatio; // 585.0
static constexpr units::meter_t kWheelDiameter = 60_mm;
static constexpr wpi::units::meter_t kWheelDiameter = 60_mm;
Drivetrain();
@@ -61,42 +61,42 @@ class Drivetrain : public frc2::SubsystemBase {
*
* @return the left-side distance driven
*/
units::meter_t GetLeftDistance();
wpi::units::meter_t GetLeftDistance();
/**
* Gets the right distance driven.
*
* @return the right-side distance driven
*/
units::meter_t GetRightDistance();
wpi::units::meter_t GetRightDistance();
/**
* Returns the average distance traveled by the left and right encoders.
*
* @return The average distance traveled by the left and right encoders.
*/
units::meter_t GetAverageDistance();
wpi::units::meter_t GetAverageDistance();
/**
* Current angle of the XRP around the X-axis.
*
* @return The current angle of the XRP.
*/
units::radian_t GetGyroAngleX();
wpi::units::radian_t GetGyroAngleX();
/**
* Current angle of the XRP around the Y-axis.
*
* @return The current angle of the XRP.
*/
units::radian_t GetGyroAngleY();
wpi::units::radian_t GetGyroAngleY();
/**
* Current angle of the XRP around the Z-axis.
*
* @return The current angle of the XRP.
*/
units::radian_t GetGyroAngleZ();
wpi::units::radian_t GetGyroAngleZ();
/**
* Reset the gyro.
@@ -104,15 +104,15 @@ class Drivetrain : public frc2::SubsystemBase {
void ResetGyro();
private:
frc::XRPMotor m_leftMotor{0};
frc::XRPMotor m_rightMotor{1};
wpi::xrp::XRPMotor m_leftMotor{0};
wpi::xrp::XRPMotor m_rightMotor{1};
frc::Encoder m_leftEncoder{4, 5};
frc::Encoder m_rightEncoder{6, 7};
wpi::Encoder m_leftEncoder{4, 5};
wpi::Encoder m_rightEncoder{6, 7};
frc::DifferentialDrive m_drive{
wpi::DifferentialDrive m_drive{
[&](double output) { m_leftMotor.Set(output); },
[&](double output) { m_rightMotor.Set(output); }};
frc::XRPGyro m_gyro;
wpi::xrp::XRPGyro m_gyro;
};