mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpilibcExamples] Add inline specifier to constexpr constants (#6049)
This commit is contained in:
@@ -13,63 +13,63 @@
|
||||
#include <units/voltage.h>
|
||||
|
||||
namespace DriveConstants {
|
||||
constexpr int kLeftMotor1Port = 0;
|
||||
constexpr int kLeftMotor2Port = 1;
|
||||
constexpr int kRightMotor1Port = 2;
|
||||
constexpr int kRightMotor2Port = 3;
|
||||
inline constexpr int kLeftMotor1Port = 0;
|
||||
inline constexpr int kLeftMotor2Port = 1;
|
||||
inline constexpr int kRightMotor1Port = 2;
|
||||
inline constexpr int kRightMotor2Port = 3;
|
||||
|
||||
constexpr int kLeftEncoderPorts[]{0, 1};
|
||||
constexpr int kRightEncoderPorts[]{2, 3};
|
||||
constexpr bool kLeftEncoderReversed = false;
|
||||
constexpr bool kRightEncoderReversed = true;
|
||||
inline constexpr int kLeftEncoderPorts[]{0, 1};
|
||||
inline constexpr int kRightEncoderPorts[]{2, 3};
|
||||
inline constexpr bool kLeftEncoderReversed = false;
|
||||
inline constexpr bool kRightEncoderReversed = true;
|
||||
|
||||
constexpr double kEncoderCPR = 1024;
|
||||
constexpr units::meter_t kWheelDiameter = 6.0_in;
|
||||
constexpr double kEncoderDistancePerPulse =
|
||||
inline constexpr double kEncoderCPR = 1024;
|
||||
inline constexpr units::meter_t kWheelDiameter = 6.0_in;
|
||||
inline constexpr double kEncoderDistancePerPulse =
|
||||
// Assumes the encoders are directly mounted on the wheel shafts
|
||||
((kWheelDiameter * std::numbers::pi) / kEncoderCPR).value();
|
||||
|
||||
} // namespace DriveConstants
|
||||
|
||||
namespace IntakeConstants {
|
||||
constexpr int kMotorPort = 6;
|
||||
constexpr int kSolenoidPorts[]{0, 1};
|
||||
inline constexpr int kMotorPort = 6;
|
||||
inline constexpr int kSolenoidPorts[]{0, 1};
|
||||
} // namespace IntakeConstants
|
||||
|
||||
namespace StorageConstants {
|
||||
constexpr int kMotorPort = 7;
|
||||
constexpr int kBallSensorPort = 6;
|
||||
inline constexpr int kMotorPort = 7;
|
||||
inline constexpr int kBallSensorPort = 6;
|
||||
} // namespace StorageConstants
|
||||
|
||||
namespace ShooterConstants {
|
||||
constexpr int kEncoderPorts[]{4, 5};
|
||||
constexpr bool kEncoderReversed = false;
|
||||
constexpr double kEncoderCPR = 1024;
|
||||
constexpr double kEncoderDistancePerPulse =
|
||||
inline constexpr int kEncoderPorts[]{4, 5};
|
||||
inline constexpr bool kEncoderReversed = false;
|
||||
inline constexpr double kEncoderCPR = 1024;
|
||||
inline constexpr double kEncoderDistancePerPulse =
|
||||
// Distance units will be rotations
|
||||
1.0 / kEncoderCPR;
|
||||
|
||||
constexpr int kShooterMotorPort = 4;
|
||||
constexpr int kFeederMotorPort = 5;
|
||||
inline constexpr int kShooterMotorPort = 4;
|
||||
inline constexpr int kFeederMotorPort = 5;
|
||||
|
||||
constexpr auto kShooterFree = 5300_tps;
|
||||
constexpr auto kShooterTarget = 4000_tps;
|
||||
constexpr auto kShooterTolerance = 50_tps;
|
||||
inline constexpr auto kShooterFree = 5300_tps;
|
||||
inline constexpr auto kShooterTarget = 4000_tps;
|
||||
inline constexpr auto kShooterTolerance = 50_tps;
|
||||
|
||||
// These are not real PID gains, and will have to be tuned for your specific
|
||||
// robot.
|
||||
constexpr double kP = 1;
|
||||
inline constexpr double kP = 1;
|
||||
|
||||
constexpr units::volt_t kS = 0.05_V;
|
||||
constexpr auto kV =
|
||||
inline constexpr units::volt_t kS = 0.05_V;
|
||||
inline constexpr auto kV =
|
||||
// Should have value 12V at free speed...
|
||||
12.0_V / kShooterFree;
|
||||
|
||||
constexpr double kFeederSpeed = 0.5;
|
||||
inline constexpr double kFeederSpeed = 0.5;
|
||||
} // namespace ShooterConstants
|
||||
|
||||
namespace OIConstants {
|
||||
constexpr int kDriverControllerPort = 0;
|
||||
inline constexpr int kDriverControllerPort = 0;
|
||||
} // namespace OIConstants
|
||||
|
||||
namespace AutoConstants {
|
||||
|
||||
Reference in New Issue
Block a user