mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-04 03:11: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:
@@ -56,6 +56,8 @@ 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>
|
||||
@@ -63,7 +65,12 @@ 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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user