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

@@ -15,7 +15,7 @@
#include "wpi/util/sendable/SendableBuilder.hpp"
#include "wpi/util/sendable/SendableRegistry.hpp"
using namespace frc;
using namespace wpi;
WPI_IGNORE_DEPRECATED
@@ -23,8 +23,8 @@ DifferentialDrive::DifferentialDrive(MotorController& leftMotor,
MotorController& rightMotor)
: DifferentialDrive{[&](double output) { leftMotor.Set(output); },
[&](double output) { rightMotor.Set(output); }} {
wpi::SendableRegistry::AddChild(this, &leftMotor);
wpi::SendableRegistry::AddChild(this, &rightMotor);
wpi::util::SendableRegistry::AddChild(this, &leftMotor);
wpi::util::SendableRegistry::AddChild(this, &rightMotor);
}
WPI_UNIGNORE_DEPRECATED
@@ -34,7 +34,7 @@ DifferentialDrive::DifferentialDrive(std::function<void(double)> leftMotor,
: m_leftMotor{std::move(leftMotor)}, m_rightMotor{std::move(rightMotor)} {
static int instances = 0;
++instances;
wpi::SendableRegistry::Add(this, "DifferentialDrive", instances);
wpi::util::SendableRegistry::Add(this, "DifferentialDrive", instances);
}
void DifferentialDrive::ArcadeDrive(double xSpeed, double zRotation,
@@ -45,8 +45,8 @@ void DifferentialDrive::ArcadeDrive(double xSpeed, double zRotation,
reported = true;
}
xSpeed = ApplyDeadband(xSpeed, m_deadband);
zRotation = ApplyDeadband(zRotation, m_deadband);
xSpeed = wpi::math::ApplyDeadband(xSpeed, m_deadband);
zRotation = wpi::math::ApplyDeadband(zRotation, m_deadband);
auto [left, right] = ArcadeDriveIK(xSpeed, zRotation, squareInputs);
@@ -67,8 +67,8 @@ void DifferentialDrive::CurvatureDrive(double xSpeed, double zRotation,
reported = true;
}
xSpeed = ApplyDeadband(xSpeed, m_deadband);
zRotation = ApplyDeadband(zRotation, m_deadband);
xSpeed = wpi::math::ApplyDeadband(xSpeed, m_deadband);
zRotation = wpi::math::ApplyDeadband(zRotation, m_deadband);
auto [left, right] = CurvatureDriveIK(xSpeed, zRotation, allowTurnInPlace);
@@ -89,8 +89,8 @@ void DifferentialDrive::TankDrive(double leftSpeed, double rightSpeed,
reported = true;
}
leftSpeed = ApplyDeadband(leftSpeed, m_deadband);
rightSpeed = ApplyDeadband(rightSpeed, m_deadband);
leftSpeed = wpi::math::ApplyDeadband(leftSpeed, m_deadband);
rightSpeed = wpi::math::ApplyDeadband(rightSpeed, m_deadband);
auto [left, right] = TankDriveIK(leftSpeed, rightSpeed, squareInputs);
@@ -111,8 +111,8 @@ DifferentialDrive::WheelSpeeds DifferentialDrive::ArcadeDriveIK(
// Square the inputs (while preserving the sign) to increase fine control
// while permitting full power.
if (squareInputs) {
xSpeed = CopyDirectionPow(xSpeed, 2);
zRotation = CopyDirectionPow(zRotation, 2);
xSpeed = wpi::math::CopyDirectionPow(xSpeed, 2);
zRotation = wpi::math::CopyDirectionPow(zRotation, 2);
}
double leftSpeed = xSpeed - zRotation;
@@ -166,8 +166,8 @@ DifferentialDrive::WheelSpeeds DifferentialDrive::TankDriveIK(
// Square the inputs (while preserving the sign) to increase fine control
// while permitting full power.
if (squareInputs) {
leftSpeed = CopyDirectionPow(leftSpeed, 2);
rightSpeed = CopyDirectionPow(rightSpeed, 2);
leftSpeed = wpi::math::CopyDirectionPow(leftSpeed, 2);
rightSpeed = wpi::math::CopyDirectionPow(rightSpeed, 2);
}
return {leftSpeed, rightSpeed};
@@ -187,7 +187,7 @@ std::string DifferentialDrive::GetDescription() const {
return "DifferentialDrive";
}
void DifferentialDrive::InitSendable(wpi::SendableBuilder& builder) {
void DifferentialDrive::InitSendable(wpi::util::SendableBuilder& builder) {
builder.SetSmartDashboardType("DifferentialDrive");
builder.SetActuator(true);
builder.AddDoubleProperty(

View File

@@ -15,7 +15,7 @@
#include "wpi/util/sendable/SendableBuilder.hpp"
#include "wpi/util/sendable/SendableRegistry.hpp"
using namespace frc;
using namespace wpi;
WPI_IGNORE_DEPRECATED
@@ -27,10 +27,10 @@ MecanumDrive::MecanumDrive(MotorController& frontLeftMotor,
[&](double output) { rearLeftMotor.Set(output); },
[&](double output) { frontRightMotor.Set(output); },
[&](double output) { rearRightMotor.Set(output); }} {
wpi::SendableRegistry::AddChild(this, &frontLeftMotor);
wpi::SendableRegistry::AddChild(this, &rearLeftMotor);
wpi::SendableRegistry::AddChild(this, &frontRightMotor);
wpi::SendableRegistry::AddChild(this, &rearRightMotor);
wpi::util::SendableRegistry::AddChild(this, &frontLeftMotor);
wpi::util::SendableRegistry::AddChild(this, &rearLeftMotor);
wpi::util::SendableRegistry::AddChild(this, &frontRightMotor);
wpi::util::SendableRegistry::AddChild(this, &rearRightMotor);
}
WPI_UNIGNORE_DEPRECATED
@@ -45,18 +45,18 @@ MecanumDrive::MecanumDrive(std::function<void(double)> frontLeftMotor,
m_rearRightMotor{std::move(rearRightMotor)} {
static int instances = 0;
++instances;
wpi::SendableRegistry::Add(this, "MecanumDrive", instances);
wpi::util::SendableRegistry::Add(this, "MecanumDrive", instances);
}
void MecanumDrive::DriveCartesian(double xSpeed, double ySpeed,
double zRotation, Rotation2d gyroAngle) {
double zRotation, wpi::math::Rotation2d gyroAngle) {
if (!reported) {
HAL_ReportUsage("RobotDrive", "MecanumCartesian");
reported = true;
}
xSpeed = ApplyDeadband(xSpeed, m_deadband);
ySpeed = ApplyDeadband(ySpeed, m_deadband);
xSpeed = wpi::math::ApplyDeadband(xSpeed, m_deadband);
ySpeed = wpi::math::ApplyDeadband(ySpeed, m_deadband);
auto [frontLeft, frontRight, rearLeft, rearRight] =
DriveCartesianIK(xSpeed, ySpeed, zRotation, gyroAngle);
@@ -74,7 +74,7 @@ void MecanumDrive::DriveCartesian(double xSpeed, double ySpeed,
Feed();
}
void MecanumDrive::DrivePolar(double magnitude, Rotation2d angle,
void MecanumDrive::DrivePolar(double magnitude, wpi::math::Rotation2d angle,
double zRotation) {
if (!reported) {
HAL_ReportUsage("RobotDrive", "MecanumPolar");
@@ -102,13 +102,13 @@ void MecanumDrive::StopMotor() {
MecanumDrive::WheelSpeeds MecanumDrive::DriveCartesianIK(double xSpeed,
double ySpeed,
double zRotation,
Rotation2d gyroAngle) {
wpi::math::Rotation2d gyroAngle) {
xSpeed = std::clamp(xSpeed, -1.0, 1.0);
ySpeed = std::clamp(ySpeed, -1.0, 1.0);
// Compensate for gyro angle.
auto input =
Translation2d{units::meter_t{xSpeed}, units::meter_t{ySpeed}}.RotateBy(
wpi::math::Translation2d{wpi::units::meter_t{xSpeed}, wpi::units::meter_t{ySpeed}}.RotateBy(
-gyroAngle);
double wheelSpeeds[4];
@@ -127,7 +127,7 @@ std::string MecanumDrive::GetDescription() const {
return "MecanumDrive";
}
void MecanumDrive::InitSendable(wpi::SendableBuilder& builder) {
void MecanumDrive::InitSendable(wpi::util::SendableBuilder& builder) {
builder.SetSmartDashboardType("MecanumDrive");
builder.SetActuator(true);
builder.AddDoubleProperty(

View File

@@ -10,7 +10,7 @@
#include "wpi/hardware/motor/MotorController.hpp"
using namespace frc;
using namespace wpi;
RobotDriveBase::RobotDriveBase() {
SetSafetyEnabled(true);