mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Fix C++ floating point literal formatting (#2114)
Found formatting errors with this regex "([^a-z0-9\.]\.[0-9]|[^a-z0-9\.][0-9]\.[^a-z0-9\.])" and ignored false positives. Fixes #2112.
This commit is contained in:
committed by
Peter Johnson
parent
3d1ca856b2
commit
ffa4b907c0
@@ -47,7 +47,7 @@ void DriveSubsystem::ResetEncoders() {
|
||||
}
|
||||
|
||||
double DriveSubsystem::GetAverageEncoderDistance() {
|
||||
return (m_leftEncoder.GetDistance() + m_rightEncoder.GetDistance()) / 2.;
|
||||
return (m_leftEncoder.GetDistance() + m_rightEncoder.GetDistance()) / 2.0;
|
||||
}
|
||||
|
||||
frc::Encoder& DriveSubsystem::GetLeftEncoder() { return m_leftEncoder; }
|
||||
@@ -59,11 +59,11 @@ void DriveSubsystem::SetMaxOutput(double maxOutput) {
|
||||
}
|
||||
|
||||
double DriveSubsystem::GetHeading() {
|
||||
return std::remainder(m_gyro.GetAngle(), 360) * (kGyroReversed ? -1. : 1.);
|
||||
return std::remainder(m_gyro.GetAngle(), 360) * (kGyroReversed ? -1.0 : 1.0);
|
||||
}
|
||||
|
||||
double DriveSubsystem::GetTurnRate() {
|
||||
return m_gyro.GetRate() * (kGyroReversed ? -1. : 1.);
|
||||
return m_gyro.GetRate() * (kGyroReversed ? -1.0 : 1.0);
|
||||
}
|
||||
|
||||
frc::Pose2d DriveSubsystem::GetPose() { return m_odometry.GetPose(); }
|
||||
|
||||
@@ -32,7 +32,7 @@ constexpr int kRightEncoderPorts[]{2, 3};
|
||||
constexpr bool kLeftEncoderReversed = false;
|
||||
constexpr bool kRightEncoderReversed = true;
|
||||
|
||||
constexpr auto kTrackwidth = .6_m;
|
||||
constexpr auto kTrackwidth = 0.6_m;
|
||||
constexpr frc::DifferentialDriveKinematics kDriveKinematics(kTrackwidth);
|
||||
|
||||
constexpr int kEncoderCPR = 1024;
|
||||
@@ -49,11 +49,11 @@ constexpr bool kGyroReversed = true;
|
||||
// Toolsuite provides a convenient tool for obtaining these values for your
|
||||
// robot.
|
||||
constexpr auto ks = 1_V;
|
||||
constexpr auto kv = .8 * 1_V * 1_s / 1_m;
|
||||
constexpr auto ka = .15 * 1_V * 1_s * 1_s / 1_m;
|
||||
constexpr auto kv = 0.8 * 1_V * 1_s / 1_m;
|
||||
constexpr auto ka = 0.15 * 1_V * 1_s * 1_s / 1_m;
|
||||
|
||||
// Example value only - as above, this must be tuned for your drive!
|
||||
constexpr double kPDriveVel = .5;
|
||||
constexpr double kPDriveVel = 0.5;
|
||||
} // namespace DriveConstants
|
||||
|
||||
namespace AutoConstants {
|
||||
@@ -63,7 +63,7 @@ constexpr auto kMaxAcceleration = 3_mps_sq;
|
||||
// Reasonable baseline values for a RAMSETE follower in units of meters and
|
||||
// seconds
|
||||
constexpr double kRamseteB = 2;
|
||||
constexpr double kRamseteZeta = .7;
|
||||
constexpr double kRamseteZeta = 0.7;
|
||||
} // namespace AutoConstants
|
||||
|
||||
namespace OIConstants {
|
||||
|
||||
@@ -41,7 +41,7 @@ class RobotContainer {
|
||||
// The robot's subsystems
|
||||
DriveSubsystem m_drive;
|
||||
|
||||
frc2::InstantCommand m_driveHalfSpeed{[this] { m_drive.SetMaxOutput(.5); },
|
||||
frc2::InstantCommand m_driveHalfSpeed{[this] { m_drive.SetMaxOutput(0.5); },
|
||||
{}};
|
||||
frc2::InstantCommand m_driveFullSpeed{[this] { m_drive.SetMaxOutput(1); },
|
||||
{}};
|
||||
|
||||
Reference in New Issue
Block a user