mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[examples] Replace usages of SIMULATION macro with constexpr if (#6899)
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <frc/AnalogPotentiometer.h>
|
||||
#include <frc/RobotBase.h>
|
||||
#include <frc/motorcontrol/PWMSparkMax.h>
|
||||
#include <frc2/command/PIDSubsystem.h>
|
||||
|
||||
@@ -41,14 +42,12 @@ class Wrist : public frc2::PIDSubsystem {
|
||||
|
||||
private:
|
||||
frc::PWMSparkMax m_motor{6};
|
||||
|
||||
// Conversion value of potentiometer varies between the real world and
|
||||
// simulation
|
||||
#ifndef SIMULATION
|
||||
frc::AnalogPotentiometer m_pot{3, -270.0 / 5};
|
||||
#else
|
||||
frc::AnalogPotentiometer m_pot{3}; // Defaults to degrees
|
||||
#endif
|
||||
// Conversion value of potentiometer varies between the real world and
|
||||
// simulation
|
||||
frc::AnalogPotentiometer m_pot =
|
||||
frc::RobotBase::IsReal()
|
||||
? frc::AnalogPotentiometer{3, -270.0 / 5}
|
||||
: frc::AnalogPotentiometer{3}; // Defaults to degrees
|
||||
|
||||
static constexpr double kP = 1;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user