Fix all the samples to build with the C++11/14 language features (constexpr)

This commit is contained in:
Brad Miller
2014-11-11 09:15:46 -05:00
parent 68ba9bfeae
commit 1d0a6b8ace
7 changed files with 13 additions and 12 deletions

View File

@@ -28,6 +28,7 @@
<option id="gnu.cpp.compiler.option.debugging.level.969129918" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.include.paths.394786621" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${WPILIB}/cpp/current/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
</option>
<option id="gnu.cpp.compiler.option.dialect.std.1060340803" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" useByScannerDiscovery="true" value="gnu.cpp.compiler.dialect.c++1y" valueType="enumerated"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1033680971" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>

View File

@@ -13,7 +13,7 @@ private:
SpeedController* motor;
Potentiometer* pot;
static const double kP_real = 4, kI_real = 0.07,
static constexpr double kP_real = 4, kI_real = 0.07,
kP_simulation = 18, kI_simulation = 0.2;
public:

View File

@@ -13,7 +13,7 @@ private:
SpeedController* motor;
Potentiometer* pot; // TODO: Make Potentiometer
static const double kP_real = 1, kP_simulation = 0.05;
static constexpr double kP_real = 1, kP_simulation = 0.05;
public:
Wrist();

View File

@@ -12,8 +12,8 @@ private:
double driveForwardSpeed;
double distance;
double error;
static const double TOLERANCE = .1;
static const double KP = -1.0 / 5.0;
static constexpr double TOLERANCE = .1;
static constexpr double KP = -1.0 / 5.0;
void init(double dist, double maxSpeed);
public:
DriveForward();

View File

@@ -13,9 +13,9 @@ class Collector: public Subsystem
{
public:
// Constants for some useful speeds
static const double FORWARD = 1;
static const double STOP = 0;
static const double REVERSE = -1;
static constexpr double FORWARD = 1;
static constexpr double STOP = 0;
static constexpr double REVERSE = -1;
private:
// Subsystem devices

View File

@@ -12,10 +12,10 @@ class Pivot: public PIDSubsystem
{
public:
// Constants for some useful angles
static const double COLLECT = 105;
static const double LOW_GOAL = 90;
static const double SHOOT = 45;
static const double SHOOT_NEAR = 30;
static constexpr double COLLECT = 105;
static constexpr double LOW_GOAL = 90;
static constexpr double SHOOT = 45;
static constexpr double SHOOT_NEAR = 30;
private:
// Subsystem devices

View File

@@ -17,7 +17,7 @@ private:
Compressor* compressor;
#endif
static const double MAX_PRESSURE = 2.55;
static constexpr double MAX_PRESSURE = 2.55;
public:
Pneumatics();