View
@@ -12,6 +12,8 @@
#include "Counter.h"
+namespace frc {
+
/**
* Alias for counter class.
* Implement the gear tooth sensor supplied by FIRST. Currently there is no
@@ -31,3 +33,5 @@ class GearTooth : public Counter {
std::string GetSmartDashboardType() const override;
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "SensorBase.h"
+namespace frc {
+
/**
* I2C bus interface class.
*
@@ -40,3 +42,5 @@ class I2C : SensorBase {
Port m_port;
int m_deviceAddress;
};
+
+} // namespace frc
View
@@ -9,8 +9,12 @@
#include "HLUsageReporting.h"
+namespace frc {
+
class HardwareHLReporting : public HLUsageReportingInterface {
public:
virtual void ReportScheduler();
virtual void ReportSmartDashboard();
};
+
+} // namespace frc
View
@@ -13,6 +13,8 @@
#include "HAL/Interrupts.h"
#include "SensorBase.h"
+namespace frc {
+
class InterruptableSensorBase : public SensorBase {
public:
enum WaitResult {
@@ -48,3 +50,5 @@ class InterruptableSensorBase : public SensorBase {
HAL_InterruptHandle m_interrupt = HAL_kInvalidHandle;
void AllocateInterrupts(bool watcher);
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "RobotBase.h"
+namespace frc {
+
/**
* IterativeRobot implements a specific type of Robot Program framework,
* extending the RobotBase class.
@@ -68,3 +70,5 @@ class IterativeRobot : public RobotBase {
bool m_teleopInitialized = false;
bool m_testInitialized = false;
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "PWMSpeedController.h"
+namespace frc {
+
/**
* Luminary Micro / Vex Robotics Jaguar Speed Controller with PWM control
*/
@@ -17,3 +19,5 @@ class Jaguar : public PWMSpeedController {
explicit Jaguar(int channel);
virtual ~Jaguar() = default;
};
+
+} // namespace frc
View
@@ -16,6 +16,8 @@
#include "ErrorBase.h"
#include "GenericHID.h"
+namespace frc {
+
class DriverStation;
/**
@@ -116,3 +118,5 @@ class Joystick : public GenericHID, public ErrorBase {
uint16_t m_leftRumble = 0;
uint16_t m_rightRumble = 0;
};
+
+} // namespace frc
View
@@ -11,6 +11,8 @@
#include <sstream>
+namespace frc {
+
class MotorSafety {
public:
virtual void SetExpiration(float timeout) = 0;
@@ -21,3 +23,5 @@ class MotorSafety {
virtual bool IsSafetyEnabled() const = 0;
virtual void GetDescription(std::ostringstream& desc) const = 0;
};
+
+} // namespace frc
View
@@ -12,6 +12,8 @@
#include "ErrorBase.h"
#include "HAL/cpp/priority_mutex.h"
+namespace frc {
+
class MotorSafety;
class MotorSafetyHelper : public ErrorBase {
@@ -43,3 +45,5 @@ class MotorSafetyHelper : public ErrorBase {
// protect accesses to the list of helpers
static priority_recursive_mutex m_listMutex;
};
+
+} // namespace frc
View
@@ -15,6 +15,8 @@
#include "HAL/Notifier.h"
#include "HAL/cpp/priority_mutex.h"
+namespace frc {
+
typedef std::function<void()> TimerEventHandler;
class Notifier : public ErrorBase {
@@ -56,3 +58,5 @@ class Notifier : public ErrorBase {
// true if this is a periodic event
bool m_periodic = false;
};
+
+} // namespace frc
View
@@ -15,6 +15,8 @@
#include "SensorBase.h"
#include "tables/ITableListener.h"
+namespace frc {
+
/**
* Class implements the PWM generation in the FPGA.
*
@@ -78,3 +80,5 @@ class PWM : public SensorBase,
int m_channel;
HAL_DigitalHandle m_handle;
};
+
+} // namespace frc
View
@@ -10,6 +10,8 @@
#include "SafePWM.h"
#include "SpeedController.h"
+namespace frc {
+
/**
* Common base class for all PWM Speed Controllers
*/
@@ -32,3 +34,5 @@ class PWMSpeedController : public SafePWM, public SpeedController {
private:
bool m_isInverted = false;
};
+
+} // namespace frc
View
@@ -13,6 +13,8 @@
#include "LiveWindow/LiveWindowSendable.h"
#include "SensorBase.h"
+namespace frc {
+
/**
* Class for getting voltage, current, temperature, power and energy from the
* CAN PDP.
@@ -42,3 +44,5 @@ class PowerDistributionPanel : public SensorBase, public LiveWindowSendable {
std::shared_ptr<ITable> m_table;
int m_module;
};
+
+} // namespace frc
View
@@ -16,6 +16,8 @@
#include "networktables/NetworkTable.h"
#include "tables/ITableListener.h"
+namespace frc {
+
/**
* The preferences class provides a relatively simple way to save important
* values to the roboRIO to access the next time the roboRIO is booted.
@@ -69,3 +71,5 @@ class Preferences : public ErrorBase {
};
Listener m_listener;
};
+
+} // namespace frc
View
@@ -17,6 +17,8 @@
#include "tables/ITable.h"
#include "tables/ITableListener.h"
+namespace frc {
+
class MotorSafetyHelper;
/**
@@ -73,3 +75,5 @@ class Relay : public MotorSafety,
std::unique_ptr<MotorSafetyHelper> m_safetyHelper;
};
+
+} // namespace frc
View
@@ -13,6 +13,8 @@
#include "Base.h"
#include "HAL/HAL.h"
+namespace frc {
+
class DriverStation;
#define START_ROBOT_CLASS(_ClassName_) \
@@ -56,3 +58,5 @@ class RobotBase {
DriverStation& m_ds;
};
+
+} // namespace frc
View
@@ -14,6 +14,8 @@
#include "MotorSafety.h"
#include "MotorSafetyHelper.h"
+namespace frc {
+
class SpeedController;
class GenericHID;
@@ -118,3 +120,5 @@ class RobotDrive : public MotorSafety, public ErrorBase {
return motors;
}
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "PWMSpeedController.h"
+namespace frc {
+
/**
* Mindsensors SD540 Speed Controller
*/
@@ -17,3 +19,5 @@ class SD540 : public PWMSpeedController {
explicit SD540(int channel);
virtual ~SD540() = default;
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "SensorBase.h"
+namespace frc {
+
class DigitalOutput;
class DigitalInput;
@@ -68,3 +70,5 @@ class SPI : public SensorBase {
private:
void Init();
};
+
+} // namespace frc
View
@@ -14,6 +14,8 @@
#include "MotorSafetyHelper.h"
#include "PWM.h"
+namespace frc {
+
/**
* A safe version of the PWM class.
* It is safe because it implements the MotorSafety interface that provides
@@ -39,3 +41,5 @@ class SafePWM : public PWM, public MotorSafety {
private:
std::unique_ptr<MotorSafetyHelper> m_safetyHelper;
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "RobotBase.h"
+namespace frc {
+
class SampleRobot : public RobotBase {
public:
SampleRobot();
@@ -24,3 +26,5 @@ class SampleRobot : public RobotBase {
private:
bool m_robotMainOverridden;
};
+
+} // namespace frc
View
@@ -12,6 +12,8 @@
#include "Base.h"
#include "ErrorBase.h"
+namespace frc {
+
/**
* Base class for all sensors.
* Stores most recent status information as well as containing utility functions
@@ -45,3 +47,5 @@ class SensorBase : public ErrorBase {
static const int kRelayChannels;
static const int kPDPChannels;
};
+
+} // namespace frc
View
@@ -11,6 +11,8 @@
#include "ErrorBase.h"
+namespace frc {
+
/**
* Driver for the RS-232 serial port on the roboRIO.
*
@@ -72,3 +74,5 @@ class SerialPort : public ErrorBase {
bool m_consoleModeEnabled = false;
int m_port;
};
+
+} // namespace frc
View
@@ -13,6 +13,8 @@
#include "SafePWM.h"
#include "SpeedController.h"
+namespace frc {
+
/**
* Standard hobby style servo.
*
@@ -52,3 +54,5 @@ class Servo : public SafePWM {
static constexpr float kDefaultMaxServoPWM = 2.4;
static constexpr float kDefaultMinServoPWM = .6;
};
+
+} // namespace frc
View
@@ -15,6 +15,8 @@
#include "SolenoidBase.h"
#include "tables/ITableListener.h"
+namespace frc {
+
/**
* Solenoid class for running high voltage Digital Output (PCM).
*
@@ -46,3 +48,5 @@ class Solenoid : public SolenoidBase,
int m_channel; ///< The channel on the module to control.
std::shared_ptr<ITable> m_table;
};
+
+} // namespace frc
View
@@ -11,6 +11,8 @@
#include "SensorBase.h"
+namespace frc {
+
/**
* SolenoidBase class is the common base class for the Solenoid and
* DoubleSolenoid classes.
@@ -33,3 +35,5 @@ class SolenoidBase : public SensorBase {
int m_moduleNumber; ///< Slot number where the module is plugged into
/// the chassis.
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "PWMSpeedController.h"
+namespace frc {
+
/**
* REV Robotics Speed Controller
*/
@@ -17,3 +19,5 @@ class Spark : public PWMSpeedController {
explicit Spark(int channel);
virtual ~Spark() = default;
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "PIDOutput.h"
+namespace frc {
+
/**
* Interface for speed controlling devices.
*/
@@ -51,3 +53,5 @@ class SpeedController : public PIDOutput {
*/
virtual void StopMotor() = 0;
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "PWMSpeedController.h"
+namespace frc {
+
/**
* Cross the Road Electronics (CTRE) Talon and Talon SR Speed Controller
*/
@@ -17,3 +19,5 @@ class Talon : public PWMSpeedController {
explicit Talon(int channel);
virtual ~Talon() = default;
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "PWMSpeedController.h"
+namespace frc {
+
/**
* Cross the Road Electronics (CTRE) Talon SRX Speed Controller with PWM control
*/
@@ -17,3 +19,5 @@ class TalonSRX : public PWMSpeedController {
explicit TalonSRX(int channel);
virtual ~TalonSRX() = default;
};
+
+} // namespace frc
View
@@ -14,6 +14,8 @@
#include "NIIMAQdx.h"
#include "nivision.h"
+namespace frc {
+
typedef enum whiteBalance_enum {
kFixedIndoor = 3000,
kFixedOutdoor1 = 4000,
@@ -120,3 +122,5 @@ class USBCamera : public ErrorBase {
void GetImage(Image* image);
int GetImageData(void* buffer, int bufferSize);
};
+
+} // namespace frc
View
@@ -18,6 +18,8 @@
#include "PIDSource.h"
#include "SensorBase.h"
+namespace frc {
+
class DigitalInput;
class DigitalOutput;
@@ -96,3 +98,5 @@ class Ultrasonic : public SensorBase,
std::shared_ptr<ITable> m_table;
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "PWMSpeedController.h"
+namespace frc {
+
/**
* Vex Robotics Victor 888 Speed Controller
*
@@ -20,3 +22,5 @@ class Victor : public PWMSpeedController {
explicit Victor(int channel);
virtual ~Victor() = default;
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "PWMSpeedController.h"
+namespace frc {
+
/**
* Vex Robotics Victor SP Speed Controller
*/
@@ -17,3 +19,5 @@ class VictorSP : public PWMSpeedController {
explicit VictorSP(int channel);
virtual ~VictorSP() = default;
};
+
+} // namespace frc
View
@@ -17,6 +17,8 @@
#include "Vision/HSLImage.h"
#include "nivision.h"
+namespace frc {
+
/**
* Axis M1011 network camera
*/
@@ -121,3 +123,5 @@ class AxisCamera : public ErrorBase {
int CreateCameraSocket(std::string const& requestString, bool setError);
};
+
+} // namespace frc
View
@@ -19,6 +19,8 @@
#define LOG_FATAL __FILE__, __FUNCTION__, __LINE__, FATAL_TYPE
#define LOG_DEBUG __FILE__, __FUNCTION__, __LINE__, DEBUG_TYPE
+namespace frc {
+
/* Enumerated Types */
/** debug levels */
@@ -69,3 +71,5 @@ void panForTarget(Servo* panServo, double sinStart);
int processFile(char* inputFile, char* outputString, int lineNumber);
int emptyString(char* string);
void stripString(char* string);
+
+} // namespace frc
View
@@ -18,6 +18,8 @@
*/
#include "Vision/VisionAPI.h"
+namespace frc {
+
class BinaryImage : public MonoImage {
public:
virtual ~BinaryImage() = default;
@@ -42,3 +44,5 @@ class BinaryImage : public MonoImage {
static bool CompareParticleSizes(ParticleAnalysisReport particle1,
ParticleAnalysisReport particle2);
};
+
+} // namespace frc
View
@@ -11,6 +11,8 @@
#include "ImageBase.h"
#include "Threshold.h"
+namespace frc {
+
class ColorImage : public ImageBase {
public:
explicit ColorImage(ImageType type);
@@ -69,3 +71,5 @@ class ColorImage : public ImageBase {
void ReplaceSecondColorPlane(ColorMode mode, MonoImage* plane);
void ReplaceThirdColorPlane(ColorMode mode, MonoImage* plane);
};
+
+} // namespace frc
View
@@ -27,6 +27,10 @@
#define ERR_CAMERA_TASK_INPUT_OUT_OF_RANGE 166210 // AxisCamera.cpp
#define ERR_CAMERA_COMMAND_FAILURE 166211 // AxisCamera.cpp
+namespace frc {
+
/* error handling functions */
int GetLastVisionError();
const char* GetVisionErrorText(int errorCode);
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "ColorImage.h"
+namespace frc {
+
/**
* A color image represented in HSL color space at 3 bytes per pixel.
*/
@@ -18,3 +20,5 @@ class HSLImage : public ColorImage {
explicit HSLImage(const char* fileName);
virtual ~HSLImage() = default;
};
+
+} // namespace frc
View
@@ -12,6 +12,8 @@
#define DEFAULT_BORDER_SIZE 3
+namespace frc {
+
class ImageBase : public ErrorBase {
public:
explicit ImageBase(ImageType type);
@@ -24,3 +26,5 @@ class ImageBase : public ErrorBase {
protected:
Image* m_imaqImage;
};
+
+} // namespace frc
View
@@ -11,6 +11,8 @@
#include "ImageBase.h"
+namespace frc {
+
class MonoImage : public ImageBase {
public:
MonoImage();
@@ -22,3 +24,5 @@ class MonoImage : public ImageBase {
std::vector<EllipseMatch>* DetectEllipses(
EllipseDescriptor* ellipseDescriptor);
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "ColorImage.h"
+namespace frc {
+
/**
* A color image represented in RGB color space at 3 bytes per pixel.
*/
@@ -18,3 +20,5 @@ class RGBImage : public ColorImage {
explicit RGBImage(const char* fileName);
virtual ~RGBImage() = default;
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include <stdint.h>
+namespace frc {
+
/**
* Color threshold values.
* This object represnts the threshold values for any type of color object
@@ -26,3 +28,5 @@ class Threshold {
Threshold(int plane1Low, int plane1High, int plane2Low, int plane2High,
int plane3Low, int plane3High);
};
+
+} // namespace frc
View
@@ -16,6 +16,8 @@
#define DEFAULT_BORDER_SIZE 3 // VisionAPI.frcCreateImage
#define DEFAULT_SATURATION_THRESHOLD 40 // TrackAPI.FindColor
+namespace frc {
+
/* Forward Declare Data Structures */
typedef struct FindEdgeOptions_struct FindEdgeOptions;
typedef struct CircularEdgeReport_struct CircularEdgeReport;
@@ -174,3 +176,5 @@ int frcExtractColorPlanes(const Image* image, ColorMode mode, Image* plane1,
Image* plane2, Image* plane3);
int frcExtractHuePlane(const Image* image, Image* huePlane);
int frcExtractHuePlane(const Image* image, Image* huePlane, int minSaturation);
+
+} // namespace frc
View
@@ -11,6 +11,8 @@
#include "I2C.h"
#include "LiveWindow/LiveWindow.h"
+using namespace frc;
+
const int ADXL345_I2C::kAddress;
const int ADXL345_I2C::kPowerCtlRegister;
const int ADXL345_I2C::kDataFormatRegister;
View
@@ -12,6 +12,8 @@
#include "HAL/HAL.h"
#include "LiveWindow/LiveWindow.h"
+using namespace frc;
+
const int ADXL345_SPI::kPowerCtlRegister;
const int ADXL345_SPI::kDataFormatRegister;
const int ADXL345_SPI::kDataRegister;
View
@@ -13,6 +13,8 @@
#include "HAL/HAL.h"
#include "LiveWindow/LiveWindow.h"
+using namespace frc;
+
static int kRegWrite = 0x0A;
static int kRegRead = 0x0B;
View
@@ -12,6 +12,8 @@
#include "LiveWindow/LiveWindow.h"
#include "Timer.h"
+using namespace frc;
+
static constexpr double kSamplePeriod = 0.001;
static constexpr double kCalibrationSampleTime = 5.0;
static constexpr double kDegreePerSecondPerLSB = 0.0125;
View
@@ -11,6 +11,8 @@
#include "LiveWindow/LiveWindow.h"
#include "WPIErrors.h"
+using namespace frc;
+
/**
* Common function for initializing the accelerometer.
*/
View
@@ -15,6 +15,8 @@
#include "Timer.h"
#include "WPIErrors.h"
+using namespace frc;
+
const int AnalogGyro::kOversampleBits;
const int AnalogGyro::kAverageBits;
constexpr float AnalogGyro::kSamplesPerSecond;
View
@@ -14,6 +14,8 @@
#include "Timer.h"
#include "WPIErrors.h"
+using namespace frc;
+
const int AnalogInput::kAccumulatorModuleNumber;
const int AnalogInput::kAccumulatorNumChannels;
const int AnalogInput::kAccumulatorChannels[] = {0, 1};
View
@@ -14,6 +14,8 @@
#include "LiveWindow/LiveWindow.h"
#include "WPIErrors.h"
+using namespace frc;
+
/**
* Construct an analog output on the given channel.
*
View
@@ -9,6 +9,8 @@
#include "ControllerPower.h"
+using namespace frc;
+
/**
* Construct an Analog Potentiometer object from a channel number.
*
View
@@ -13,6 +13,8 @@
#include "HAL/HAL.h"
#include "WPIErrors.h"
+using namespace frc;
+
/**
* Constructor for an analog trigger given a channel number.
*
View
@@ -11,6 +11,8 @@
#include "HAL/HAL.h"
#include "WPIErrors.h"
+using namespace frc;
+
/**
* Create an object that represents one of the four outputs from an analog
* trigger.
View
@@ -11,6 +11,8 @@
#include "LiveWindow/LiveWindow.h"
#include "WPIErrors.h"
+using namespace frc;
+
/**
* Constructor.
*
View
@@ -18,6 +18,8 @@
#include "Utility.h"
#include "WPIErrors.h"
+using namespace frc;
+
constexpr uint8_t CameraServer::kMagicNumber[];
CameraServer* CameraServer::GetInstance() {
View
@@ -10,6 +10,8 @@
#include "HAL/HAL.h"
#include "WPIErrors.h"
+using namespace frc;
+
/**
* Constructor.
*
View
@@ -13,6 +13,8 @@
#include "HAL/HAL.h"
#include "HAL/Power.h"
+using namespace frc;
+
/**
* Get the input voltage to the robot controller.
*
View
@@ -12,6 +12,8 @@
#include "HAL/HAL.h"
#include "WPIErrors.h"
+using namespace frc;
+
/**
* Create an instance of a counter where no sources are selected.
*
View
@@ -16,6 +16,8 @@
#include "Utility.h"
#include "WPIErrors.h"
+using namespace frc;
+
std::array<bool, 3> DigitalGlitchFilter::m_filterAllocated = {
{false, false, false}};
priority_mutex DigitalGlitchFilter::m_mutex;
View
@@ -14,6 +14,8 @@
#include "LiveWindow/LiveWindow.h"
#include "WPIErrors.h"
+using namespace frc;
+
/**
* Create an instance of a Digital Input class.
*
View
@@ -13,6 +13,8 @@
#include "HAL/HAL.h"
#include "WPIErrors.h"
+using namespace frc;
+
/**
* Create an instance of a digital output.
*
View
@@ -13,6 +13,8 @@
#include "LiveWindow/LiveWindow.h"
#include "WPIErrors.h"
+using namespace frc;
+
/**
* Constructor.
*
View
@@ -18,6 +18,8 @@
#include "Utility.h"
#include "WPIErrors.h"
+using namespace frc;
+
const double JOYSTICK_UNPLUGGED_MESSAGE_INTERVAL = 1.0;
const int DriverStation::kJoystickPorts;
View
@@ -12,6 +12,8 @@
#include "LiveWindow/LiveWindow.h"
#include "WPIErrors.h"
+using namespace frc;
+
/**
* Common initialization code for Encoders.
*
View
@@ -9,6 +9,8 @@
#include "LiveWindow/LiveWindow.h"
+using namespace frc;
+
constexpr double GearTooth::kGearToothThreshold;
/**
View
@@ -10,6 +10,8 @@
#include "HAL/HAL.h"
#include "WPIErrors.h"
+using namespace frc;
+
/**
* Constructor.
*
View
@@ -9,6 +9,8 @@
#include "HAL/HAL.h"
+using namespace frc;
+
void HardwareHLReporting::ReportScheduler() {
HAL_Report(HALUsageReporting::kResourceType_Command,
HALUsageReporting::kCommand_Scheduler);
View
@@ -11,6 +11,8 @@
#include "Utility.h"
#include "WPIErrors.h"
+using namespace frc;
+
InterruptableSensorBase::InterruptableSensorBase() {}
/**
View
@@ -13,6 +13,8 @@
#include "SmartDashboard/SmartDashboard.h"
#include "networktables/NetworkTable.h"
+using namespace frc;
+
/**
* Provide an alternate "main loop" via StartCompetition().
*
View
@@ -10,6 +10,8 @@
#include "HAL/HAL.h"
#include "LiveWindow/LiveWindow.h"
+using namespace frc;
+
/**
* Constructor for a Jaguar connected via PWM.
*
View
@@ -13,6 +13,8 @@
#include "HAL/HAL.h"
#include "WPIErrors.h"
+using namespace frc;
+
const int Joystick::kDefaultXAxis;
const int Joystick::kDefaultYAxis;
const int Joystick::kDefaultZAxis;
View
@@ -14,6 +14,8 @@
#include "Timer.h"
#include "WPIErrors.h"
+using namespace frc;
+
std::set<MotorSafetyHelper*> MotorSafetyHelper::m_helperList;
priority_recursive_mutex MotorSafetyHelper::m_listMutex;
View
@@ -12,6 +12,8 @@
#include "Utility.h"
#include "WPIErrors.h"
+using namespace frc;
+
priority_mutex Notifier::m_destructorMutex;
/**
View
@@ -15,6 +15,8 @@
#include "PIDOutput.h"
#include "PIDSource.h"
+using namespace frc;
+
static const std::string kP = "p";
static const std::string kI = "i";
static const std::string kD = "d";
View
@@ -13,6 +13,8 @@
#include "Utility.h"
#include "WPIErrors.h"
+using namespace frc;
+
/**
* Allocate a PWM given a channel number.
*
View
@@ -7,6 +7,8 @@
#include "PWMSpeedController.h"
+using namespace frc;
+
/**
* Constructor for a PWM Speed Controller connected via PWM.
*
View
@@ -13,6 +13,8 @@
#include "LiveWindow/LiveWindow.h"
#include "WPIErrors.h"
+using namespace frc;
+
PowerDistributionPanel::PowerDistributionPanel() : PowerDistributionPanel(0) {}
/**
View
@@ -12,6 +12,8 @@
#include "HAL/HAL.h"
#include "WPIErrors.h"
+using namespace frc;
+
/** The Preferences table name */
static const char* kTableName = "Preferences";
View
@@ -14,6 +14,8 @@
#include "MotorSafetyHelper.h"
#include "WPIErrors.h"
+using namespace frc;
+
/**
* Relay constructor given a channel.
*
View
@@ -18,6 +18,8 @@
#include "WPILibVersion.h"
#include "networktables/NetworkTable.h"
+using namespace frc;
+
/**
* Constructor for a generic robot program.
*
View
@@ -17,6 +17,8 @@
#include "Utility.h"
#include "WPIErrors.h"
+using namespace frc;
+
const int RobotDrive::kMaxNumberOfMotors;
static auto make_shared_nodelete(SpeedController* ptr) {
View
@@ -10,6 +10,8 @@
#include "HAL/HAL.h"
#include "LiveWindow/LiveWindow.h"
+using namespace frc;
+
/**
* Note that the SD540 uses the following bounds for PWM values. These values
* should work reasonably well for most controllers, but if users experience
View
@@ -12,6 +12,8 @@
#include "HAL/HAL.h"
#include "WPIErrors.h"
+using namespace frc;
+
/**
* Constructor
*
View
@@ -7,6 +7,8 @@
#include "SafePWM.h"
+using namespace frc;
+
/**
* Constructor for a SafePWM object taking a channel number.
*
View
@@ -13,6 +13,8 @@
#include "Timer.h"
#include "networktables/NetworkTable.h"
+using namespace frc;
+
SampleRobot::SampleRobot() : m_robotMainOverridden(true) {}
/**
View
@@ -11,6 +11,8 @@
#include "HAL/HAL.h"
#include "WPIErrors.h"
+using namespace frc;
+
const int SensorBase::kDigitalChannels = HAL_GetNumDigitalChannels();
const int SensorBase::kAnalogInputs = HAL_GetNumAnalogInputs();
const int SensorBase::kSolenoidChannels = HAL_GetNumSolenoidChannels();
View
@@ -12,6 +12,8 @@
// static ViStatus _VI_FUNCH ioCompleteHandler (ViSession vi, ViEventType
// eventType, ViEvent event, ViAddr userHandle);
+using namespace frc;
+
/**
* Create an instance of a Serial Port class.
*
View
@@ -9,6 +9,8 @@
#include "LiveWindow/LiveWindow.h"
+using namespace frc;
+
constexpr float Servo::kMaxServoAngle;
constexpr float Servo::kMinServoAngle;
View
@@ -13,6 +13,8 @@
#include "LiveWindow/LiveWindow.h"
#include "WPIErrors.h"
+using namespace frc;
+
/**
* Constructor using the default PCM ID (0).
*
View
@@ -9,6 +9,8 @@
#include "HAL/HAL.h"
+using namespace frc;
+
/**
* Constructor
*
View
@@ -10,6 +10,8 @@
#include "HAL/HAL.h"
#include "LiveWindow/LiveWindow.h"
+using namespace frc;
+
/**
* Note that the Spark uses the following bounds for PWM values. These values
* should work reasonably well for most controllers, but if users experience
View
@@ -10,6 +10,8 @@
#include "HAL/HAL.h"
#include "LiveWindow/LiveWindow.h"
+using namespace frc;
+
/**
* Constructor for a Talon (original or Talon SR).
*
View
@@ -10,6 +10,8 @@
#include "HAL/HAL.h"
#include "LiveWindow/LiveWindow.h"
+using namespace frc;
+
/**
* Construct a TalonSRX connected via PWM.
*
View
@@ -15,6 +15,8 @@
#include "HAL/HAL.h"
#include "Utility.h"
+namespace frc {
+
/**
* Pause the task for a specified time.
*
@@ -48,6 +50,10 @@ double GetTime() {
.count();
}
+} // namespace frc
+
+using namespace frc;
+
// for compatibility with msvc12--see C2864
const double Timer::kRolloverTime = (1ll << 32) / 1e6;
/**
View
@@ -17,6 +17,8 @@
#include "Utility.h"
+using namespace frc;
+
// This macro expands the given imaq function to ensure that it is called and
// properly checked for an error, calling the wpi_setImaqErrorWithContext
// macro
View
@@ -16,6 +16,8 @@
#include "Utility.h"
#include "WPIErrors.h"
+using namespace frc;
+
// Time (sec) for the ping trigger pulse.
constexpr double Ultrasonic::kPingTime;
// Priority that the ultrasonic round robin task runs.
View
@@ -19,6 +19,8 @@
#include "HAL/HAL.h"
#include "nivision.h"
+using namespace frc;
+
/**
* Assert implementation.
* This allows breakpoints to be set on an assert.
@@ -122,6 +124,8 @@ bool wpi_assertNotEqual_impl(int valueA, int valueB, const char* valueAString,
return valueA != valueB;
}
+namespace frc {
+
/**
* Return the FPGA Version number.
*
@@ -221,3 +225,5 @@ std::string GetStackTrace(int offset) {
return trace.str();
}
+
+} // namespace frc
View
@@ -10,6 +10,8 @@
#include "HAL/HAL.h"
#include "LiveWindow/LiveWindow.h"
+using namespace frc;
+
/**
* Constructor for a Victor.
*
View
@@ -10,6 +10,8 @@
#include "HAL/HAL.h"
#include "LiveWindow/LiveWindow.h"
+using namespace frc;
+
/**
* Constructor for a VictorSP.
*
View
@@ -21,6 +21,8 @@
#include "Timer.h"
#include "WPIErrors.h"
+using namespace frc;
+
static const int kMaxPacketSize = 1536;
static const int kImageBufferAllocationIncrement = 1000;
View
@@ -21,6 +21,8 @@
#include "Servo.h"
#include "Timer.h"
+namespace frc {
+
/** @file
* Utility functions
*/
@@ -378,3 +380,5 @@ void stripString(char* string) {
}
string[j] = '\0';
}
+
+} // namespace frc
View
@@ -11,6 +11,8 @@
#include "WPIErrors.h"
+using namespace frc;
+
/**
* Get then number of particles for the image.
*
View
@@ -9,6 +9,8 @@
#include "WPIErrors.h"
+using namespace frc;
+
ColorImage::ColorImage(ImageType type) : ImageBase(type) {}
/**
View
@@ -9,6 +9,8 @@
#include "nivision.h"
+namespace frc {
+
/**
* Get the error code returned from the NI Vision library
* @return The last error code.
@@ -2400,3 +2402,5 @@ const char* GetVisionErrorText(int errorCode) {
return errorText;
} // NOLINT
+
+} // namespace frc
View
@@ -7,6 +7,8 @@
#include "Vision/HSLImage.h"
+using namespace frc;
+
/**
* Create a new image that uses the Hue, Saturation, and Luminance planes.
*/
View
@@ -9,6 +9,8 @@
#include "nivision.h"
+using namespace frc;
+
/**
* Create a new instance of an ImageBase.
*
View
@@ -9,6 +9,8 @@
#include "nivision.h"
+using namespace frc;
+
MonoImage::MonoImage() : ImageBase(IMAQ_IMAGE_U8) {}
/**
View
@@ -7,6 +7,8 @@
#include "Vision/RGBImage.h"
+using namespace frc;
+
/**
* Create a new image that uses Red, Green, and Blue planes.
*/
View
@@ -7,6 +7,8 @@
#include "Vision/Threshold.h"
+using namespace frc;
+
Threshold::Threshold(int new_plane1Low, int new_plane1High, int new_plane2Low,
int new_plane2High, int new_plane3Low,
int new_plane3High) {
View
@@ -12,6 +12,8 @@
#include "Vision/BaeUtilities.h"
#include "Vision/FrcError.h"
+namespace frc {
+
int VisionAPI_debugFlag = 1;
#define DPRINTF \
if (VisionAPI_debugFlag) dprintf
@@ -827,3 +829,5 @@ int frcExtractHuePlane(const Image* image, Image* huePlane) {
int frcExtractHuePlane(const Image* image, Image* huePlane, int minSaturation) {
return frcExtractColorPlanes(image, IMAQ_HSL, huePlane, nullptr, nullptr);
}
+
+} // namespace frc
View
@@ -56,14 +56,21 @@ using decay_t = typename decay<T>::type;
#endif
#endif
+namespace frc {
+
// A struct to use as a deleter when a std::shared_ptr must wrap a raw pointer
// that is being deleted by someone else.
template <class T>
struct NullDeleter {
void operator()(T*) const noexcept {};
};
+} // namespace frc
+
#include <atomic>
+
+namespace frc {
+
// Use this for determining whether the default move constructor has been
// called on a containing object. This serves the purpose of allowing us to
// use the default move constructor of an object for moving all the data around
@@ -78,3 +85,10 @@ struct HasBeenMoved {
std::atomic<bool> moved{false};
operator bool() const { return moved; }
};
+
+} // namespace frc
+
+// For backwards compatibility
+#ifndef NAMESPACED_WPILIB
+using namespace frc; // NOLINT
+#endif
View
@@ -10,6 +10,8 @@
#include "Buttons/Trigger.h"
#include "Commands/Command.h"
+namespace frc {
+
/**
* This class provides an easy way to link commands to OI inputs.
*
@@ -30,3 +32,5 @@ class Button : public Trigger {
virtual void CancelWhenPressed(Command* command);
virtual void ToggleWhenPressed(Command* command);
};
+
+} // namespace frc
View
@@ -7,6 +7,8 @@
#pragma once
+namespace frc {
+
class Trigger;
class Command;
@@ -22,3 +24,5 @@ class ButtonScheduler {
Trigger* m_button;
Command* m_command;
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "Buttons/ButtonScheduler.h"
+namespace frc {
+
class Trigger;
class Command;
@@ -21,3 +23,5 @@ class CancelButtonScheduler : public ButtonScheduler {
private:
bool pressedLast;
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "Buttons/ButtonScheduler.h"
+namespace frc {
+
class Trigger;
class Command;
@@ -18,3 +20,5 @@ class HeldButtonScheduler : public ButtonScheduler {
virtual ~HeldButtonScheduler() = default;
virtual void Execute();
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "Buttons/Button.h"
+namespace frc {
+
class InternalButton : public Button {
public:
InternalButton() = default;
@@ -24,3 +26,5 @@ class InternalButton : public Button {
bool m_pressed = false;
bool m_inverted = false;
};
+
+} // namespace frc
View
@@ -10,6 +10,8 @@
#include "Buttons/Button.h"
#include "GenericHID.h"
+namespace frc {
+
class JoystickButton : public Button {
public:
JoystickButton(GenericHID* joystick, int buttonNumber);
@@ -21,3 +23,5 @@ class JoystickButton : public Button {
GenericHID* m_joystick;
int m_buttonNumber;
};
+
+} // namespace frc
View
@@ -12,6 +12,8 @@
#include "Buttons/Button.h"
+namespace frc {
+
class NetworkButton : public Button {
public:
NetworkButton(const std::string& tableName, const std::string& field);
@@ -24,3 +26,5 @@ class NetworkButton : public Button {
std::shared_ptr<ITable> m_netTable;
std::string m_field;
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "Buttons/ButtonScheduler.h"
+namespace frc {
+
class Trigger;
class Command;
@@ -18,3 +20,5 @@ class PressedButtonScheduler : public ButtonScheduler {
virtual ~PressedButtonScheduler() = default;
virtual void Execute();
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "Buttons/ButtonScheduler.h"
+namespace frc {
+
class Trigger;
class Command;
@@ -18,3 +20,5 @@ class ReleasedButtonScheduler : public ButtonScheduler {
virtual ~ReleasedButtonScheduler() = default;
virtual void Execute();
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "Buttons/ButtonScheduler.h"
+namespace frc {
+
class Trigger;
class Command;
@@ -21,3 +23,5 @@ class ToggleButtonScheduler : public ButtonScheduler {
private:
bool pressedLast;
};
+
+} // namespace frc
View
@@ -12,6 +12,8 @@
#include "SmartDashboard/Sendable.h"
+namespace frc {
+
class Command;
/**
@@ -48,3 +50,5 @@ class Trigger : public Sendable {
protected:
std::shared_ptr<ITable> m_table;
};
+
+} // namespace frc
View
@@ -10,6 +10,8 @@
#include <cstddef>
#include <vector>
+namespace frc {
+
/**
* This is a simple circular buffer so we don't need to "bucket brigade" copy
* old values.
@@ -42,4 +44,6 @@ class CircularBuffer {
size_t ModuloDec(size_t index);
};
+} // namespace frc
+
#include "CircularBuffer.inc"
View
@@ -9,6 +9,8 @@
#include <algorithm>
+namespace frc {
+
template <class T>
CircularBuffer<T>::CircularBuffer(size_t size) : m_data(size, 0) {}
@@ -183,3 +185,5 @@ size_t CircularBuffer<T>::ModuloDec(size_t index) {
return index - 1;
}
}
+
+} // namespace frc
View
@@ -15,6 +15,8 @@
#include "SmartDashboard/NamedSendable.h"
#include "tables/ITableListener.h"
+namespace frc {
+
class CommandGroup;
class Subsystem;
@@ -178,3 +180,5 @@ class Command : public ErrorBase, public NamedSendable, public ITableListener {
protected:
std::shared_ptr<ITable> m_table;
};
+
+} // namespace frc
View
@@ -14,6 +14,8 @@
#include "Commands/Command.h"
#include "Commands/CommandGroupEntry.h"
+namespace frc {
+
/**
* A {@link CommandGroup} is a list of commands which are executed in sequence.
*
@@ -70,3 +72,5 @@ class CommandGroup : public Command {
/** The current command, -1 signifies that none have been run */
int m_currentCommandIndex = -1;
};
+
+} // namespace frc
View
@@ -7,6 +7,8 @@
#pragma once
+namespace frc {
+
class Command;
class CommandGroupEntry {
@@ -25,3 +27,5 @@ class CommandGroupEntry {
Command* m_command = nullptr;
Sequence m_state = kSequence_InSequence;
};
+
+} // namespace frc
View
@@ -15,6 +15,8 @@
#include "PIDOutput.h"
#include "PIDSource.h"
+namespace frc {
+
class PIDCommand : public Command, public PIDOutput, public PIDSource {
public:
PIDCommand(const std::string& name, double p, double i, double d);
@@ -55,3 +57,5 @@ class PIDCommand : public Command, public PIDOutput, public PIDSource {
void InitTable(std::shared_ptr<ITable> subtable) override;
std::string GetSmartDashboardType() const override;
};
+
+} // namespace frc
View
@@ -15,6 +15,8 @@
#include "PIDOutput.h"
#include "PIDSource.h"
+namespace frc {
+
/**
* This class is designed to handle the case where there is a {@link Subsystem}
* which uses a single {@link PIDController} almost constantly (for instance,
@@ -70,3 +72,5 @@ class PIDSubsystem : public Subsystem, public PIDOutput, public PIDSource {
void InitTable(std::shared_ptr<ITable> subtable) override;
std::string GetSmartDashboardType() const override;
};
+
+} // namespace frc
View
@@ -11,6 +11,8 @@
#include "Commands/Command.h"
+namespace frc {
+
class PrintCommand : public Command {
public:
explicit PrintCommand(const std::string& message);
@@ -26,3 +28,5 @@ class PrintCommand : public Command {
private:
std::string m_message;
};
+
+} // namespace frc
View
@@ -21,6 +21,8 @@
#include "SmartDashboard/SmartDashboard.h"
#include "networktables/NetworkTable.h"
+namespace frc {
+
class ButtonScheduler;
class Subsystem;
@@ -67,3 +69,5 @@ class Scheduler : public ErrorBase, public NamedSendable {
std::shared_ptr<ITable> m_table;
bool m_runningCommandsChanged = false;
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "Commands/Command.h"
+namespace frc {
+
class StartCommand : public Command {
public:
explicit StartCommand(Command* commandToStart);
@@ -24,3 +26,5 @@ class StartCommand : public Command {
private:
Command* m_commandToFork;
};
+
+} // namespace frc
View
@@ -13,6 +13,8 @@
#include "ErrorBase.h"
#include "SmartDashboard/NamedSendable.h"
+namespace frc {
+
class Command;
class Subsystem : public ErrorBase, public NamedSendable {
@@ -46,3 +48,5 @@ class Subsystem : public ErrorBase, public NamedSendable {
protected:
std::shared_ptr<ITable> m_table;
};
+
+} // namespace frc
View
@@ -11,6 +11,8 @@
#include "Commands/Command.h"
+namespace frc {
+
class WaitCommand : public Command {
public:
explicit WaitCommand(double timeout);
@@ -24,3 +26,5 @@ class WaitCommand : public Command {
virtual void End();
virtual void Interrupted();
};
+
+} // namespace frc
View
@@ -11,6 +11,8 @@
#include "Commands/Command.h"
+namespace frc {
+
class WaitForChildren : public Command {
public:
explicit WaitForChildren(double timeout);
@@ -24,3 +26,5 @@ class WaitForChildren : public Command {
virtual void End();
virtual void Interrupted();
};
+
+} // namespace frc
View
@@ -11,6 +11,8 @@
#include "Commands/Command.h"
+namespace frc {
+
class WaitUntilCommand : public Command {
public:
explicit WaitUntilCommand(double time);
@@ -27,3 +29,5 @@ class WaitUntilCommand : public Command {
private:
double m_time;
};
+
+} // namespace frc
View
@@ -7,6 +7,8 @@
#pragma once
+namespace frc {
+
/**
* Interface for Controllers.
* Common interface for controllers. Controllers run control loops, the most
@@ -28,3 +30,5 @@ class Controller {
*/
virtual void Disable() = 0;
};
+
+} // namespace frc
View
@@ -20,6 +20,8 @@
#undef GetMessage
#endif
+namespace frc {
+
// Forward declarations
class ErrorBase;
@@ -59,3 +61,5 @@ class Error {
const ErrorBase* m_originatingObject = nullptr;
double m_timestamp = 0.0;
};
+
+} // namespace frc
View
@@ -39,11 +39,11 @@
} while (0)
#define wpi_setStaticError(object, code) \
wpi_setStaticErrorWithContext(object, code, "")
-#define wpi_setGlobalErrorWithContext(code, context) \
- do { \
- if ((code) != 0) \
- ErrorBase::SetGlobalError((code), (context), __FILE__, __FUNCTION__, \
- __LINE__); \
+#define wpi_setGlobalErrorWithContext(code, context) \
+ do { \
+ if ((code) != 0) \
+ ::frc::ErrorBase::SetGlobalError((code), (context), __FILE__, \
+ __FUNCTION__, __LINE__); \
} while (0)
#define wpi_setGlobalError(code) wpi_setGlobalErrorWithContext(code, "")
#define wpi_setWPIErrorWithContext(error, context) \
@@ -55,11 +55,13 @@
__FUNCTION__, __LINE__)
#define wpi_setStaticWPIError(object, error) \
wpi_setStaticWPIErrorWithContext(object, error, "")
-#define wpi_setGlobalWPIErrorWithContext(error, context) \
- ErrorBase::SetGlobalWPIError((wpi_error_s_##error), (context), __FILE__, \
- __FUNCTION__, __LINE__)
+#define wpi_setGlobalWPIErrorWithContext(error, context) \
+ ::frc::ErrorBase::SetGlobalWPIError((wpi_error_s_##error), (context), \
+ __FILE__, __FUNCTION__, __LINE__)
#define wpi_setGlobalWPIError(error) wpi_setGlobalWPIErrorWithContext(error, "")
+namespace frc {
+
/**
* Base class for most objects.
* ErrorBase is the base class for most objects since it holds the generated
@@ -114,3 +116,5 @@ class ErrorBase {
static priority_mutex _globalErrorMutex;
static Error _globalError;
};
+
+} // namespace frc
View
@@ -11,6 +11,8 @@
#include "PIDSource.h"
+namespace frc {
+
/**
* Interface for filters
*/
@@ -48,3 +50,5 @@ class Filter : public PIDSource {
private:
std::shared_ptr<PIDSource> m_source;
};
+
+} // namespace frc
View
@@ -14,6 +14,8 @@
#include "CircularBuffer.h"
#include "Filter.h"
+namespace frc {
+
/**
* This class implements a linear, digital filter. All types of FIR and IIR
* filters are supported. Static factory methods are provided to create commonly
@@ -100,3 +102,5 @@ class LinearDigitalFilter : public Filter {
std::vector<double> m_inputGains;
std::vector<double> m_outputGains;
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include <stdint.h>
+namespace frc {
+
/**
* GenericHID Interface.
*/
@@ -32,3 +34,5 @@ class GenericHID {
virtual int GetPOV(int pov = 0) const = 0;
};
+
+} // namespace frc
View
@@ -15,6 +15,8 @@
#include "SensorBase.h"
#include "interfaces/Gyro.h"
+namespace frc {
+
/**
* GyroBase is the common base class for Gyro implementations such as
* AnalogGyro.
@@ -39,3 +41,5 @@ class GyroBase : public Gyro,
private:
std::shared_ptr<ITable> m_table;
};
+
+} // namespace frc
View
@@ -7,6 +7,8 @@
#pragma once
+namespace frc {
+
class HLUsageReportingInterface {
public:
virtual ~HLUsageReportingInterface() = default;
@@ -23,3 +25,5 @@ class HLUsageReporting {
static void ReportScheduler();
static void ReportSmartDashboard();
};
+
+} // namespace frc
View
@@ -16,6 +16,8 @@
#include "LiveWindow/LiveWindowSendable.h"
#include "tables/ITable.h"
+namespace frc {
+
struct LiveWindowComponent {
std::string subsystem;
std::string name;
@@ -81,3 +83,5 @@ class LiveWindow {
bool m_enabled = false;
bool m_firstTime = true;
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "SmartDashboard/Sendable.h"
+namespace frc {
+
/**
* Live Window Sendable is a special type of object sendable to the live window.
*/
@@ -32,3 +34,5 @@ class LiveWindowSendable : public Sendable {
*/
virtual void StopLiveWindowMode() = 0;
};
+
+} // namespace frc
View
@@ -12,8 +12,12 @@
#include "tables/ITable.h"
#include "tables/ITableListener.h"
+namespace frc {
+
class LiveWindowStatusListener : public ITableListener {
public:
virtual void ValueChanged(ITable* source, llvm::StringRef key,
std::shared_ptr<nt::Value> value, bool isNew);
};
+
+} // namespace frc
View
@@ -21,6 +21,8 @@
#include "PIDSource.h"
#include "Timer.h"
+namespace frc {
+
class PIDOutput;
/**
@@ -147,3 +149,5 @@ class PIDController : public LiveWindowSendable,
void StartLiveWindowMode() override;
void StopLiveWindowMode() override;
};
+
+} // namespace frc
View
@@ -11,6 +11,8 @@
#include "Controller.h"
#include "LiveWindow/LiveWindow.h"
+namespace frc {
+
class PIDInterface : public Controller {
virtual void SetPID(double p, double i, double d) = 0;
virtual double GetP() const = 0;
@@ -26,3 +28,5 @@ class PIDInterface : public Controller {
virtual void Reset() = 0;
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "Base.h"
+namespace frc {
+
/**
* PIDOutput interface is a generic output for the PID class.
* PWMs use this class.
@@ -19,3 +21,5 @@ class PIDOutput {
public:
virtual void PIDWrite(float output) = 0;
};
+
+} // namespace frc
View
@@ -7,6 +7,8 @@
#pragma once
+namespace frc {
+
enum class PIDSourceType { kDisplacement, kRate };
/**
@@ -23,3 +25,5 @@ class PIDSource {
protected:
PIDSourceType m_pidSource = PIDSourceType::kDisplacement;
};
+
+} // namespace frc
View
@@ -16,6 +16,8 @@
#include "ErrorBase.h"
#include "HAL/cpp/priority_mutex.h"
+namespace frc {
+
/**
* The Resource class is a convenient way to track allocated resources.
* It tracks them as indicies in the range [0 .. elements - 1].
@@ -45,3 +47,5 @@ class Resource : public ErrorBase {
static priority_recursive_mutex m_createLock;
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include <memory>
+namespace frc {
+
class RobotStateInterface {
public:
virtual ~RobotStateInterface() = default;
@@ -32,3 +34,5 @@ class RobotState {
static bool IsAutonomous();
static bool IsTest();
};
+
+} // namespace frc
View
@@ -11,6 +11,8 @@
#include "SmartDashboard/Sendable.h"
+namespace frc {
+
/**
* The interface for sendable objects that gives the sendable a default name in
* the Smart Dashboard
@@ -24,3 +26,5 @@ class NamedSendable : public Sendable {
*/
virtual std::string GetName() const = 0;
};
+
+} // namespace frc
View
@@ -12,6 +12,8 @@
#include "tables/ITable.h"
+namespace frc {
+
class Sendable {
public:
/**
@@ -31,3 +33,5 @@ class Sendable {
*/
virtual std::string GetSmartDashboardType() const = 0;
};
+
+} // namespace frc
View
@@ -14,6 +14,8 @@
#include "SmartDashboard/Sendable.h"
#include "tables/ITable.h"
+namespace frc {
+
/**
* The {@link SendableChooser} class is a useful tool for presenting a selection
* of options to the {@link SmartDashboard}.
@@ -44,3 +46,5 @@ class SendableChooser : public Sendable {
std::map<std::string, void*> m_choices;
std::shared_ptr<ITable> m_table;
};
+
+} // namespace frc
View
@@ -17,6 +17,8 @@
#include "SmartDashboard/Sendable.h"
#include "tables/ITable.h"
+namespace frc {
+
class SmartDashboard : public SensorBase {
public:
static void init();
@@ -94,3 +96,5 @@ class SmartDashboard : public SensorBase {
*/
static std::map<std::shared_ptr<ITable>, Sendable*> m_tablesToData;
};
+
+} // namespace frc
View
@@ -10,6 +10,8 @@
#include "Base.h"
#include "HAL/cpp/priority_mutex.h"
+namespace frc {
+
typedef void (*TimerInterruptHandler)(void* param);
void Wait(double seconds);
@@ -51,3 +53,5 @@ class Timer {
bool m_running = false;
mutable priority_mutex m_mutex;
};
+
+} // namespace frc
View
@@ -46,8 +46,12 @@ bool wpi_assertNotEqual_impl(int valueA, int valueB, const char* valueAString,
void wpi_suspendOnAssertEnabled(bool enabled);
+namespace frc {
+
int GetFPGAVersion();
int64_t GetFPGARevision();
uint64_t GetFPGATime();
bool GetUserButton();
std::string GetStackTrace(int offset);
+
+} // namespace frc
View
@@ -7,6 +7,8 @@
#pragma once
+namespace frc {
+
/**
* Interface for 3-axis accelerometers
*/
@@ -45,3 +47,5 @@ class Accelerometer {
*/
virtual double GetZ() = 0;
};
+
+} // namespace frc
View
@@ -7,6 +7,8 @@
#pragma once
+namespace frc {
+
/**
* Interface for yaw rate gyros
*/
@@ -54,3 +56,5 @@ class Gyro {
*/
virtual double GetRate() const = 0;
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "PIDSource.h"
+namespace frc {
+
/**
* Interface for potentiometers.
*/
@@ -25,3 +27,5 @@ class Potentiometer : public PIDSource {
void SetPIDSourceType(PIDSourceType pidSource) override;
};
+
+} // namespace frc
View
@@ -7,6 +7,8 @@
#include "Buttons/Button.h"
+using namespace frc;
+
/**
* Specifies the command to run when a button is first pressed.
*
View
@@ -9,6 +9,8 @@
#include "Commands/Scheduler.h"
+using namespace frc;
+
ButtonScheduler::ButtonScheduler(bool last, Trigger* button, Command* orders)
: m_pressedLast(last), m_button(button), m_command(orders) {}
View
@@ -10,6 +10,8 @@
#include "Buttons/Button.h"
#include "Commands/Command.h"
+using namespace frc;
+
CancelButtonScheduler::CancelButtonScheduler(bool last, Trigger* button,
Command* orders)
: ButtonScheduler(last, button, orders) {
View
@@ -10,6 +10,8 @@
#include "Buttons/Button.h"
#include "Commands/Command.h"
+using namespace frc;
+
HeldButtonScheduler::HeldButtonScheduler(bool last, Trigger* button,
Command* orders)
: ButtonScheduler(last, button, orders) {}
View
@@ -7,6 +7,8 @@
#include "Buttons/InternalButton.h"
+using namespace frc;
+
InternalButton::InternalButton(bool inverted)
: m_pressed(inverted), m_inverted(inverted) {}
View
@@ -7,6 +7,8 @@
#include "Buttons/JoystickButton.h"
+using namespace frc;
+
JoystickButton::JoystickButton(GenericHID* joystick, int buttonNumber)
: m_joystick(joystick), m_buttonNumber(buttonNumber) {}
View
@@ -9,6 +9,8 @@
#include "networktables/NetworkTable.h"
+using namespace frc;
+
NetworkButton::NetworkButton(const std::string& tableName,
const std::string& field)
: // TODO how is this supposed to work???
View
@@ -10,6 +10,8 @@
#include "Buttons/Button.h"
#include "Commands/Command.h"
+using namespace frc;
+
PressedButtonScheduler::PressedButtonScheduler(bool last, Trigger* button,
Command* orders)
: ButtonScheduler(last, button, orders) {}
View
@@ -10,6 +10,8 @@
#include "Buttons/Button.h"
#include "Commands/Command.h"
+using namespace frc;
+
ReleasedButtonScheduler::ReleasedButtonScheduler(bool last, Trigger* button,
Command* orders)
: ButtonScheduler(last, button, orders) {}
View
@@ -10,6 +10,8 @@
#include "Buttons/Button.h"
#include "Commands/Command.h"
+using namespace frc;
+
ToggleButtonScheduler::ToggleButtonScheduler(bool last, Trigger* button,
Command* orders)
: ButtonScheduler(last, button, orders) {
View
@@ -12,6 +12,8 @@
#include "Buttons/ReleasedButtonScheduler.h"
#include "Buttons/ToggleButtonScheduler.h"
+using namespace frc;
+
bool Trigger::Grab() {
if (Get()) {
return true;
View
@@ -15,6 +15,8 @@
#include "Timer.h"
#include "WPIErrors.h"
+using namespace frc;
+
static const std::string kName = "name";
static const std::string kRunning = "running";
static const std::string kIsParented = "isParented";
View
@@ -9,6 +9,8 @@
#include "WPIErrors.h"
+using namespace frc;
+
/**
* Creates a new {@link CommandGroup CommandGroup} with the given name.
* @param name the name for this command group
View
@@ -9,6 +9,8 @@
#include "Commands/Command.h"
+using namespace frc;
+
CommandGroupEntry::CommandGroupEntry(Command* command, Sequence state,
double timeout)
: m_timeout(timeout), m_command(command), m_state(state) {}
View
@@ -9,6 +9,8 @@
#include <cfloat>
+using namespace frc;
+
PIDCommand::PIDCommand(const std::string& name, double p, double i, double d,
double f, double period)
: Command(name) {
View
@@ -9,6 +9,8 @@
#include "PIDController.h"
+using namespace frc;
+
/**
* Instantiates a {@link PIDSubsystem} that will use the given p, i and d
* values.
View
@@ -10,6 +10,8 @@
#include <cstdio>
#include <sstream>
+using namespace frc;
+
PrintCommand::PrintCommand(const std::string& message)
: Command(((std::stringstream&)(std::stringstream("Print \"") << message
<< "\""))
View
@@ -16,6 +16,8 @@
#include "HLUsageReporting.h"
#include "WPIErrors.h"
+using namespace frc;
+
Scheduler::Scheduler() { HLUsageReporting::ReportScheduler(); }
/**
View
@@ -7,6 +7,8 @@
#include "Commands/StartCommand.h"
+using namespace frc;
+
StartCommand::StartCommand(Command* commandToStart) : Command("StartCommand") {
m_commandToFork = commandToStart;
}
View
@@ -11,6 +11,8 @@
#include "Commands/Scheduler.h"
#include "WPIErrors.h"
+using namespace frc;
+
/**
* Creates a subsystem with the given name.
*
View
@@ -9,6 +9,8 @@
#include <sstream>
+using namespace frc;
+
WaitCommand::WaitCommand(double timeout)
: Command(
((std::stringstream&)(std::stringstream("Wait(") << timeout << ")"))
View
@@ -9,6 +9,8 @@
#include "Commands/CommandGroup.h"
+using namespace frc;
+
WaitForChildren::WaitForChildren(double timeout)
: Command("WaitForChildren", timeout) {}
View
@@ -9,6 +9,8 @@
#include "Timer.h"
+using namespace frc;
+
/**
* A {@link WaitCommand} will wait until a certain match time before finishing.
*
View
@@ -13,6 +13,8 @@
#include "Timer.h"
#include "Utility.h"
+using namespace frc;
+
void Error::Clone(const Error& error) {
m_code = error.m_code;
m_message = error.m_message;
View
@@ -16,6 +16,8 @@
#define WPI_ERRORS_DEFINE_STRINGS
#include "WPIErrors.h"
+using namespace frc;
+
priority_mutex ErrorBase::_globalErrorMutex;
Error ErrorBase::_globalError;
View
@@ -7,6 +7,8 @@
#include "Filters/Filter.h"
+using namespace frc;
+
Filter::Filter(std::shared_ptr<PIDSource> source) { m_source = source; }
void Filter::SetPIDSourceType(PIDSourceType pidSource) {
View
@@ -10,6 +10,8 @@
#include <cassert>
#include <cmath>
+using namespace frc;
+
/**
* Create a linear FIR or IIR filter.
*
View
@@ -10,6 +10,8 @@
#include "LiveWindow/LiveWindow.h"
#include "WPIErrors.h"
+using namespace frc;
+
/**
* Get the PIDOutput for the PIDSource base object. Can be set to return
* angle or rate using SetPIDSourceType(). Defaults to angle.
View
@@ -7,6 +7,8 @@
#include "HLUsageReporting.h"
+using namespace frc;
+
HLUsageReportingInterface* HLUsageReporting::impl = nullptr;
void HLUsageReporting::SetImplementation(HLUsageReportingInterface* i) {
View
@@ -12,6 +12,8 @@
#include "networktables/NetworkTable.h"
+using namespace frc;
+
/**
* Get an instance of the LiveWindow main class.
*
View
@@ -9,6 +9,8 @@
#include "Commands/Scheduler.h"
+using namespace frc;
+
void LiveWindowStatusListener::ValueChanged(ITable* source, llvm::StringRef key,
std::shared_ptr<nt::Value> value,
bool isNew) {}
View
@@ -7,6 +7,8 @@
#include "PIDSource.h"
+using namespace frc;
+
/**
* Set which parameter you are using as a process control variable.
*
View
@@ -10,6 +10,8 @@
#include "ErrorBase.h"
#include "WPIErrors.h"
+using namespace frc;
+
priority_recursive_mutex Resource::m_createLock;
/**
View
@@ -9,6 +9,8 @@
#include "Base.h"
+using namespace frc;
+
std::shared_ptr<RobotStateInterface> RobotState::impl;
void RobotState::SetImplementation(RobotStateInterface& i) {
View
@@ -7,6 +7,8 @@
#include "SmartDashboard/SendableChooser.h"
+using namespace frc;
+
static const std::string kDefault = "default";
static const std::string kOptions = "options";
static const std::string kSelected = "selected";
View
@@ -12,6 +12,8 @@
#include "WPIErrors.h"
#include "networktables/NetworkTable.h"
+using namespace frc;
+
std::shared_ptr<ITable> SmartDashboard::m_table;
std::map<std::shared_ptr<ITable>, Sendable*> SmartDashboard::m_tablesToData;
View
@@ -9,6 +9,8 @@
#include <Utility.h>
+using namespace frc;
+
void Potentiometer::SetPIDSourceType(PIDSourceType pidSource) {
if (wpi_assert(pidSource == PIDSourceType::kDisplacement)) {
m_pidSource = pidSource;
View
@@ -5,6 +5,8 @@ project(wpilibcSim)
file(GLOB_RECURSE COM_SRC_FILES ../shared/src/*.cpp
src/*.cpp)
+add_definitions(-DNAMESPACED_WPILIB)
+
set (INCLUDE_FOLDERS include
../shared/include
../../hal/include
View
@@ -12,6 +12,8 @@
#include "GyroBase.h"
#include "simulation/SimGyro.h"
+namespace frc {
+
class AnalogInput;
class AnalogModule;
@@ -49,3 +51,5 @@ class AnalogGyro : public GyroBase {
std::shared_ptr<ITable> m_table;
};
+
+} // namespace frc
View
@@ -15,6 +15,8 @@
#include "SensorBase.h"
#include "simulation/SimFloatInput.h"
+namespace frc {
+
/**
* Analog input class.
*
@@ -59,3 +61,5 @@ class AnalogInput : public SensorBase,
std::shared_ptr<ITable> m_table;
};
+
+} // namespace frc
View
@@ -14,6 +14,8 @@
#include "LiveWindow/LiveWindowSendable.h"
#include "interfaces/Potentiometer.h"
+namespace frc {
+
/**
* Class for reading analog potentiometers. Analog potentiometers read
* in an analog voltage that corresponds to a position. Usually the
@@ -93,3 +95,5 @@ class AnalogPotentiometer : public Potentiometer, public LiveWindowSendable {
*/
void initPot(AnalogInput* input, double scale, double offset);
};
+
+} // namespace frc
View
@@ -14,6 +14,8 @@
#include "LiveWindow/LiveWindowSendable.h"
#include "SensorBase.h"
+namespace frc {
+
/**
* Class for counting the number of ticks on a digital input channel.
*
@@ -98,3 +100,5 @@ class Counter : public SensorBase,
std::shared_ptr<ITable> m_table;
};
+
+} // namespace frc
View
@@ -7,6 +7,8 @@
#pragma once
+namespace frc {
+
/**
* Interface for counting the number of ticks on a digital input channel.
*
@@ -28,3 +30,5 @@ class CounterBase {
virtual bool GetStopped() const = 0;
virtual bool GetDirection() const = 0;
};
+
+} // namespace frc
View
@@ -13,6 +13,8 @@
#include "LiveWindow/LiveWindowSendable.h"
#include "simulation/SimDigitalInput.h"
+namespace frc {
+
/**
* Class to read a digital input.
*
@@ -43,3 +45,5 @@ class DigitalInput : public LiveWindowSendable {
std::shared_ptr<ITable> m_table;
};
+
+} // namespace frc
View
@@ -14,6 +14,8 @@
#include "simulation/SimContinuousOutput.h"
#include "tables/ITableListener.h"
+namespace frc {
+
/**
* DoubleSolenoid class for running 2 channels of high voltage Digital Output
* (PCM).
@@ -47,3 +49,5 @@ class DoubleSolenoid : public LiveWindowSendable, public ITableListener {
std::shared_ptr<ITable> m_table;
};
+
+} // namespace frc
View
@@ -23,11 +23,13 @@
#include <Winsock2.h>
#endif
+using namespace gazebo;
+
+namespace frc {
+
struct HALCommonControlData;
class AnalogInput;
-using namespace gazebo;
-
/**
* Provide access to the network communication data to / from the Driver
* Station.
@@ -143,3 +145,5 @@ class DriverStation : public SensorBase, public RobotStateInterface {
msgs::DriverStationPtr state;
msgs::FRCJoystickPtr joysticks[6];
};
+
+} // namespace frc
View
@@ -18,6 +18,8 @@
#include "SensorBase.h"
#include "simulation/SimEncoder.h"
+namespace frc {
+
/**
* Class to read quad encoders.
*
@@ -97,3 +99,5 @@ class Encoder : public SensorBase,
std::shared_ptr<ITable> m_table;
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "RobotBase.h"
+namespace frc {
+
/**
* IterativeRobot implements a specific type of Robot Program framework,
* extending the RobotBase class.
@@ -68,3 +70,5 @@ class IterativeRobot : public RobotBase {
bool m_teleopInitialized = false;
bool m_testInitialized = false;
};
+
+} // namespace frc
View
@@ -11,6 +11,8 @@
#include "SafePWM.h"
#include "SpeedController.h"
+namespace frc {
+
/**
* Luminary Micro Jaguar Speed Control.
*/
@@ -24,3 +26,5 @@ class Jaguar : public SafePWM, public SpeedController {
void PIDWrite(float output) override;
};
+
+} // namespace frc
View
@@ -12,6 +12,8 @@
#include "ErrorBase.h"
#include "GenericHID.h"
+namespace frc {
+
class DriverStation;
/**
@@ -77,3 +79,5 @@ class Joystick : public GenericHID, public ErrorBase {
std::unique_ptr<int[]> m_axes;
std::unique_ptr<int[]> m_buttons;
};
+
+} // namespace frc
View
@@ -11,6 +11,8 @@
#include <sstream>
+namespace frc {
+
class MotorSafety {
public:
virtual void SetExpiration(float timeout) = 0;
@@ -21,3 +23,5 @@ class MotorSafety {
virtual bool IsSafetyEnabled() const = 0;
virtual void GetDescription(std::ostringstream& desc) const = 0;
};
+
+} // namespace frc
View
@@ -12,6 +12,8 @@
#include "ErrorBase.h"
#include "HAL/cpp/priority_mutex.h"
+namespace frc {
+
class MotorSafety;
class MotorSafetyHelper : public ErrorBase {
@@ -42,3 +44,5 @@ class MotorSafetyHelper : public ErrorBase {
// protect accesses to the list of helpers
static priority_recursive_mutex m_listMutex;
};
+
+} // namespace frc
View
@@ -16,6 +16,8 @@
#include "ErrorBase.h"
#include "HAL/cpp/priority_mutex.h"
+namespace frc {
+
typedef std::function<void()> TimerEventHandler;
class Notifier : public ErrorBase {
@@ -70,3 +72,5 @@ class Notifier : public ErrorBase {
static std::atomic<bool> m_stopped;
static void Run();
};
+
+} // namespace frc
View
@@ -15,6 +15,8 @@
#include "simulation/SimContinuousOutput.h"
#include "tables/ITableListener.h"
+namespace frc {
+
/**
* Class implements the PWM generation in the FPGA.
*
@@ -106,3 +108,5 @@ class PWM : public SensorBase,
int m_channel;
SimContinuousOutput* impl;
};
+
+} // namespace frc
View
@@ -17,6 +17,8 @@
#include "tables/ITable.h"
#include "tables/ITableListener.h"
+namespace frc {
+
class MotorSafetyHelper;
class DigitalModule;
@@ -73,3 +75,5 @@ class Relay : public MotorSafety,
SimContinuousOutput* impl;
bool go_pos, go_neg;
};
+
+} // namespace frc
View
@@ -21,6 +21,8 @@
robot.StartCompetition(); \
}
+namespace frc {
+
/**
* Implement a Robot Program framework.
*
@@ -50,3 +52,5 @@ class RobotBase {
DriverStation& m_ds;
transport::SubscriberPtr time_sub;
};
+
+} // namespace frc
View
@@ -15,6 +15,8 @@
#include "MotorSafety.h"
#include "MotorSafetyHelper.h"
+namespace frc {
+
class SpeedController;
class GenericHID;
@@ -124,3 +126,5 @@ class RobotDrive : public MotorSafety, public ErrorBase {
return motors;
}
};
+
+} // namespace frc
View
@@ -13,6 +13,8 @@
#include "MotorSafetyHelper.h"
#include "PWM.h"
+namespace frc {
+
/**
* A safe version of the PWM class.
*
@@ -39,3 +41,5 @@ class SafePWM : public PWM, public MotorSafety {
private:
std::unique_ptr<MotorSafetyHelper> m_safetyHelper;
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "RobotBase.h"
+namespace frc {
+
class SampleRobot : public RobotBase {
public:
SampleRobot();
@@ -24,3 +26,5 @@ class SampleRobot : public RobotBase {
private:
bool m_robotMainOverridden;
};
+
+} // namespace frc
View
@@ -12,6 +12,8 @@
#include "Base.h"
#include "ErrorBase.h"
+namespace frc {
+
/**
* Base class for all sensors.
* Stores most recent status information as well as containing utility functions
@@ -45,3 +47,5 @@ class SensorBase : public ErrorBase {
static const int kRelayChannels = 8;
static const int kPDPChannels = 16;
};
+
+} // namespace frc
View
@@ -14,6 +14,8 @@
#include "simulation/SimContinuousOutput.h"
#include "tables/ITableListener.h"
+namespace frc {
+
/**
* Solenoid class for running high voltage Digital Output (PCM).
*
@@ -43,3 +45,5 @@ class Solenoid : public LiveWindowSendable, public ITableListener {
std::shared_ptr<ITable> m_table;
};
+
+} // namespace frc
View
@@ -9,6 +9,8 @@
#include "PIDOutput.h"
+namespace frc {
+
/**
* Interface for speed controlling devices.
*/
@@ -32,3 +34,5 @@ class SpeedController : public PIDOutput {
*/
virtual void Disable() = 0;
};
+
+} // namespace frc
View
@@ -11,6 +11,8 @@
#include "SafePWM.h"
#include "SpeedController.h"
+namespace frc {
+
/**
* CTRE Talon Speed Controller.
*/
@@ -24,3 +26,5 @@ class Talon : public SafePWM, public SpeedController {
void PIDWrite(float output) override;
};
+
+} // namespace frc
View
@@ -11,6 +11,8 @@
#include "SafePWM.h"
#include "SpeedController.h"
+namespace frc {
+
/**
* IFI Victor Speed Controller.
*/
@@ -24,3 +26,5 @@ class Victor : public SafePWM, public SpeedController {
void PIDWrite(float output) override;
};
+
+} // namespace frc
View
@@ -16,6 +16,8 @@
using namespace gazebo;
+namespace frc {
+
class MainNode {
public:
static MainNode* GetInstance() {
@@ -61,3 +63,5 @@ class MainNode {
}
}
};
+
+} // namespace frc
View
@@ -21,6 +21,8 @@
using namespace gazebo;
+namespace frc {
+
class SimContinuousOutput {
private:
transport::PublisherPtr pub;
@@ -44,3 +46,5 @@ class SimContinuousOutput {
*/
float Get();
};
+
+} // namespace frc
View
@@ -15,6 +15,8 @@
using namespace gazebo;
+namespace frc {
+
class SimDigitalInput {
public:
explicit SimDigitalInput(std::string topic);
@@ -29,3 +31,5 @@ class SimDigitalInput {
transport::SubscriberPtr sub;
void callback(const msgs::ConstBoolPtr& msg);
};
+
+} // namespace frc
View
@@ -16,6 +16,8 @@
using namespace gazebo;
+namespace frc {
+
class SimEncoder {
public:
explicit SimEncoder(std::string topic);
@@ -35,3 +37,5 @@ class SimEncoder {
void positionCallback(const msgs::ConstFloat64Ptr& msg);
void velocityCallback(const msgs::ConstFloat64Ptr& msg);
};
+
+} // namespace frc
View
@@ -15,6 +15,8 @@
using namespace gazebo;
+namespace frc {
+
class SimFloatInput {
public:
explicit SimFloatInput(std::string topic);
@@ -29,3 +31,5 @@ class SimFloatInput {
transport::SubscriberPtr sub;
void callback(const msgs::ConstFloat64Ptr& msg);
};
+
+} // namespace frc
View
@@ -15,6 +15,8 @@
using namespace gazebo;
+namespace frc {
+
class SimGyro {
public:
explicit SimGyro(std::string topic);
@@ -32,3 +34,5 @@ class SimGyro {
void positionCallback(const msgs::ConstFloat64Ptr& msg);
void velocityCallback(const msgs::ConstFloat64Ptr& msg);
};
+
+} // namespace frc
View
@@ -13,6 +13,8 @@
#include "Timer.h"
#include "WPIErrors.h"
+using namespace frc;
+
const int AnalogGyro::kOversampleBits = 10;
const int AnalogGyro::kAverageBits = 0;
const float AnalogGyro::kSamplesPerSecond = 50.0;
View
@@ -12,6 +12,8 @@
#include "LiveWindow/LiveWindow.h"
#include "WPIErrors.h"
+using namespace frc;
+
/**
* Construct an analog input.
*
Oops, something went wrong.