mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Namespace all wpilibc functions/classes into "frc" namespace. (#311)
Base.h provides a backwards compatibility shim (enabled unless NAMESPACED_WPILIB is defined) that does a "using namespace frc". However, as some header files do not include Base.h, this may be a breaking change in some corner cases (with an easy fix). Fixes #218.
This commit is contained in:
@@ -11,6 +11,7 @@ model {
|
||||
targetPlatform 'arm'
|
||||
binaries.all {
|
||||
tasks.withType(CppCompile) {
|
||||
cppCompiler.args "-DNAMESPACED_WPILIB"
|
||||
addNiLibraryLinks(linker, targetPlatform)
|
||||
addNetworkTablesLibraryLinks(it, linker, targetPlatform)
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "LiveWindow/LiveWindowSendable.h"
|
||||
#include "interfaces/Accelerometer.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* ADXL345 Accelerometer on I2C.
|
||||
*
|
||||
@@ -81,3 +83,5 @@ class ADXL345_I2C : public Accelerometer, public LiveWindowSendable {
|
||||
private:
|
||||
std::shared_ptr<ITable> m_table;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "SensorBase.h"
|
||||
#include "interfaces/Accelerometer.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class DigitalInput;
|
||||
class DigitalOutput;
|
||||
|
||||
@@ -83,3 +85,5 @@ class ADXL345_SPI : public Accelerometer, public LiveWindowSendable {
|
||||
private:
|
||||
std::shared_ptr<ITable> m_table;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "SensorBase.h"
|
||||
#include "interfaces/Accelerometer.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class DigitalInput;
|
||||
class DigitalOutput;
|
||||
|
||||
@@ -62,3 +64,5 @@ class ADXL362 : public Accelerometer, public LiveWindowSendable {
|
||||
|
||||
std::shared_ptr<ITable> m_table;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "Notifier.h"
|
||||
#include "SPI.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* Use a rate gyro to return the robots heading relative to a starting position.
|
||||
* The Gyro class tracks the robots heading based on the starting position. As
|
||||
@@ -41,3 +43,5 @@ class ADXRS450_Gyro : public GyroBase {
|
||||
|
||||
uint16_t ReadRegister(int reg);
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "PIDSource.h"
|
||||
#include "SensorBase.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* Handle operation of an analog accelerometer.
|
||||
* The accelerometer reads acceleration directly through the sensor. Many
|
||||
@@ -51,3 +53,5 @@ class AnalogAccelerometer : public SensorBase,
|
||||
|
||||
std::shared_ptr<ITable> m_table;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "GyroBase.h"
|
||||
#include "HAL/Types.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class AnalogInput;
|
||||
|
||||
/**
|
||||
@@ -58,3 +60,5 @@ class AnalogGyro : public GyroBase {
|
||||
private:
|
||||
HAL_GyroHandle m_gyroHandle = HAL_kInvalidHandle;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "PIDSource.h"
|
||||
#include "SensorBase.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* Analog input class.
|
||||
*
|
||||
@@ -87,3 +89,5 @@ class AnalogInput : public SensorBase,
|
||||
|
||||
std::shared_ptr<ITable> m_table;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
#include "LiveWindow/LiveWindowSendable.h"
|
||||
#include "SensorBase.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* MXP analog output class.
|
||||
*/
|
||||
@@ -40,3 +42,5 @@ class AnalogOutput : public SensorBase, public LiveWindowSendable {
|
||||
|
||||
std::shared_ptr<ITable> m_table;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -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. The position is
|
||||
@@ -90,3 +92,5 @@ class AnalogPotentiometer : public Potentiometer, public LiveWindowSendable {
|
||||
double m_fullRange, m_offset;
|
||||
std::shared_ptr<ITable> m_table;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "HAL/Types.h"
|
||||
#include "SensorBase.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class AnalogInput;
|
||||
|
||||
class AnalogTrigger : public SensorBase {
|
||||
@@ -39,3 +41,5 @@ class AnalogTrigger : public SensorBase {
|
||||
AnalogInput* m_analogInput = nullptr;
|
||||
bool m_ownsAnalog = false;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "DigitalSource.h"
|
||||
#include "HAL/AnalogTrigger.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class AnalogTrigger;
|
||||
|
||||
/**
|
||||
@@ -67,3 +69,5 @@ class AnalogTriggerOutput : public DigitalSource {
|
||||
const AnalogTrigger& m_trigger;
|
||||
AnalogTriggerType m_outputType;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -7,9 +7,13 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace frc {
|
||||
|
||||
enum class AnalogTriggerType {
|
||||
kInWindow = 0,
|
||||
kState = 1,
|
||||
kRisingPulse = 2,
|
||||
kFallingPulse = 3
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "SensorBase.h"
|
||||
#include "interfaces/Accelerometer.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* Built-in accelerometer.
|
||||
*
|
||||
@@ -42,3 +44,5 @@ class BuiltInAccelerometer : public Accelerometer,
|
||||
private:
|
||||
std::shared_ptr<ITable> m_table;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "SpeedController.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* Interface for "smart" CAN-based speed controllers.
|
||||
*/
|
||||
@@ -98,3 +100,5 @@ class CANSpeedController : public SpeedController {
|
||||
// virtual void SetControlMode(ControlMode mode) = 0;
|
||||
// virtual ControlMode GetControlMode() const = 0;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#include "USBCamera.h"
|
||||
#include "nivision.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class CameraServer : public ErrorBase {
|
||||
private:
|
||||
static constexpr uint16_t kPort = 1180;
|
||||
@@ -80,3 +82,5 @@ class CameraServer : public ErrorBase {
|
||||
|
||||
void SetSize(int size);
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "SensorBase.h"
|
||||
#include "tables/ITableListener.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* PCM compressor
|
||||
*/
|
||||
@@ -63,3 +65,5 @@ class Compressor : public SensorBase,
|
||||
|
||||
std::shared_ptr<ITable> m_table;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace frc {
|
||||
|
||||
class ControllerPower {
|
||||
public:
|
||||
static float GetInputVoltage();
|
||||
@@ -24,3 +26,5 @@ class ControllerPower {
|
||||
static bool GetEnabled6V();
|
||||
static int GetFaultCount6V();
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#include "LiveWindow/LiveWindowSendable.h"
|
||||
#include "SensorBase.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class DigitalGlitchFilter;
|
||||
|
||||
/**
|
||||
@@ -113,3 +115,5 @@ class Counter : public SensorBase,
|
||||
std::shared_ptr<ITable> m_table;
|
||||
friend class DigitalGlitchFilter;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* Interface for counting the number of ticks on a digital input channel.
|
||||
* Encoders, Gear tooth sensors, and counters should all subclass this so it can
|
||||
@@ -29,3 +31,5 @@ class CounterBase {
|
||||
virtual bool GetStopped() const = 0;
|
||||
virtual bool GetDirection() const = 0;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "DigitalSource.h"
|
||||
#include "HAL/cpp/priority_mutex.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class Encoder;
|
||||
class Counter;
|
||||
|
||||
@@ -50,3 +52,5 @@ class DigitalGlitchFilter : public SensorBase {
|
||||
static priority_mutex m_mutex;
|
||||
static ::std::array<bool, 3> m_filterAllocated;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "DigitalSource.h"
|
||||
#include "LiveWindow/LiveWindowSendable.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class DigitalGlitchFilter;
|
||||
|
||||
/**
|
||||
@@ -51,3 +53,5 @@ class DigitalInput : public DigitalSource, public LiveWindowSendable {
|
||||
std::shared_ptr<ITable> m_table;
|
||||
friend class DigitalGlitchFilter;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "LiveWindow/LiveWindowSendable.h"
|
||||
#include "tables/ITableListener.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* Class to write to digital outputs.
|
||||
* Write values to the digital output channels. Other devices implemented
|
||||
@@ -58,3 +60,5 @@ class DigitalOutput : public DigitalSource,
|
||||
|
||||
std::shared_ptr<ITable> m_table;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "HAL/Types.h"
|
||||
#include "InterruptableSensorBase.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* DigitalSource Interface.
|
||||
* The DigitalSource represents all the possible inputs for a counter or a
|
||||
@@ -28,3 +30,5 @@ class DigitalSource : public InterruptableSensorBase {
|
||||
virtual bool IsAnalogTrigger() const = 0;
|
||||
virtual int GetChannel() const = 0;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "SolenoidBase.h"
|
||||
#include "tables/ITableListener.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* DoubleSolenoid class for running 2 channels of high voltage Digital Output
|
||||
* (PCM).
|
||||
@@ -55,3 +57,5 @@ class DoubleSolenoid : public SolenoidBase,
|
||||
|
||||
std::shared_ptr<ITable> m_table;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#include "RobotState.h"
|
||||
#include "SensorBase.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* Provide access to the network communication data to / from the Driver
|
||||
* Station.
|
||||
@@ -137,3 +139,5 @@ class DriverStation : public SensorBase, public RobotStateInterface {
|
||||
|
||||
double m_nextMessageTime = 0;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#include "PIDSource.h"
|
||||
#include "SensorBase.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class DigitalSource;
|
||||
class DigitalGlitchFilter;
|
||||
|
||||
@@ -105,3 +107,5 @@ class Encoder : public SensorBase,
|
||||
std::shared_ptr<ITable> m_table;
|
||||
friend class DigitalGlitchFilter;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -9,8 +9,12 @@
|
||||
|
||||
#include "HLUsageReporting.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
class HardwareHLReporting : public HLUsageReportingInterface {
|
||||
public:
|
||||
virtual void ReportScheduler();
|
||||
virtual void ReportSmartDashboard();
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "HAL/HAL.h"
|
||||
#include "LiveWindow/LiveWindow.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
static int kRegWrite = 0x0A;
|
||||
static int kRegRead = 0x0B;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include "LiveWindow/LiveWindow.h"
|
||||
#include "WPIErrors.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* Common function for initializing the accelerometer.
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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};
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "LiveWindow/LiveWindow.h"
|
||||
#include "WPIErrors.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* Construct an analog output on the given channel.
|
||||
*
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "ControllerPower.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* Construct an Analog Potentiometer object from a channel number.
|
||||
*
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "HAL/HAL.h"
|
||||
#include "WPIErrors.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* Constructor for an analog trigger given a channel number.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include "LiveWindow/LiveWindow.h"
|
||||
#include "WPIErrors.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#include "Utility.h"
|
||||
#include "WPIErrors.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
constexpr uint8_t CameraServer::kMagicNumber[];
|
||||
|
||||
CameraServer* CameraServer::GetInstance() {
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "HAL/HAL.h"
|
||||
#include "WPIErrors.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "HAL/HAL.h"
|
||||
#include "HAL/Power.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* Get the input voltage to the robot controller.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include "LiveWindow/LiveWindow.h"
|
||||
#include "WPIErrors.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* Create an instance of a Digital Input class.
|
||||
*
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "HAL/HAL.h"
|
||||
#include "WPIErrors.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* Create an instance of a digital output.
|
||||
*
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "LiveWindow/LiveWindow.h"
|
||||
#include "WPIErrors.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "LiveWindow/LiveWindow.h"
|
||||
#include "WPIErrors.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* Common initialization code for Encoders.
|
||||
*
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "LiveWindow/LiveWindow.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
constexpr double GearTooth::kGearToothThreshold;
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "HAL/HAL.h"
|
||||
#include "WPIErrors.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "HAL/HAL.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
void HardwareHLReporting::ReportScheduler() {
|
||||
HAL_Report(HALUsageReporting::kResourceType_Command,
|
||||
HALUsageReporting::kCommand_Scheduler);
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include "Utility.h"
|
||||
#include "WPIErrors.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
InterruptableSensorBase::InterruptableSensorBase() {}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#include "SmartDashboard/SmartDashboard.h"
|
||||
#include "networktables/NetworkTable.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* Provide an alternate "main loop" via StartCompetition().
|
||||
*
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "HAL/HAL.h"
|
||||
#include "LiveWindow/LiveWindow.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
/**
|
||||
* Constructor for a Jaguar connected via PWM.
|
||||
*
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user