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:
Tyler Veness
2019-11-20 21:48:16 -08:00
committed by Peter Johnson
parent 3d1ca856b2
commit ffa4b907c0
40 changed files with 82 additions and 82 deletions

View File

@@ -35,7 +35,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; }

View File

@@ -43,7 +43,7 @@ constexpr bool kEncoderReversed = false;
constexpr int kEncoderCPR = 1024;
constexpr double kEncoderDistancePerPulse =
// Distance units will be rotations
1. / static_cast<double>(kEncoderCPR);
1.0 / static_cast<double>(kEncoderCPR);
constexpr int kShooterMotorPort = 4;
constexpr int kFeederMotorPort = 5;
@@ -58,12 +58,12 @@ constexpr double kD = 0;
// On a real robot the feedforward constants should be empirically determined;
// these are reasonable guesses.
constexpr auto kS = .05_V;
constexpr auto kS = 0.05_V;
constexpr auto kV =
// Should have value 12V at free speed...
12_V / kShooterFreeRPS;
constexpr double kFeederSpeed = .5;
constexpr double kFeederSpeed = 0.5;
} // namespace ShooterConstants
namespace AutoConstants {

View File

@@ -90,7 +90,7 @@ class RobotContainer {
frc2::InstantCommand m_stopFeeder{[this] { m_shooter.StopFeeder(); },
{&m_shooter}};
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); },
{}};