From da9a575526a7f5ee4597e818fc0d5db5bb144e74 Mon Sep 17 00:00:00 2001 From: Liam Kinne Date: Sun, 14 Oct 2018 17:10:16 +1100 Subject: [PATCH] Rename squaredInputs to squareInputs in DifferentialDrive (#1361) Fixes #1360. --- .../src/main/native/cpp/drive/DifferentialDrive.cpp | 8 ++++---- .../native/include/frc/drive/DifferentialDrive.h | 9 ++++----- .../wpi/first/wpilibj/drive/DifferentialDrive.java | 12 ++++++------ 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/wpilibc/src/main/native/cpp/drive/DifferentialDrive.cpp b/wpilibc/src/main/native/cpp/drive/DifferentialDrive.cpp index 33b75c6a5d..4789d0ffe5 100644 --- a/wpilibc/src/main/native/cpp/drive/DifferentialDrive.cpp +++ b/wpilibc/src/main/native/cpp/drive/DifferentialDrive.cpp @@ -28,7 +28,7 @@ DifferentialDrive::DifferentialDrive(SpeedController& leftMotor, } void DifferentialDrive::ArcadeDrive(double xSpeed, double zRotation, - bool squaredInputs) { + bool squareInputs) { static bool reported = false; if (!reported) { HAL_Report(HALUsageReporting::kResourceType_RobotDrive, 2, @@ -44,7 +44,7 @@ void DifferentialDrive::ArcadeDrive(double xSpeed, double zRotation, // Square the inputs (while preserving the sign) to increase fine control // while permitting full power. - if (squaredInputs) { + if (squareInputs) { xSpeed = std::copysign(xSpeed * xSpeed, xSpeed); zRotation = std::copysign(zRotation * zRotation, zRotation); } @@ -156,7 +156,7 @@ void DifferentialDrive::CurvatureDrive(double xSpeed, double zRotation, } void DifferentialDrive::TankDrive(double leftSpeed, double rightSpeed, - bool squaredInputs) { + bool squareInputs) { static bool reported = false; if (!reported) { HAL_Report(HALUsageReporting::kResourceType_RobotDrive, 2, @@ -172,7 +172,7 @@ void DifferentialDrive::TankDrive(double leftSpeed, double rightSpeed, // Square the inputs (while preserving the sign) to increase fine control // while permitting full power. - if (squaredInputs) { + if (squareInputs) { leftSpeed = std::copysign(leftSpeed * leftSpeed, leftSpeed); rightSpeed = std::copysign(rightSpeed * rightSpeed, rightSpeed); } diff --git a/wpilibc/src/main/native/include/frc/drive/DifferentialDrive.h b/wpilibc/src/main/native/include/frc/drive/DifferentialDrive.h index c73242b53c..1120659c89 100644 --- a/wpilibc/src/main/native/include/frc/drive/DifferentialDrive.h +++ b/wpilibc/src/main/native/include/frc/drive/DifferentialDrive.h @@ -124,9 +124,9 @@ class DifferentialDrive : public RobotDriveBase { * axis [-1.0..1.0]. Forward is negative. * @param zRotation The rotation rate of the robot around the Z axis * [-1.0..1.0]. Clockwise is positive. - * @param squaredInputs If set, decreases the input sensitivity at low speeds. + * @param squareInputs If set, decreases the input sensitivity at low speeds. */ - void ArcadeDrive(double xSpeed, double zRotation, bool squaredInputs = true); + void ArcadeDrive(double xSpeed, double zRotation, bool squareInputs = true); /** * Curvature drive method for differential drive platform. @@ -152,10 +152,9 @@ class DifferentialDrive : public RobotDriveBase { * [-1.0..1.0]. Forward is positive. * @param rightSpeed The robot right side's speed along the X axis * [-1.0..1.0]. Forward is positive. - * @param squaredInputs If set, decreases the input sensitivity at low speeds. + * @param squareInputs If set, decreases the input sensitivity at low speeds. */ - void TankDrive(double leftSpeed, double rightSpeed, - bool squaredInputs = true); + void TankDrive(double leftSpeed, double rightSpeed, bool squareInputs = true); /** * Sets the QuickStop speed threshold in curvature drive. diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/drive/DifferentialDrive.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/drive/DifferentialDrive.java index 102caaca1e..b8ad2ff13d 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/drive/DifferentialDrive.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/drive/DifferentialDrive.java @@ -140,10 +140,10 @@ public class DifferentialDrive extends RobotDriveBase { * @param xSpeed The robot's speed along the X axis [-1.0..1.0]. Forward is positive. * @param zRotation The robot's rotation rate around the Z axis [-1.0..1.0]. Clockwise is * positive. - * @param squaredInputs If set, decreases the input sensitivity at low speeds. + * @param squareInputs If set, decreases the input sensitivity at low speeds. */ @SuppressWarnings("ParameterName") - public void arcadeDrive(double xSpeed, double zRotation, boolean squaredInputs) { + public void arcadeDrive(double xSpeed, double zRotation, boolean squareInputs) { if (!m_reported) { HAL.report(tResourceType.kResourceType_RobotDrive, 2, tInstances.kRobotDrive2_DifferentialArcade); @@ -158,7 +158,7 @@ public class DifferentialDrive extends RobotDriveBase { // Square the inputs (while preserving the sign) to increase fine control // while permitting full power. - if (squaredInputs) { + if (squareInputs) { xSpeed = Math.copySign(xSpeed * xSpeed, xSpeed); zRotation = Math.copySign(zRotation * zRotation, zRotation); } @@ -298,9 +298,9 @@ public class DifferentialDrive extends RobotDriveBase { * positive. * @param rightSpeed The robot right side's speed along the X axis [-1.0..1.0]. Forward is * positive. - * @param squaredInputs If set, decreases the input sensitivity at low speeds. + * @param squareInputs If set, decreases the input sensitivity at low speeds. */ - public void tankDrive(double leftSpeed, double rightSpeed, boolean squaredInputs) { + public void tankDrive(double leftSpeed, double rightSpeed, boolean squareInputs) { if (!m_reported) { HAL.report(tResourceType.kResourceType_RobotDrive, 2, tInstances.kRobotDrive2_DifferentialTank); @@ -315,7 +315,7 @@ public class DifferentialDrive extends RobotDriveBase { // Square the inputs (while preserving the sign) to increase fine control // while permitting full power. - if (squaredInputs) { + if (squareInputs) { leftSpeed = Math.copySign(leftSpeed * leftSpeed, leftSpeed); rightSpeed = Math.copySign(rightSpeed * rightSpeed, rightSpeed); }