SCRIPT: wpiformat

This commit is contained in:
PJ Reiniger
2025-11-07 20:01:58 -05:00
committed by Peter Johnson
parent ae6bdc9d25
commit 2109161534
749 changed files with 5504 additions and 3936 deletions

View File

@@ -26,7 +26,8 @@ void Robot::AutonomousInit() {
m_autonomousCommand = m_robot.GetAutonomousCommand();
if (m_autonomousCommand) {
wpi::cmd::CommandScheduler::GetInstance().Schedule(m_autonomousCommand.value());
wpi::cmd::CommandScheduler::GetInstance().Schedule(
m_autonomousCommand.value());
}
}

View File

@@ -35,7 +35,7 @@ Drive::Drive() {
}
wpi::cmd::CommandPtr Drive::ArcadeDriveCommand(std::function<double()> fwd,
std::function<double()> rot) {
std::function<double()> rot) {
return Run([this, fwd = std::move(fwd), rot = std::move(rot)] {
m_drive.ArcadeDrive(fwd(), rot());
})
@@ -43,7 +43,7 @@ wpi::cmd::CommandPtr Drive::ArcadeDriveCommand(std::function<double()> fwd,
}
wpi::cmd::CommandPtr Drive::DriveDistanceCommand(wpi::units::meter_t distance,
double speed) {
double speed) {
return RunOnce([this] {
// Reset encoders at the start of the command
m_leftEncoder.Reset();
@@ -52,8 +52,9 @@ wpi::cmd::CommandPtr Drive::DriveDistanceCommand(wpi::units::meter_t distance,
// Drive forward at specified speed
.AndThen(Run([this, speed] { m_drive.ArcadeDrive(speed, 0.0); }))
.Until([this, distance] {
return wpi::units::math::max(wpi::units::meter_t(m_leftEncoder.GetDistance()),
wpi::units::meter_t(m_rightEncoder.GetDistance())) >=
return wpi::units::math::max(
wpi::units::meter_t(m_leftEncoder.GetDistance()),
wpi::units::meter_t(m_rightEncoder.GetDistance())) >=
distance;
})
// Stop the drive when the command ends

View File

@@ -19,7 +19,8 @@ Shooter::Shooter() {
.WithName("Idle"));
}
wpi::cmd::CommandPtr Shooter::ShootCommand(wpi::units::turns_per_second_t setpoint) {
wpi::cmd::CommandPtr Shooter::ShootCommand(
wpi::units::turns_per_second_t setpoint) {
return wpi::cmd::cmd::Parallel(
// Run the shooter flywheel at the desired setpoint using
// feedforward and feedback

View File

@@ -29,7 +29,7 @@ class Drive : public wpi::cmd::SubsystemBase {
* @param rot the commanded rotation
*/
wpi::cmd::CommandPtr ArcadeDriveCommand(std::function<double()> fwd,
std::function<double()> rot);
std::function<double()> rot);
/**
* Returns a command that drives the robot forward a specified distance at a
@@ -38,7 +38,8 @@ class Drive : public wpi::cmd::SubsystemBase {
* @param distance The distance to drive forward in meters
* @param speed The fraction of max speed at which to drive
*/
wpi::cmd::CommandPtr DriveDistanceCommand(wpi::units::meter_t distance, double speed);
wpi::cmd::CommandPtr DriveDistanceCommand(wpi::units::meter_t distance,
double speed);
/**
* Returns a command that turns to robot to the specified angle using a motion