Update formatting to clang-format 16 (#5370)

This commit is contained in:
Tyler Veness
2023-05-31 22:10:53 -07:00
committed by GitHub
parent a94a998002
commit 5fac18ff4a
48 changed files with 654 additions and 434 deletions

View File

@@ -1,111 +1,171 @@
---
Language: Cpp
BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignArrayOfStructures: None
AlignConsecutiveAssignments:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: true
AlignConsecutiveBitFields:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveDeclarations:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveMacros:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AlignOperands: Align
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Inline
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
AfterControlStatement: Never
AfterEnum: false
AfterExternBlock: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterAttributes: Always
BreakAfterJavaFieldAnnotations: false
BreakArrays: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: Always
BreakBeforeBraces: Attach
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^<.*\.h>'
Priority: 1
SortPriority: 0
CaseSensitive: false
- Regex: '^<.*'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 3
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '([-_](test|unittest))?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: true
IndentExternBlock: AfterExternBlock
IndentGotoLabels: true
IndentPPDirectives: None
IndentRequiresClause: true
IndentWidth: 2
IndentWrappedFunctionNames: false
InsertBraces: false
InsertNewlineAtEOF: false
InsertTrailingCommas: None
IntegerLiteralSeparator:
Binary: 0
BinaryMinDigits: 0
Decimal: 0
DecimalMinDigits: 0
Hex: 0
HexMinDigits: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
LambdaBodyIndentation: Signature
LineEnding: DeriveLF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: NextLine
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
PPIndentWidth: -1
QualifierAlignment: Leave
RawStringFormats:
- Language: Cpp
Delimiters:
@@ -132,34 +192,65 @@ RawStringFormats:
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
CanonicalDelimiter: ''
- ParseTestProto
- ParsePartialTestProto
CanonicalDelimiter: pb
BasedOnStyle: google
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SortIncludes: false
SortUsingDeclarations: true
SortJavaStaticImport: Before
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterOverloadedOperator: false
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: c++20
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseTab: Never
WhitespaceSensitiveMacros:
- BOOST_PP_STRINGIZE
- CF_SWIFT_NAME
- NS_SWIFT_NAME
- PP_STRINGIZE
- STRINGIZE
...

View File

@@ -35,7 +35,6 @@ Checks:
bugprone-unhandled-self-assignment,
bugprone-unused-raii,
bugprone-virtual-near-miss,
cert-dcl58-cpp,
cert-err52-cpp,
cert-err60-cpp,
cert-mem57-cpp,

View File

@@ -26,16 +26,10 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install clang-format
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo sh -c "echo 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-14 main' >> /etc/apt/sources.list.d/proposed-repositories.list"
sudo apt-get update -q
sudo apt-get install -y clang-format-14
- name: Install wpiformat
run: pip3 install wpiformat
- name: Run
run: wpiformat -clang 14
run: wpiformat
- name: Check output
run: git --no-pager diff --exit-code HEAD
- name: Generate diff
@@ -70,12 +64,6 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install clang-tidy
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo sh -c "echo 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-14 main' >> /etc/apt/sources.list.d/proposed-repositories.list"
sudo apt-get update -q
sudo apt-get install -y clang-tidy-14 clang-format-14
- name: Install wpiformat
run: pip3 install wpiformat
- name: Create compile_commands.json
@@ -83,7 +71,7 @@ jobs:
- name: List changed files
run: wpiformat -list-changed-files
- name: Run clang-tidy
run: wpiformat -clang 14 -no-format -tidy-changed -compile-commands=build/compile_commands/linuxx86-64 -vv
run: wpiformat -no-format -tidy-changed -compile-commands=build/compile_commands/linuxx86-64 -vv
javaformat:
name: "Java format"
runs-on: ubuntu-22.04

View File

@@ -62,7 +62,7 @@ On macOS ARM, run `softwareupdate --install-rosetta`. This is necessary to be ab
Clone the WPILib repository and follow the instructions above for installing any required tooling.
See the [styleguide README](https://github.com/wpilibsuite/styleguide/blob/main/README.md) for wpiformat setup instructions. We use clang-format 14.
See the [styleguide README](https://github.com/wpilibsuite/styleguide/blob/main/README.md) for wpiformat setup instructions.
## Building
@@ -120,7 +120,7 @@ Once a PR has been submitted, formatting can be run in CI by commenting `/format
#### wpiformat
wpiformat can be executed anywhere in the repository via `py -3 -m wpiformat -clang 14` on Windows or `python3 -m wpiformat -clang 14` on other platforms.
wpiformat can be executed anywhere in the repository via `py -3 -m wpiformat` on Windows or `python3 -m wpiformat` on other platforms.
#### Java Code Quality Tools

View File

@@ -22,9 +22,7 @@ class Image {
public:
#ifndef __linux__
explicit Image(size_t capacity) {
m_data.reserve(capacity);
}
explicit Image(size_t capacity) { m_data.reserve(capacity); }
#else
explicit Image(size_t capacity)
: m_data{capacity, default_init_allocator<uchar>{}} {
@@ -39,35 +37,19 @@ class Image {
operator std::string_view() const { // NOLINT
return str();
}
std::string_view str() const {
return {data(), size()};
}
size_t capacity() const {
return m_data.capacity();
}
std::string_view str() const { return {data(), size()}; }
size_t capacity() const { return m_data.capacity(); }
const char* data() const {
return reinterpret_cast<const char*>(m_data.data());
}
char* data() {
return reinterpret_cast<char*>(m_data.data());
}
size_t size() const {
return m_data.size();
}
char* data() { return reinterpret_cast<char*>(m_data.data()); }
size_t size() const { return m_data.size(); }
const std::vector<uchar>& vec() const {
return m_data;
}
std::vector<uchar>& vec() {
return m_data;
}
const std::vector<uchar>& vec() const { return m_data; }
std::vector<uchar>& vec() { return m_data; }
void resize(size_t size) {
m_data.resize(size);
}
void SetSize(size_t size) {
m_data.resize(size);
}
void resize(size_t size) { m_data.resize(size); }
void SetSize(size_t size) { m_data.resize(size); }
cv::Mat AsMat() {
int type;
@@ -90,9 +72,7 @@ class Image {
return cv::Mat{height, width, type, m_data.data()};
}
cv::_InputArray AsInputArray() {
return cv::_InputArray{m_data};
}
cv::_InputArray AsInputArray() { return cv::_InputArray{m_data}; }
bool Is(int width_, int height_) {
return width == width_ && height == height_;
@@ -114,12 +94,8 @@ class Image {
bool IsLarger(const Image& oth) {
return width >= oth.width && height >= oth.height;
}
bool IsSmaller(int width_, int height_) {
return !IsLarger(width_, height_);
}
bool IsSmaller(const Image& oth) {
return !IsLarger(oth);
}
bool IsSmaller(int width_, int height_) { return !IsLarger(width_, height_); }
bool IsSmaller(const Image& oth) { return !IsLarger(oth); }
private:
std::vector<uchar> m_data;

View File

@@ -152,8 +152,8 @@ class CvSink : public ImageSink {
* message); the frame time is in the same time base as wpi::Now(),
* and is in 1 us increments.
*/
[[nodiscard]] uint64_t GrabFrame(cv::Mat& image,
double timeout = 0.225) const;
[[nodiscard]]
uint64_t GrabFrame(cv::Mat& image, double timeout = 0.225) const;
/**
* Wait for the next frame and get the image. May block forever.
@@ -163,7 +163,8 @@ class CvSink : public ImageSink {
* message); the frame time is in the same time base as wpi::Now(),
* and is in 1 us increments.
*/
[[nodiscard]] uint64_t GrabFrameNoTimeout(cv::Mat& image) const;
[[nodiscard]]
uint64_t GrabFrameNoTimeout(cv::Mat& image) const;
};
inline CvSource::CvSource(std::string_view name, const VideoMode& mode) {

View File

@@ -174,8 +174,8 @@ class RawSink : public ImageSink {
* message); the frame time is in the same time base as wpi::Now(),
* and is in 1 us increments.
*/
[[nodiscard]] uint64_t GrabFrame(RawFrame& image,
double timeout = 0.225) const;
[[nodiscard]]
uint64_t GrabFrame(RawFrame& image, double timeout = 0.225) const;
/**
* Wait for the next frame and get the image. May block forever.
@@ -185,7 +185,8 @@ class RawSink : public ImageSink {
* message); the frame time is in the same time base as wpi::Now(),
* and is in 1 us increments.
*/
[[nodiscard]] uint64_t GrabFrameNoTimeout(RawFrame& image) const;
[[nodiscard]]
uint64_t GrabFrameNoTimeout(RawFrame& image) const;
};
inline RawSource::RawSource(std::string_view name, const VideoMode& mode) {

View File

@@ -111,7 +111,8 @@ class RawCvSink : public RawSink {
* message); the frame time is in the same time base as wpi::Now(),
* and is in 1 us increments.
*/
[[nodiscard]] uint64_t GrabFrame(cv::Mat& image, double timeout = 0.225);
[[nodiscard]]
uint64_t GrabFrame(cv::Mat& image, double timeout = 0.225);
/**
* Wait for the next frame and get the image. May block forever.
@@ -121,7 +122,8 @@ class RawCvSink : public RawSink {
* message); the frame time is in the same time base as wpi::Now(),
* and is in 1 us increments.
*/
[[nodiscard]] uint64_t GrabFrameNoTimeout(cv::Mat& image);
[[nodiscard]]
uint64_t GrabFrameNoTimeout(cv::Mat& image);
/**
* Wait for the next frame and get the image.
@@ -132,8 +134,8 @@ class RawCvSink : public RawSink {
* message); the frame time is in the same time base as wpi::Now(),
* and is in 1 us increments.
*/
[[nodiscard]] uint64_t GrabFrameDirect(cv::Mat& image,
double timeout = 0.225);
[[nodiscard]]
uint64_t GrabFrameDirect(cv::Mat& image, double timeout = 0.225);
/**
* Wait for the next frame and get the image. May block forever.
@@ -143,7 +145,8 @@ class RawCvSink : public RawSink {
* message); the frame time is in the same time base as wpi::Now(),
* and is in 1 us increments.
*/
[[nodiscard]] uint64_t GrabFrameNoTimeoutDirect(cv::Mat& image);
[[nodiscard]]
uint64_t GrabFrameNoTimeoutDirect(cv::Mat& image);
private:
RawFrame rawFrame;

View File

@@ -8,7 +8,8 @@
namespace hal {
namespace init {
[[nodiscard]] int InitializeFPGA();
[[nodiscard]]
int InitializeFPGA();
} // namespace init
using HAL_NiFpga_ReserveIrqContextFunc =

View File

@@ -50,14 +50,16 @@ class ListenerStorage final : public IListenerStorage {
NT_ListenerPoller CreateListenerPoller();
// returns listener handle and mask for each listener that was destroyed
[[nodiscard]] std::vector<std::pair<NT_Listener, unsigned int>>
DestroyListenerPoller(NT_ListenerPoller pollerHandle);
[[nodiscard]]
std::vector<std::pair<NT_Listener, unsigned int>> DestroyListenerPoller(
NT_ListenerPoller pollerHandle);
std::vector<Event> ReadListenerQueue(NT_ListenerPoller pollerHandle);
// returns listener handle and mask for each listener that was destroyed
[[nodiscard]] std::vector<std::pair<NT_Listener, unsigned int>>
RemoveListener(NT_Listener listenerHandle);
[[nodiscard]]
std::vector<std::pair<NT_Listener, unsigned int>> RemoveListener(
NT_Listener listenerHandle);
bool WaitForListenerQueue(double timeout);

View File

@@ -169,7 +169,8 @@ class Topic {
* @param options subscribe options
* @return subscriber
*/
[[nodiscard]] GenericSubscriber GenericSubscribe(
[[nodiscard]]
GenericSubscriber GenericSubscribe(
const PubSubOptions& options = kDefaultPubSubOptions);
/**
@@ -186,7 +187,8 @@ class Topic {
* @param options subscribe options
* @return subscriber
*/
[[nodiscard]] GenericSubscriber GenericSubscribe(
[[nodiscard]]
GenericSubscriber GenericSubscribe(
std::string_view typeString,
const PubSubOptions& options = kDefaultPubSubOptions);
@@ -206,7 +208,8 @@ class Topic {
* @param options publish options
* @return publisher
*/
[[nodiscard]] GenericPublisher GenericPublish(
[[nodiscard]]
GenericPublisher GenericPublish(
std::string_view typeString,
const PubSubOptions& options = kDefaultPubSubOptions);
@@ -228,7 +231,8 @@ class Topic {
* @param options publish options
* @return publisher
*/
[[nodiscard]] GenericPublisher GenericPublishEx(
[[nodiscard]]
GenericPublisher GenericPublishEx(
std::string_view typeString, const wpi::json& properties,
const PubSubOptions& options = kDefaultPubSubOptions);
@@ -250,7 +254,8 @@ class Topic {
* @param options publish and/or subscribe options
* @return entry
*/
[[nodiscard]] GenericEntry GetGenericEntry(
[[nodiscard]]
GenericEntry GetGenericEntry(
const PubSubOptions& options = kDefaultPubSubOptions);
/**
@@ -272,7 +277,8 @@ class Topic {
* @param options publish and/or subscribe options
* @return entry
*/
[[nodiscard]] GenericEntry GetGenericEntry(
[[nodiscard]]
GenericEntry GetGenericEntry(
std::string_view typeString,
const PubSubOptions& options = kDefaultPubSubOptions);

View File

@@ -295,7 +295,8 @@ class UnitTopic final : public Topic {
* @param options subscribe options
* @return subscriber
*/
[[nodiscard]] SubscriberType Subscribe(
[[nodiscard]]
SubscriberType Subscribe(
ParamType defaultValue,
const PubSubOptions& options = kDefaultPubSubOptions);
@@ -315,7 +316,8 @@ class UnitTopic final : public Topic {
* @param options subscribe options
* @return subscriber
*/
[[nodiscard]] SubscriberType SubscribeEx(
[[nodiscard]]
SubscriberType SubscribeEx(
std::string_view typeString, ParamType defaultValue,
const PubSubOptions& options = kDefaultPubSubOptions);
@@ -334,8 +336,8 @@ class UnitTopic final : public Topic {
* @param options publish options
* @return publisher
*/
[[nodiscard]] PublisherType Publish(
const PubSubOptions& options = kDefaultPubSubOptions);
[[nodiscard]]
PublisherType Publish(const PubSubOptions& options = kDefaultPubSubOptions);
/**
* Create a new publisher to the topic, with type string and initial
@@ -355,9 +357,10 @@ class UnitTopic final : public Topic {
* @param options publish options
* @return publisher
*/
[[nodiscard]] PublisherType PublishEx(
std::string_view typeString, const wpi::json& properties,
const PubSubOptions& options = kDefaultPubSubOptions);
[[nodiscard]]
PublisherType PublishEx(std::string_view typeString,
const wpi::json& properties,
const PubSubOptions& options = kDefaultPubSubOptions);
/**
* Create a new entry for the topic.
@@ -379,9 +382,9 @@ class UnitTopic final : public Topic {
* @param options publish and/or subscribe options
* @return entry
*/
[[nodiscard]] EntryType GetEntry(
ParamType defaultValue,
const PubSubOptions& options = kDefaultPubSubOptions);
[[nodiscard]]
EntryType GetEntry(ParamType defaultValue,
const PubSubOptions& options = kDefaultPubSubOptions);
/**
* Create a new entry for the topic, with specific type string.
@@ -404,9 +407,9 @@ class UnitTopic final : public Topic {
* @param options publish and/or subscribe options
* @return entry
*/
[[nodiscard]] EntryType GetEntryEx(
std::string_view typeString, ParamType defaultValue,
const PubSubOptions& options = kDefaultPubSubOptions);
[[nodiscard]]
EntryType GetEntryEx(std::string_view typeString, ParamType defaultValue,
const PubSubOptions& options = kDefaultPubSubOptions);
};
} // namespace nt

View File

@@ -57,9 +57,13 @@
HALSIM_Cancel##cbname##Callback(m_index, m_callback); \
} \
\
int32_t GetIndex() const { return m_index; } \
int32_t GetIndex() const { \
return m_index; \
} \
\
int GetChannel() const { return m_channel; } \
int GetChannel() const { \
return m_channel; \
} \
\
private: \
static void CallbackFunc(const char*, void* param, \
@@ -96,9 +100,13 @@
HALSIM_Cancel##cbname##Callback(m_index, m_channel, m_callback); \
} \
\
int32_t GetIndex() const { return m_index; } \
int32_t GetIndex() const { \
return m_index; \
} \
\
int32_t GetChannel() const { return m_channel; } \
int32_t GetChannel() const { \
return m_channel; \
} \
\
private: \
static void CallbackFunc(const char*, void* param, \

View File

@@ -124,7 +124,8 @@ class Command {
* @param duration the timeout duration
* @return the command with the timeout added
*/
[[nodiscard]] CommandPtr WithTimeout(units::second_t duration) &&;
[[nodiscard]]
CommandPtr WithTimeout(units::second_t duration) &&;
/**
* Decorates this command with an interrupt condition. If the specified
@@ -135,7 +136,8 @@ class Command {
* @param condition the interrupt condition
* @return the command with the interrupt condition added
*/
[[nodiscard]] CommandPtr Until(std::function<bool()> condition) &&;
[[nodiscard]]
CommandPtr Until(std::function<bool()> condition) &&;
/**
* Decorates this command with a run condition. If the specified condition
@@ -146,7 +148,8 @@ class Command {
* @param condition the interrupt condition
* @return the command with the interrupt condition added
*/
[[nodiscard]] CommandPtr OnlyWhile(std::function<bool()> condition) &&;
[[nodiscard]]
CommandPtr OnlyWhile(std::function<bool()> condition) &&;
/**
* Decorates this command with an interrupt condition. If the specified
@@ -159,7 +162,8 @@ class Command {
* @deprecated Replace with Until()
*/
WPI_DEPRECATED("Replace with Until()")
[[nodiscard]] CommandPtr WithInterrupt(std::function<bool()> condition) &&;
[[nodiscard]]
CommandPtr WithInterrupt(std::function<bool()> condition) &&;
/**
* Decorates this command with a runnable to run before this command starts.
@@ -168,9 +172,9 @@ class Command {
* @param requirements the required subsystems
* @return the decorated command
*/
[[nodiscard]] CommandPtr BeforeStarting(
std::function<void()> toRun,
std::initializer_list<Subsystem*> requirements) &&;
[[nodiscard]]
CommandPtr BeforeStarting(std::function<void()> toRun,
std::initializer_list<Subsystem*> requirements) &&;
/**
* Decorates this command with a runnable to run before this command starts.
@@ -179,9 +183,9 @@ class Command {
* @param requirements the required subsystems
* @return the decorated command
*/
[[nodiscard]] CommandPtr BeforeStarting(
std::function<void()> toRun,
std::span<Subsystem* const> requirements = {}) &&;
[[nodiscard]]
CommandPtr BeforeStarting(std::function<void()> toRun,
std::span<Subsystem* const> requirements = {}) &&;
/**
* Decorates this command with a runnable to run after the command finishes.
@@ -190,9 +194,9 @@ class Command {
* @param requirements the required subsystems
* @return the decorated command
*/
[[nodiscard]] CommandPtr AndThen(
std::function<void()> toRun,
std::initializer_list<Subsystem*> requirements) &&;
[[nodiscard]]
CommandPtr AndThen(std::function<void()> toRun,
std::initializer_list<Subsystem*> requirements) &&;
/**
* Decorates this command with a runnable to run after the command finishes.
@@ -201,9 +205,9 @@ class Command {
* @param requirements the required subsystems
* @return the decorated command
*/
[[nodiscard]] CommandPtr AndThen(
std::function<void()> toRun,
std::span<Subsystem* const> requirements = {}) &&;
[[nodiscard]]
CommandPtr AndThen(std::function<void()> toRun,
std::span<Subsystem* const> requirements = {}) &&;
/**
* Decorates this command to run perpetually, ignoring its ordinary end
@@ -231,7 +235,8 @@ safe) semantics.
*
* @return the decorated command
*/
[[nodiscard]] CommandPtr Repeatedly() &&;
[[nodiscard]]
CommandPtr Repeatedly() &&;
/**
* Decorates this command to run "by proxy" by wrapping it in a
@@ -243,7 +248,8 @@ safe) semantics.
*
* @return the decorated command
*/
[[nodiscard]] CommandPtr AsProxy() &&;
[[nodiscard]]
CommandPtr AsProxy() &&;
/**
* Decorates this command to only run if this condition is not met. If the
@@ -254,7 +260,8 @@ safe) semantics.
* @param condition the condition that will prevent the command from running
* @return the decorated command
*/
[[nodiscard]] CommandPtr Unless(std::function<bool()> condition) &&;
[[nodiscard]]
CommandPtr Unless(std::function<bool()> condition) &&;
/**
* Decorates this command to only run if this condition is met. If the command
@@ -265,7 +272,8 @@ safe) semantics.
* @param condition the condition that will allow the command to run
* @return the decorated command
*/
[[nodiscard]] CommandPtr OnlyIf(std::function<bool()> condition) &&;
[[nodiscard]]
CommandPtr OnlyIf(std::function<bool()> condition) &&;
/**
* Decorates this command to run or stop when disabled.
@@ -273,7 +281,8 @@ safe) semantics.
* @param doesRunWhenDisabled true to run when disabled.
* @return the decorated command
*/
[[nodiscard]] CommandPtr IgnoringDisable(bool doesRunWhenDisabled) &&;
[[nodiscard]]
CommandPtr IgnoringDisable(bool doesRunWhenDisabled) &&;
/**
* Decorates this command to run or stop when disabled.
@@ -281,7 +290,8 @@ safe) semantics.
* @param interruptBehavior true to run when disabled.
* @return the decorated command
*/
[[nodiscard]] CommandPtr WithInterruptBehavior(
[[nodiscard]]
CommandPtr WithInterruptBehavior(
Command::InterruptionBehavior interruptBehavior) &&;
/**
@@ -292,7 +302,8 @@ safe) semantics.
* command was interrupted.
* @return the decorated command
*/
[[nodiscard]] CommandPtr FinallyDo(std::function<void(bool)> end) &&;
[[nodiscard]]
CommandPtr FinallyDo(std::function<void(bool)> end) &&;
/**
* Decorates this command with a lambda to call on interrupt, following the
@@ -301,7 +312,8 @@ safe) semantics.
* @param handler a lambda to run when the command is interrupted
* @return the decorated command
*/
[[nodiscard]] CommandPtr HandleInterrupt(std::function<void()> handler) &&;
[[nodiscard]]
CommandPtr HandleInterrupt(std::function<void()> handler) &&;
/**
* Decorates this Command with a name.
@@ -309,7 +321,8 @@ safe) semantics.
* @param name name
* @return the decorated Command
*/
[[nodiscard]] CommandPtr WithName(std::string_view name) &&;
[[nodiscard]]
CommandPtr WithName(std::string_view name) &&;
/**
* Schedules this command.

View File

@@ -45,7 +45,8 @@ class CommandPtr final {
*
* @return the decorated command
*/
[[nodiscard]] CommandPtr Repeatedly() &&;
[[nodiscard]]
CommandPtr Repeatedly() &&;
/**
* Decorates this command to run "by proxy" by wrapping it in a
@@ -55,7 +56,8 @@ class CommandPtr final {
*
* @return the decorated command
*/
[[nodiscard]] CommandPtr AsProxy() &&;
[[nodiscard]]
CommandPtr AsProxy() &&;
/**
* Decorates this command to run or stop when disabled.
@@ -63,7 +65,8 @@ class CommandPtr final {
* @param doesRunWhenDisabled true to run when disabled.
* @return the decorated command
*/
[[nodiscard]] CommandPtr IgnoringDisable(bool doesRunWhenDisabled) &&;
[[nodiscard]]
CommandPtr IgnoringDisable(bool doesRunWhenDisabled) &&;
/**
* Decorates this command to run or stop when disabled.
@@ -71,7 +74,8 @@ class CommandPtr final {
* @param interruptBehavior true to run when disabled.
* @return the decorated command
*/
[[nodiscard]] CommandPtr WithInterruptBehavior(
[[nodiscard]]
CommandPtr WithInterruptBehavior(
Command::InterruptionBehavior interruptBehavior) &&;
/**
@@ -81,9 +85,9 @@ class CommandPtr final {
* @param requirements the required subsystems
* @return the decorated command
*/
[[nodiscard]] CommandPtr AndThen(
std::function<void()> toRun,
std::span<Subsystem* const> requirements = {}) &&;
[[nodiscard]]
CommandPtr AndThen(std::function<void()> toRun,
std::span<Subsystem* const> requirements = {}) &&;
/**
* Decorates this command with a runnable to run after the command finishes.
@@ -92,9 +96,9 @@ class CommandPtr final {
* @param requirements the required subsystems
* @return the decorated command
*/
[[nodiscard]] CommandPtr AndThen(
std::function<void()> toRun,
std::initializer_list<Subsystem*> requirements) &&;
[[nodiscard]]
CommandPtr AndThen(std::function<void()> toRun,
std::initializer_list<Subsystem*> requirements) &&;
/**
* Decorates this command with a set of commands to run after it in sequence.
@@ -104,7 +108,8 @@ class CommandPtr final {
* @param next the commands to run next
* @return the decorated command
*/
[[nodiscard]] CommandPtr AndThen(CommandPtr&& next) &&;
[[nodiscard]]
CommandPtr AndThen(CommandPtr&& next) &&;
/**
* Decorates this command with a runnable to run before this command starts.
@@ -113,9 +118,9 @@ class CommandPtr final {
* @param requirements the required subsystems
* @return the decorated command
*/
[[nodiscard]] CommandPtr BeforeStarting(
std::function<void()> toRun,
std::initializer_list<Subsystem*> requirements) &&;
[[nodiscard]]
CommandPtr BeforeStarting(std::function<void()> toRun,
std::initializer_list<Subsystem*> requirements) &&;
/**
* Decorates this command with a runnable to run before this command starts.
@@ -124,9 +129,9 @@ class CommandPtr final {
* @param requirements the required subsystems
* @return the decorated command
*/
[[nodiscard]] CommandPtr BeforeStarting(
std::function<void()> toRun,
std::span<Subsystem* const> requirements = {}) &&;
[[nodiscard]]
CommandPtr BeforeStarting(std::function<void()> toRun,
std::span<Subsystem* const> requirements = {}) &&;
/**
* Decorates this command with another command to run before this command
@@ -135,7 +140,8 @@ class CommandPtr final {
* @param before the command to run before this one
* @return the decorated command
*/
[[nodiscard]] CommandPtr BeforeStarting(CommandPtr&& before) &&;
[[nodiscard]]
CommandPtr BeforeStarting(CommandPtr&& before) &&;
/**
* Decorates this command with a timeout. If the specified timeout is
@@ -146,7 +152,8 @@ class CommandPtr final {
* @param duration the timeout duration
* @return the command with the timeout added
*/
[[nodiscard]] CommandPtr WithTimeout(units::second_t duration) &&;
[[nodiscard]]
CommandPtr WithTimeout(units::second_t duration) &&;
/**
* Decorates this command with an interrupt condition. If the specified
@@ -157,7 +164,8 @@ class CommandPtr final {
* @param condition the interrupt condition
* @return the command with the interrupt condition added
*/
[[nodiscard]] CommandPtr Until(std::function<bool()> condition) &&;
[[nodiscard]]
CommandPtr Until(std::function<bool()> condition) &&;
/**
* Decorates this command with a run condition. If the specified condition
@@ -168,7 +176,8 @@ class CommandPtr final {
* @param condition the interrupt condition
* @return the command with the interrupt condition added
*/
[[nodiscard]] CommandPtr OnlyWhile(std::function<bool()> condition) &&;
[[nodiscard]]
CommandPtr OnlyWhile(std::function<bool()> condition) &&;
/**
* Decorates this command to only run if this condition is not met. If the
@@ -179,7 +188,8 @@ class CommandPtr final {
* @param condition the condition that will prevent the command from running
* @return the decorated command
*/
[[nodiscard]] CommandPtr Unless(std::function<bool()> condition) &&;
[[nodiscard]]
CommandPtr Unless(std::function<bool()> condition) &&;
/**
* Decorates this command to only run if this condition is met. If the command
@@ -190,7 +200,8 @@ class CommandPtr final {
* @param condition the condition that will allow the command to run
* @return the decorated command
*/
[[nodiscard]] CommandPtr OnlyIf(std::function<bool()> condition) &&;
[[nodiscard]]
CommandPtr OnlyIf(std::function<bool()> condition) &&;
/**
* Decorates this command with a set of commands to run parallel to it, ending
@@ -201,7 +212,8 @@ class CommandPtr final {
* @param parallel the commands to run in parallel
* @return the decorated command
*/
[[nodiscard]] CommandPtr DeadlineWith(CommandPtr&& parallel) &&;
[[nodiscard]]
CommandPtr DeadlineWith(CommandPtr&& parallel) &&;
/**
* Decorates this command with a set of commands to run parallel to it, ending
@@ -211,7 +223,8 @@ class CommandPtr final {
* @param parallel the commands to run in parallel
* @return the decorated command
*/
[[nodiscard]] CommandPtr AlongWith(CommandPtr&& parallel) &&;
[[nodiscard]]
CommandPtr AlongWith(CommandPtr&& parallel) &&;
/**
* Decorates this command with a set of commands to run parallel to it, ending
@@ -221,7 +234,8 @@ class CommandPtr final {
* @param parallel the commands to run in parallel
* @return the decorated command
*/
[[nodiscard]] CommandPtr RaceWith(CommandPtr&& parallel) &&;
[[nodiscard]]
CommandPtr RaceWith(CommandPtr&& parallel) &&;
/**
* Decorates this command with a lambda to call on interrupt or end, following
@@ -231,7 +245,8 @@ class CommandPtr final {
* command was interrupted.
* @return the decorated command
*/
[[nodiscard]] CommandPtr FinallyDo(std::function<void(bool)> end) &&;
[[nodiscard]]
CommandPtr FinallyDo(std::function<void(bool)> end) &&;
/**
* Decorates this command with a lambda to call on interrupt, following the
@@ -240,7 +255,8 @@ class CommandPtr final {
* @param handler a lambda to run when the command is interrupted
* @return the decorated command
*/
[[nodiscard]] CommandPtr HandleInterrupt(std::function<void()> handler) &&;
[[nodiscard]]
CommandPtr HandleInterrupt(std::function<void()> handler) &&;
/**
* Decorates this Command with a name. Is an inline function for
@@ -249,7 +265,8 @@ class CommandPtr final {
* @param name name
* @return the decorated Command
*/
[[nodiscard]] CommandPtr WithName(std::string_view name) &&;
[[nodiscard]]
CommandPtr WithName(std::string_view name) &&;
/**
* Get a raw pointer to the held command.

View File

@@ -27,7 +27,8 @@ namespace cmd {
/**
* Constructs a command that does nothing, finishing immediately.
*/
[[nodiscard]] CommandPtr None();
[[nodiscard]]
CommandPtr None();
// Action Commands
@@ -37,9 +38,9 @@ namespace cmd {
* @param action the action to run
* @param requirements subsystems the action requires
*/
[[nodiscard]] CommandPtr RunOnce(
std::function<void()> action,
std::initializer_list<Subsystem*> requirements);
[[nodiscard]]
CommandPtr RunOnce(std::function<void()> action,
std::initializer_list<Subsystem*> requirements);
/**
* Constructs a command that runs an action once and finishes.
@@ -47,8 +48,9 @@ namespace cmd {
* @param action the action to run
* @param requirements subsystems the action requires
*/
[[nodiscard]] CommandPtr RunOnce(std::function<void()> action,
std::span<Subsystem* const> requirements = {});
[[nodiscard]]
CommandPtr RunOnce(std::function<void()> action,
std::span<Subsystem* const> requirements = {});
/**
* Constructs a command that runs an action every iteration until interrupted.
@@ -56,8 +58,9 @@ namespace cmd {
* @param action the action to run
* @param requirements subsystems the action requires
*/
[[nodiscard]] CommandPtr Run(std::function<void()> action,
std::initializer_list<Subsystem*> requirements);
[[nodiscard]]
CommandPtr Run(std::function<void()> action,
std::initializer_list<Subsystem*> requirements);
/**
* Constructs a command that runs an action every iteration until interrupted.
@@ -65,8 +68,9 @@ namespace cmd {
* @param action the action to run
* @param requirements subsystems the action requires
*/
[[nodiscard]] CommandPtr Run(std::function<void()> action,
std::span<Subsystem* const> requirements = {});
[[nodiscard]]
CommandPtr Run(std::function<void()> action,
std::span<Subsystem* const> requirements = {});
/**
* Constructs a command that runs an action once and another action when the
@@ -76,9 +80,9 @@ namespace cmd {
* @param end the action to run on interrupt
* @param requirements subsystems the action requires
*/
[[nodiscard]] CommandPtr StartEnd(
std::function<void()> start, std::function<void()> end,
std::initializer_list<Subsystem*> requirements);
[[nodiscard]]
CommandPtr StartEnd(std::function<void()> start, std::function<void()> end,
std::initializer_list<Subsystem*> requirements);
/**
* Constructs a command that runs an action once and another action when the
@@ -88,9 +92,9 @@ namespace cmd {
* @param end the action to run on interrupt
* @param requirements subsystems the action requires
*/
[[nodiscard]] CommandPtr StartEnd(
std::function<void()> start, std::function<void()> end,
std::span<Subsystem* const> requirements = {});
[[nodiscard]]
CommandPtr StartEnd(std::function<void()> start, std::function<void()> end,
std::span<Subsystem* const> requirements = {});
/**
* Constructs a command that runs an action every iteration until interrupted,
@@ -100,9 +104,9 @@ namespace cmd {
* @param end the action to run on interrupt
* @param requirements subsystems the action requires
*/
[[nodiscard]] CommandPtr RunEnd(std::function<void()> run,
std::function<void()> end,
std::initializer_list<Subsystem*> requirements);
[[nodiscard]]
CommandPtr RunEnd(std::function<void()> run, std::function<void()> end,
std::initializer_list<Subsystem*> requirements);
/**
* Constructs a command that runs an action every iteration until interrupted,
@@ -112,16 +116,17 @@ namespace cmd {
* @param end the action to run on interrupt
* @param requirements subsystems the action requires
*/
[[nodiscard]] CommandPtr RunEnd(std::function<void()> run,
std::function<void()> end,
std::span<Subsystem* const> requirements = {});
[[nodiscard]]
CommandPtr RunEnd(std::function<void()> run, std::function<void()> end,
std::span<Subsystem* const> requirements = {});
/**
* Constructs a command that prints a message and finishes.
*
* @param msg the message to print
*/
[[nodiscard]] CommandPtr Print(std::string_view msg);
[[nodiscard]]
CommandPtr Print(std::string_view msg);
// Idling Commands
@@ -130,7 +135,8 @@ namespace cmd {
*
* @param duration after how long the command finishes
*/
[[nodiscard]] CommandPtr Wait(units::second_t duration);
[[nodiscard]]
CommandPtr Wait(units::second_t duration);
/**
* Constructs a command that does nothing, finishing once a condition becomes
@@ -138,7 +144,8 @@ namespace cmd {
*
* @param condition the condition
*/
[[nodiscard]] CommandPtr WaitUntil(std::function<bool()> condition);
[[nodiscard]]
CommandPtr WaitUntil(std::function<bool()> condition);
// Selector Commands
@@ -149,8 +156,9 @@ namespace cmd {
* @param onFalse the command to run if the selector function returns false
* @param selector the selector function
*/
[[nodiscard]] CommandPtr Either(CommandPtr&& onTrue, CommandPtr&& onFalse,
std::function<bool()> selector);
[[nodiscard]]
CommandPtr Either(CommandPtr&& onTrue, CommandPtr&& onFalse,
std::function<bool()> selector);
/**
* Runs one of several commands, based on the selector function.
@@ -159,8 +167,9 @@ namespace cmd {
* @param commands map of commands to select from
*/
template <typename Key, class... Types>
[[nodiscard]] CommandPtr Select(std::function<Key()> selector,
std::pair<Key, Types>&&... commands) {
[[nodiscard]]
CommandPtr Select(std::function<Key()> selector,
std::pair<Key, Types>&&... commands) {
std::vector<std::pair<Key, std::unique_ptr<Command>>> vec;
((void)vec.emplace_back(commands.first, std::move(commands.second).Unwrap()),
@@ -189,13 +198,15 @@ std::vector<CommandPtr> MakeVector(Args&&... args) {
/**
* Runs a group of commands in series, one after the other.
*/
[[nodiscard]] CommandPtr Sequence(std::vector<CommandPtr>&& commands);
[[nodiscard]]
CommandPtr Sequence(std::vector<CommandPtr>&& commands);
/**
* Runs a group of commands in series, one after the other.
*/
template <typename... Args>
[[nodiscard]] CommandPtr Sequence(Args&&... commands) {
[[nodiscard]]
CommandPtr Sequence(Args&&... commands) {
return Sequence(impl::MakeVector(std::forward<Args>(commands)...));
}
@@ -203,14 +214,16 @@ template <typename... Args>
* Runs a group of commands in series, one after the other. Once the last
* command ends, the group is restarted.
*/
[[nodiscard]] CommandPtr RepeatingSequence(std::vector<CommandPtr>&& commands);
[[nodiscard]]
CommandPtr RepeatingSequence(std::vector<CommandPtr>&& commands);
/**
* Runs a group of commands in series, one after the other. Once the last
* command ends, the group is restarted.
*/
template <typename... Args>
[[nodiscard]] CommandPtr RepeatingSequence(Args&&... commands) {
[[nodiscard]]
CommandPtr RepeatingSequence(Args&&... commands) {
return RepeatingSequence(impl::MakeVector(std::forward<Args>(commands)...));
}
@@ -218,14 +231,16 @@ template <typename... Args>
* Runs a group of commands at the same time. Ends once all commands in the
* group finish.
*/
[[nodiscard]] CommandPtr Parallel(std::vector<CommandPtr>&& commands);
[[nodiscard]]
CommandPtr Parallel(std::vector<CommandPtr>&& commands);
/**
* Runs a group of commands at the same time. Ends once all commands in the
* group finish.
*/
template <typename... Args>
[[nodiscard]] CommandPtr Parallel(Args&&... commands) {
[[nodiscard]]
CommandPtr Parallel(Args&&... commands) {
return Parallel(impl::MakeVector(std::forward<Args>(commands)...));
}
@@ -233,14 +248,16 @@ template <typename... Args>
* Runs a group of commands at the same time. Ends once any command in the group
* finishes, and cancels the others.
*/
[[nodiscard]] CommandPtr Race(std::vector<CommandPtr>&& commands);
[[nodiscard]]
CommandPtr Race(std::vector<CommandPtr>&& commands);
/**
* Runs a group of commands at the same time. Ends once any command in the group
* finishes, and cancels the others.
*/
template <typename... Args>
[[nodiscard]] CommandPtr Race(Args&&... commands) {
[[nodiscard]]
CommandPtr Race(Args&&... commands) {
return Race(impl::MakeVector(std::forward<Args>(commands)...));
}
@@ -248,15 +265,16 @@ template <typename... Args>
* Runs a group of commands at the same time. Ends once a specific command
* finishes, and cancels the others.
*/
[[nodiscard]] CommandPtr Deadline(CommandPtr&& deadline,
std::vector<CommandPtr>&& others);
[[nodiscard]]
CommandPtr Deadline(CommandPtr&& deadline, std::vector<CommandPtr>&& others);
/**
* Runs a group of commands at the same time. Ends once a specific command
* finishes, and cancels the others.
*/
template <typename... Args>
[[nodiscard]] CommandPtr Deadline(CommandPtr&& deadline, Args&&... commands) {
[[nodiscard]]
CommandPtr Deadline(CommandPtr&& deadline, Args&&... commands) {
return Deadline(std::move(deadline),
impl::MakeVector(std::forward<Args>(commands)...));
}

View File

@@ -117,7 +117,8 @@ class Subsystem {
*
* @param action the action to run
*/
[[nodiscard]] CommandPtr RunOnce(std::function<void()> action);
[[nodiscard]]
CommandPtr RunOnce(std::function<void()> action);
/**
* Constructs a command that runs an action every iteration until interrupted.
@@ -125,7 +126,8 @@ class Subsystem {
*
* @param action the action to run
*/
[[nodiscard]] CommandPtr Run(std::function<void()> action);
[[nodiscard]]
CommandPtr Run(std::function<void()> action);
/**
* Constructs a command that runs an action once and another action when the
@@ -134,8 +136,8 @@ class Subsystem {
* @param start the action to run on start
* @param end the action to run on interrupt
*/
[[nodiscard]] CommandPtr StartEnd(std::function<void()> start,
std::function<void()> end);
[[nodiscard]]
CommandPtr StartEnd(std::function<void()> start, std::function<void()> end);
/**
* Constructs a command that runs an action every iteration until interrupted,
@@ -144,7 +146,7 @@ class Subsystem {
* @param run the action to run every iteration
* @param end the action to run on interrupt
*/
[[nodiscard]] CommandPtr RunEnd(std::function<void()> run,
std::function<void()> end);
[[nodiscard]]
CommandPtr RunEnd(std::function<void()> run, std::function<void()> end);
};
} // namespace frc2

View File

@@ -95,15 +95,16 @@ inline void ReportError(int32_t status, const char* fileName, int lineNumber,
* @param[in] args error message format args
* @return runtime error object
*/
[[nodiscard]] RuntimeError MakeErrorV(int32_t status, const char* fileName,
int lineNumber, const char* funcName,
fmt::string_view format,
fmt::format_args args);
[[nodiscard]]
RuntimeError MakeErrorV(int32_t status, const char* fileName, int lineNumber,
const char* funcName, fmt::string_view format,
fmt::format_args args);
template <typename... Args>
[[nodiscard]] inline RuntimeError MakeError(
int32_t status, const char* fileName, int lineNumber, const char* funcName,
fmt::string_view format, Args&&... args) {
[[nodiscard]]
inline RuntimeError MakeError(int32_t status, const char* fileName,
int lineNumber, const char* funcName,
fmt::string_view format, Args&&... args) {
return MakeErrorV(status, fileName, lineNumber, funcName, format,
fmt::make_format_args(args...));
}

View File

@@ -227,9 +227,7 @@ class RobotBase {
*
* @return If the robot is running in simulation.
*/
static constexpr bool IsSimulation() {
return !IsReal();
}
static constexpr bool IsSimulation() { return !IsReal(); }
/**
* Constructor for a generic robot program.

View File

@@ -60,7 +60,8 @@ class AddressableLEDSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object storing this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterInitializedCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterInitializedCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -85,7 +86,8 @@ class AddressableLEDSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterOutputPortCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterOutputPortCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -110,8 +112,9 @@ class AddressableLEDSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterLengthCallback(
NotifyCallback callback, bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterLengthCallback(NotifyCallback callback,
bool initialNotify);
/**
* Get the length of the LED strip.
@@ -135,7 +138,8 @@ class AddressableLEDSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterRunningCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterRunningCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -160,7 +164,8 @@ class AddressableLEDSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterDataCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterDataCallback(
ConstBufferCallback callback, bool initialNotify);
/**

View File

@@ -40,8 +40,9 @@ class AnalogGyroSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterAngleCallback(
NotifyCallback callback, bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterAngleCallback(NotifyCallback callback,
bool initialNotify);
/**
* Get the current angle of the gyro.
@@ -64,8 +65,9 @@ class AnalogGyroSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterRateCallback(
NotifyCallback callback, bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterRateCallback(NotifyCallback callback,
bool initialNotify);
/**
* Get the rate of angle change on this gyro.
@@ -89,7 +91,8 @@ class AnalogGyroSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterInitializedCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterInitializedCallback(
NotifyCallback callback, bool initialNotify);
/**

View File

@@ -41,7 +41,8 @@ class AnalogInputSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterInitializedCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterInitializedCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -66,7 +67,8 @@ class AnalogInputSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterAverageBitsCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterAverageBitsCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -91,7 +93,8 @@ class AnalogInputSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterOversampleBitsCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterOversampleBitsCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -116,7 +119,8 @@ class AnalogInputSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterVoltageCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterVoltageCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -141,9 +145,9 @@ class AnalogInputSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore>
RegisterAccumulatorInitializedCallback(NotifyCallback callback,
bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterAccumulatorInitializedCallback(
NotifyCallback callback, bool initialNotify);
/**
* Check if the accumulator has been initialized.
@@ -167,7 +171,8 @@ class AnalogInputSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterAccumulatorValueCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterAccumulatorValueCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -192,7 +197,8 @@ class AnalogInputSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterAccumulatorCountCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterAccumulatorCountCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -217,9 +223,9 @@ class AnalogInputSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore>
RegisterAccumulatorCenterCallback(NotifyCallback callback,
bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterAccumulatorCenterCallback(
NotifyCallback callback, bool initialNotify);
/**
* Get the accumulator center.
@@ -243,9 +249,9 @@ class AnalogInputSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore>
RegisterAccumulatorDeadbandCallback(NotifyCallback callback,
bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterAccumulatorDeadbandCallback(
NotifyCallback callback, bool initialNotify);
/**
* Get the accumulator deadband.

View File

@@ -40,7 +40,8 @@ class AnalogOutputSim {
* @param initialNotify whether to call the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterVoltageCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterVoltageCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -64,7 +65,8 @@ class AnalogOutputSim {
* @param initialNotify whether to run the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterInitializedCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterInitializedCallback(
NotifyCallback callback, bool initialNotify);
/**

View File

@@ -53,7 +53,8 @@ class AnalogTriggerSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterInitializedCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterInitializedCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -78,9 +79,9 @@ class AnalogTriggerSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore>
RegisterTriggerLowerBoundCallback(NotifyCallback callback,
bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterTriggerLowerBoundCallback(
NotifyCallback callback, bool initialNotify);
/**
* Get the lower bound.
@@ -104,9 +105,9 @@ class AnalogTriggerSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore>
RegisterTriggerUpperBoundCallback(NotifyCallback callback,
bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterTriggerUpperBoundCallback(
NotifyCallback callback, bool initialNotify);
/**
* Get the upper bound.

View File

@@ -40,8 +40,9 @@ class BuiltInAccelerometerSim {
* @param initialNotify whether to run the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterActiveCallback(
NotifyCallback callback, bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterActiveCallback(NotifyCallback callback,
bool initialNotify);
/**
* Check whether the accelerometer is active.
@@ -64,8 +65,9 @@ class BuiltInAccelerometerSim {
* @param initialNotify whether to call the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterRangeCallback(
NotifyCallback callback, bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterRangeCallback(NotifyCallback callback,
bool initialNotify);
/**
* Check the range of this accelerometer.
@@ -88,8 +90,9 @@ class BuiltInAccelerometerSim {
* @param initialNotify whether to call the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterXCallback(
NotifyCallback callback, bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterXCallback(NotifyCallback callback,
bool initialNotify);
/**
* Measure the X axis value.
@@ -112,8 +115,9 @@ class BuiltInAccelerometerSim {
* @param initialNotify whether to call the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterYCallback(
NotifyCallback callback, bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterYCallback(NotifyCallback callback,
bool initialNotify);
/**
* Measure the Y axis value.
@@ -136,8 +140,9 @@ class BuiltInAccelerometerSim {
* @param initialNotify whether to call the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterZCallback(
NotifyCallback callback, bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterZCallback(NotifyCallback callback,
bool initialNotify);
/**
* Measure the Z axis value.

View File

@@ -33,21 +33,24 @@ class CTREPCMSim : public PneumaticsBaseSim {
~CTREPCMSim() override = default;
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterInitializedCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterInitializedCallback(
NotifyCallback callback, bool initialNotify) override;
bool GetInitialized() const override;
void SetInitialized(bool initialized) override;
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterSolenoidOutputCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterSolenoidOutputCallback(
int channel, NotifyCallback callback, bool initialNotify) override;
bool GetSolenoidOutput(int channel) const override;
void SetSolenoidOutput(int channel, bool solenoidOutput) override;
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterCompressorOnCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterCompressorOnCallback(
NotifyCallback callback, bool initialNotify) override;
bool GetCompressorOn() const override;
@@ -62,9 +65,9 @@ class CTREPCMSim : public PneumaticsBaseSim {
* initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore>
RegisterClosedLoopEnabledCallback(NotifyCallback callback,
bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterClosedLoopEnabledCallback(
NotifyCallback callback, bool initialNotify);
/**
* Check whether the closed loop compressor control is active.
@@ -88,7 +91,8 @@ class CTREPCMSim : public PneumaticsBaseSim {
* initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterPressureSwitchCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterPressureSwitchCallback(
NotifyCallback callback, bool initialNotify) override;
/**
@@ -112,9 +116,9 @@ class CTREPCMSim : public PneumaticsBaseSim {
* @param initialNotify whether to call the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore>
RegisterCompressorCurrentCallback(NotifyCallback callback,
bool initialNotify) override;
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterCompressorCurrentCallback(
NotifyCallback callback, bool initialNotify) override;
/**
* Read the compressor current.

View File

@@ -48,7 +48,8 @@ class DIOSim {
* @param initialNotify whether to run the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterInitializedCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterInitializedCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -73,8 +74,9 @@ class DIOSim {
* initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterValueCallback(
NotifyCallback callback, bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterValueCallback(NotifyCallback callback,
bool initialNotify);
/**
* Read the value of the DIO port.
@@ -97,7 +99,8 @@ class DIOSim {
* @param initialNotify whether to call the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterPulseLengthCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterPulseLengthCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -122,7 +125,8 @@ class DIOSim {
* initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterIsInputCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterIsInputCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -147,7 +151,8 @@ class DIOSim {
* initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterFilterIndexCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterFilterIndexCallback(
NotifyCallback callback, bool initialNotify);
/**

View File

@@ -54,7 +54,8 @@ class DigitalPWMSim {
* @param initialNotify whether to run the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterInitializedCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterInitializedCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -78,7 +79,8 @@ class DigitalPWMSim {
* @param initialNotify whether to call the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterDutyCycleCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterDutyCycleCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -102,8 +104,9 @@ class DigitalPWMSim {
* @param initialNotify whether to call the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterPinCallback(
NotifyCallback callback, bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterPinCallback(NotifyCallback callback,
bool initialNotify);
/**
* Check the pin number.

View File

@@ -26,7 +26,8 @@ class DriverStationSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] static std::unique_ptr<CallbackStore> RegisterEnabledCallback(
[[nodiscard]]
static std::unique_ptr<CallbackStore> RegisterEnabledCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -51,8 +52,9 @@ class DriverStationSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] static std::unique_ptr<CallbackStore>
RegisterAutonomousCallback(NotifyCallback callback, bool initialNotify);
[[nodiscard]]
static std::unique_ptr<CallbackStore> RegisterAutonomousCallback(
NotifyCallback callback, bool initialNotify);
/**
* Check if the DS is in autonomous.
@@ -76,7 +78,8 @@ class DriverStationSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] static std::unique_ptr<CallbackStore> RegisterTestCallback(
[[nodiscard]]
static std::unique_ptr<CallbackStore> RegisterTestCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -101,7 +104,8 @@ class DriverStationSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] static std::unique_ptr<CallbackStore> RegisterEStopCallback(
[[nodiscard]]
static std::unique_ptr<CallbackStore> RegisterEStopCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -126,8 +130,9 @@ class DriverStationSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] static std::unique_ptr<CallbackStore>
RegisterFmsAttachedCallback(NotifyCallback callback, bool initialNotify);
[[nodiscard]]
static std::unique_ptr<CallbackStore> RegisterFmsAttachedCallback(
NotifyCallback callback, bool initialNotify);
/**
* Check if the FMS is connected.
@@ -151,8 +156,9 @@ class DriverStationSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] static std::unique_ptr<CallbackStore>
RegisterDsAttachedCallback(NotifyCallback callback, bool initialNotify);
[[nodiscard]]
static std::unique_ptr<CallbackStore> RegisterDsAttachedCallback(
NotifyCallback callback, bool initialNotify);
/**
* Check if the DS is attached.
@@ -176,9 +182,9 @@ class DriverStationSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] static std::unique_ptr<CallbackStore>
RegisterAllianceStationIdCallback(NotifyCallback callback,
bool initialNotify);
[[nodiscard]]
static std::unique_ptr<CallbackStore> RegisterAllianceStationIdCallback(
NotifyCallback callback, bool initialNotify);
/**
* Get the alliance station ID (color + number).
@@ -202,7 +208,8 @@ class DriverStationSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] static std::unique_ptr<CallbackStore> RegisterMatchTimeCallback(
[[nodiscard]]
static std::unique_ptr<CallbackStore> RegisterMatchTimeCallback(
NotifyCallback callback, bool initialNotify);
/**

View File

@@ -51,7 +51,8 @@ class DutyCycleSim {
* @param initialNotify whether to run the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterInitializedCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterInitializedCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -75,7 +76,8 @@ class DutyCycleSim {
* @param initialNotify whether to call the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterFrequencyCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterFrequencyCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -99,8 +101,9 @@ class DutyCycleSim {
* @param initialNotify whether to call the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterOutputCallback(
NotifyCallback callback, bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterOutputCallback(NotifyCallback callback,
bool initialNotify);
/**
* Measure the output from this duty cycle port.

View File

@@ -53,7 +53,8 @@ class EncoderSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterInitializedCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterInitializedCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -78,8 +79,9 @@ class EncoderSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterCountCallback(
NotifyCallback callback, bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterCountCallback(NotifyCallback callback,
bool initialNotify);
/**
* Read the count of the encoder.
@@ -103,8 +105,9 @@ class EncoderSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterPeriodCallback(
NotifyCallback callback, bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterPeriodCallback(NotifyCallback callback,
bool initialNotify);
/**
* Read the period of the encoder.
@@ -127,8 +130,9 @@ class EncoderSim {
* @param initialNotify whether to run the callback on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterResetCallback(
NotifyCallback callback, bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterResetCallback(NotifyCallback callback,
bool initialNotify);
/**
* Check if the encoder has been reset.
@@ -152,7 +156,8 @@ class EncoderSim {
* @param initialNotify whether to run the callback on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterMaxPeriodCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterMaxPeriodCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -177,7 +182,8 @@ class EncoderSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterDirectionCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterDirectionCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -202,7 +208,8 @@ class EncoderSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterReverseDirectionCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterReverseDirectionCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -227,7 +234,8 @@ class EncoderSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterSamplesToAverageCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterSamplesToAverageCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -252,7 +260,8 @@ class EncoderSim {
* @param initialNotify if true, the callback will be run on the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterDistancePerPulseCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterDistancePerPulseCallback(
NotifyCallback callback, bool initialNotify);
/**

View File

@@ -48,7 +48,8 @@ class PWMSim {
* @param initialNotify whether to run the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterInitializedCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterInitializedCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -72,7 +73,8 @@ class PWMSim {
* @param initialNotify whether to run the callback with the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterRawValueCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterRawValueCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -96,8 +98,9 @@ class PWMSim {
* @param initialNotify whether to run the callback with the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterSpeedCallback(
NotifyCallback callback, bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterSpeedCallback(NotifyCallback callback,
bool initialNotify);
/**
* Get the PWM speed.
@@ -120,7 +123,8 @@ class PWMSim {
* @param initialNotify whether to run the callback with the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterPositionCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterPositionCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -144,7 +148,8 @@ class PWMSim {
* @param initialNotify whether to run the callback with the initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterPeriodScaleCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterPeriodScaleCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -168,7 +173,8 @@ class PWMSim {
* @param initialNotify whether to run the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterZeroLatchCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterZeroLatchCallback(
NotifyCallback callback, bool initialNotify);
/**

View File

@@ -42,8 +42,9 @@ class PneumaticsBaseSim {
* Save a reference to this object; it being deconstructed cancels the
* callback.
*/
[[nodiscard]] virtual std::unique_ptr<CallbackStore>
RegisterInitializedCallback(NotifyCallback callback, bool initialNotify) = 0;
[[nodiscard]]
virtual std::unique_ptr<CallbackStore> RegisterInitializedCallback(
NotifyCallback callback, bool initialNotify) = 0;
/**
* Check if the compressor is on.
@@ -68,8 +69,9 @@ class PneumaticsBaseSim {
* Save a reference to this object; it being deconstructed cancels the
* callback.
*/
[[nodiscard]] virtual std::unique_ptr<CallbackStore>
RegisterCompressorOnCallback(NotifyCallback callback, bool initialNotify) = 0;
[[nodiscard]]
virtual std::unique_ptr<CallbackStore> RegisterCompressorOnCallback(
NotifyCallback callback, bool initialNotify) = 0;
/**
* Check the solenoid output on a specific channel.
@@ -98,9 +100,9 @@ class PneumaticsBaseSim {
* Save a reference to this object; it being deconstructed cancels the
* callback.
*/
[[nodiscard]] virtual std::unique_ptr<CallbackStore>
RegisterSolenoidOutputCallback(int channel, NotifyCallback callback,
bool initialNotify) = 0;
[[nodiscard]]
virtual std::unique_ptr<CallbackStore> RegisterSolenoidOutputCallback(
int channel, NotifyCallback callback, bool initialNotify) = 0;
/**
* Check the value of the pressure switch.
@@ -126,9 +128,9 @@ class PneumaticsBaseSim {
* Save a reference to this object; it being deconstructed cancels the
* callback.
*/
[[nodiscard]] virtual std::unique_ptr<CallbackStore>
RegisterPressureSwitchCallback(NotifyCallback callback,
bool initialNotify) = 0;
[[nodiscard]]
virtual std::unique_ptr<CallbackStore> RegisterPressureSwitchCallback(
NotifyCallback callback, bool initialNotify) = 0;
/**
* Read the compressor current.
@@ -153,9 +155,9 @@ class PneumaticsBaseSim {
* Save a reference to this object; it being deconstructed cancels the
* callback.
*/
[[nodiscard]] virtual std::unique_ptr<CallbackStore>
RegisterCompressorCurrentCallback(NotifyCallback callback,
bool initialNotify) = 0;
[[nodiscard]]
virtual std::unique_ptr<CallbackStore> RegisterCompressorCurrentCallback(
NotifyCallback callback, bool initialNotify) = 0;
/**
* Get the current value of all solenoid outputs.

View File

@@ -40,7 +40,8 @@ class PowerDistributionSim {
* @param initialNotify whether to run the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterInitializedCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterInitializedCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -65,7 +66,8 @@ class PowerDistributionSim {
* @param initialNotify whether to call the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterTemperatureCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterTemperatureCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -90,7 +92,8 @@ class PowerDistributionSim {
* @param initialNotify whether to call the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterVoltageCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterVoltageCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -116,7 +119,8 @@ class PowerDistributionSim {
* @param initialNotify whether to call the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterCurrentCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterCurrentCallback(
int channel, NotifyCallback callback, bool initialNotify);
/**

View File

@@ -37,21 +37,24 @@ class REVPHSim : public PneumaticsBaseSim {
~REVPHSim() override = default;
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterInitializedCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterInitializedCallback(
NotifyCallback callback, bool initialNotify) override;
bool GetInitialized() const override;
void SetInitialized(bool solenoidInitialized) override;
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterSolenoidOutputCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterSolenoidOutputCallback(
int channel, NotifyCallback callback, bool initialNotify) override;
bool GetSolenoidOutput(int channel) const override;
void SetSolenoidOutput(int channel, bool solenoidOutput) override;
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterCompressorOnCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterCompressorOnCallback(
NotifyCallback callback, bool initialNotify) override;
/**
@@ -76,9 +79,9 @@ class REVPHSim : public PneumaticsBaseSim {
* initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore>
RegisterCompressorConfigTypeCallback(NotifyCallback callback,
bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterCompressorConfigTypeCallback(
NotifyCallback callback, bool initialNotify);
/**
* Check whether the closed loop compressor control is active.
@@ -94,16 +97,17 @@ class REVPHSim : public PneumaticsBaseSim {
*/
void SetCompressorConfigType(int compressorConfigType);
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterPressureSwitchCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterPressureSwitchCallback(
NotifyCallback callback, bool initialNotify) override;
bool GetPressureSwitch() const override;
void SetPressureSwitch(bool pressureSwitch) override;
[[nodiscard]] std::unique_ptr<CallbackStore>
RegisterCompressorCurrentCallback(NotifyCallback callback,
bool initialNotify) override;
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterCompressorCurrentCallback(
NotifyCallback callback, bool initialNotify) override;
double GetCompressorCurrent() const override;

View File

@@ -40,9 +40,9 @@ class RelaySim {
* @param initialNotify whether to run the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore>
RegisterInitializedForwardCallback(NotifyCallback callback,
bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterInitializedForwardCallback(
NotifyCallback callback, bool initialNotify);
/**
* Check whether the forward direction has been initialized.
@@ -65,9 +65,9 @@ class RelaySim {
* @param initialNotify whether to run the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore>
RegisterInitializedReverseCallback(NotifyCallback callback,
bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterInitializedReverseCallback(
NotifyCallback callback, bool initialNotify);
/**
* Check whether the reverse direction has been initialized.
@@ -90,7 +90,8 @@ class RelaySim {
* @param initialNotify whether to run the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterForwardCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterForwardCallback(
NotifyCallback callback, bool initialNotify);
/**
@@ -114,7 +115,8 @@ class RelaySim {
* @param initialNotify whether to run the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterReverseCallback(
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterReverseCallback(
NotifyCallback callback, bool initialNotify);
/**

View File

@@ -26,8 +26,9 @@ class RoboRioSim {
* @param initialNotify whether to run the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] static std::unique_ptr<CallbackStore>
RegisterFPGAButtonCallback(NotifyCallback callback, bool initialNotify);
[[nodiscard]]
static std::unique_ptr<CallbackStore> RegisterFPGAButtonCallback(
NotifyCallback callback, bool initialNotify);
/**
* Query the state of the FPGA button.
@@ -50,8 +51,9 @@ class RoboRioSim {
* @param initialNotify whether to call the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] static std::unique_ptr<CallbackStore>
RegisterVInVoltageCallback(NotifyCallback callback, bool initialNotify);
[[nodiscard]]
static std::unique_ptr<CallbackStore> RegisterVInVoltageCallback(
NotifyCallback callback, bool initialNotify);
/**
* Measure the Vin voltage.
@@ -75,8 +77,9 @@ class RoboRioSim {
* initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] static std::unique_ptr<CallbackStore>
RegisterVInCurrentCallback(NotifyCallback callback, bool initialNotify);
[[nodiscard]]
static std::unique_ptr<CallbackStore> RegisterVInCurrentCallback(
NotifyCallback callback, bool initialNotify);
/**
* Measure the Vin current.
@@ -100,8 +103,9 @@ class RoboRioSim {
* initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] static std::unique_ptr<CallbackStore>
RegisterUserVoltage6VCallback(NotifyCallback callback, bool initialNotify);
[[nodiscard]]
static std::unique_ptr<CallbackStore> RegisterUserVoltage6VCallback(
NotifyCallback callback, bool initialNotify);
/**
* Measure the 6V rail voltage.
@@ -125,8 +129,9 @@ class RoboRioSim {
* initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] static std::unique_ptr<CallbackStore>
RegisterUserCurrent6VCallback(NotifyCallback callback, bool initialNotify);
[[nodiscard]]
static std::unique_ptr<CallbackStore> RegisterUserCurrent6VCallback(
NotifyCallback callback, bool initialNotify);
/**
* Measure the 6V rail current.
@@ -150,8 +155,9 @@ class RoboRioSim {
* initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] static std::unique_ptr<CallbackStore>
RegisterUserActive6VCallback(NotifyCallback callback, bool initialNotify);
[[nodiscard]]
static std::unique_ptr<CallbackStore> RegisterUserActive6VCallback(
NotifyCallback callback, bool initialNotify);
/**
* Get the 6V rail active state.
@@ -175,8 +181,9 @@ class RoboRioSim {
* initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] static std::unique_ptr<CallbackStore>
RegisterUserVoltage5VCallback(NotifyCallback callback, bool initialNotify);
[[nodiscard]]
static std::unique_ptr<CallbackStore> RegisterUserVoltage5VCallback(
NotifyCallback callback, bool initialNotify);
/**
* Measure the 5V rail voltage.
@@ -200,8 +207,9 @@ class RoboRioSim {
* initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] static std::unique_ptr<CallbackStore>
RegisterUserCurrent5VCallback(NotifyCallback callback, bool initialNotify);
[[nodiscard]]
static std::unique_ptr<CallbackStore> RegisterUserCurrent5VCallback(
NotifyCallback callback, bool initialNotify);
/**
* Measure the 5V rail current.
@@ -225,8 +233,9 @@ class RoboRioSim {
* initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] static std::unique_ptr<CallbackStore>
RegisterUserActive5VCallback(NotifyCallback callback, bool initialNotify);
[[nodiscard]]
static std::unique_ptr<CallbackStore> RegisterUserActive5VCallback(
NotifyCallback callback, bool initialNotify);
/**
* Get the 5V rail active state.
@@ -250,8 +259,9 @@ class RoboRioSim {
* initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] static std::unique_ptr<CallbackStore>
RegisterUserVoltage3V3Callback(NotifyCallback callback, bool initialNotify);
[[nodiscard]]
static std::unique_ptr<CallbackStore> RegisterUserVoltage3V3Callback(
NotifyCallback callback, bool initialNotify);
/**
* Measure the 3.3V rail voltage.
@@ -275,8 +285,9 @@ class RoboRioSim {
* initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] static std::unique_ptr<CallbackStore>
RegisterUserCurrent3V3Callback(NotifyCallback callback, bool initialNotify);
[[nodiscard]]
static std::unique_ptr<CallbackStore> RegisterUserCurrent3V3Callback(
NotifyCallback callback, bool initialNotify);
/**
* Measure the 3.3V rail current.
@@ -300,8 +311,9 @@ class RoboRioSim {
* initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] static std::unique_ptr<CallbackStore>
RegisterUserActive3V3Callback(NotifyCallback callback, bool initialNotify);
[[nodiscard]]
static std::unique_ptr<CallbackStore> RegisterUserActive3V3Callback(
NotifyCallback callback, bool initialNotify);
/**
* Get the 3.3V rail active state.
@@ -326,8 +338,9 @@ class RoboRioSim {
* initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] static std::unique_ptr<CallbackStore>
RegisterUserFaults6VCallback(NotifyCallback callback, bool initialNotify);
[[nodiscard]]
static std::unique_ptr<CallbackStore> RegisterUserFaults6VCallback(
NotifyCallback callback, bool initialNotify);
/**
* Get the 6V rail number of faults.
@@ -352,8 +365,9 @@ class RoboRioSim {
* initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] static std::unique_ptr<CallbackStore>
RegisterUserFaults5VCallback(NotifyCallback callback, bool initialNotify);
[[nodiscard]]
static std::unique_ptr<CallbackStore> RegisterUserFaults5VCallback(
NotifyCallback callback, bool initialNotify);
/**
* Get the 5V rail number of faults.
@@ -378,8 +392,9 @@ class RoboRioSim {
* initial value
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] static std::unique_ptr<CallbackStore>
RegisterUserFaults3V3Callback(NotifyCallback callback, bool initialNotify);
[[nodiscard]]
static std::unique_ptr<CallbackStore> RegisterUserFaults3V3Callback(
NotifyCallback callback, bool initialNotify);
/**
* Get the 3.3V rail number of faults.
@@ -402,8 +417,9 @@ class RoboRioSim {
* @param initialNotify whether to call the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] static std::unique_ptr<CallbackStore>
RegisterBrownoutVoltageCallback(NotifyCallback callback, bool initialNotify);
[[nodiscard]]
static std::unique_ptr<CallbackStore> RegisterBrownoutVoltageCallback(
NotifyCallback callback, bool initialNotify);
/**
* Measure the brownout voltage.

View File

@@ -25,8 +25,9 @@ class SPIAccelerometerSim {
* @param initialNotify whether to run the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterActiveCallback(
NotifyCallback callback, bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterActiveCallback(NotifyCallback callback,
bool initialNotify);
/**
* Check whether the accelerometer is active.
@@ -49,8 +50,9 @@ class SPIAccelerometerSim {
* @param initialNotify whether to call the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterRangeCallback(
NotifyCallback callback, bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterRangeCallback(NotifyCallback callback,
bool initialNotify);
/**
* Check the range of this accelerometer.
@@ -73,8 +75,9 @@ class SPIAccelerometerSim {
* @param initialNotify whether to call the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterXCallback(
NotifyCallback callback, bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterXCallback(NotifyCallback callback,
bool initialNotify);
/**
* Measure the X axis value.
@@ -97,8 +100,9 @@ class SPIAccelerometerSim {
* @param initialNotify whether to call the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterYCallback(
NotifyCallback callback, bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterYCallback(NotifyCallback callback,
bool initialNotify);
/**
* Measure the Y axis value.
@@ -121,8 +125,9 @@ class SPIAccelerometerSim {
* @param initialNotify whether to call the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterZCallback(
NotifyCallback callback, bool initialNotify);
[[nodiscard]]
std::unique_ptr<CallbackStore> RegisterZCallback(NotifyCallback callback,
bool initialNotify);
/**
* Measure the Z axis value.

View File

@@ -29,7 +29,8 @@ class SolenoidSim {
* Save a reference to this object; it being deconstructed cancels the
* callback.
*/
[[nodiscard]] virtual std::unique_ptr<CallbackStore> RegisterOutputCallback(
[[nodiscard]]
virtual std::unique_ptr<CallbackStore> RegisterOutputCallback(
NotifyCallback callback, bool initialNotify);
std::shared_ptr<PneumaticsBaseSim> GetModuleSim() const;

View File

@@ -25,8 +25,9 @@ class Drive : public frc2::SubsystemBase {
* @param fwd the commanded forward movement
* @param rot the commanded rotation
*/
[[nodiscard]] frc2::CommandPtr ArcadeDriveCommand(
std::function<double()> fwd, std::function<double()> rot);
[[nodiscard]]
frc2::CommandPtr ArcadeDriveCommand(std::function<double()> fwd,
std::function<double()> rot);
/**
* Returns a command that drives the robot forward a specified distance at a
@@ -35,8 +36,8 @@ class Drive : public frc2::SubsystemBase {
* @param distance The distance to drive forward in meters
* @param speed The fraction of max speed at which to drive
*/
[[nodiscard]] frc2::CommandPtr DriveDistanceCommand(units::meter_t distance,
double speed);
[[nodiscard]]
frc2::CommandPtr DriveDistanceCommand(units::meter_t distance, double speed);
private:
frc::PWMSparkMax m_leftLeader{DriveConstants::kLeftMotor1Port};

View File

@@ -19,10 +19,12 @@ class Intake : public frc2::SubsystemBase {
/** Returns a command that deploys the intake, and then runs the intake motor
* indefinitely. */
[[nodiscard]] frc2::CommandPtr IntakeCommand();
[[nodiscard]]
frc2::CommandPtr IntakeCommand();
/** Returns a command that turns off and retracts the intake. */
[[nodiscard]] frc2::CommandPtr RetractCommand();
[[nodiscard]]
frc2::CommandPtr RetractCommand();
private:
frc::PWMSparkMax m_motor{IntakeConstants::kMotorPort};

View File

@@ -28,8 +28,8 @@ class Shooter : public frc2::SubsystemBase {
*
* @param setpointRotationsPerSecond The desired shooter velocity
*/
[[nodiscard]] frc2::CommandPtr ShootCommand(
units::turns_per_second_t setpoint);
[[nodiscard]]
frc2::CommandPtr ShootCommand(units::turns_per_second_t setpoint);
private:
frc::PWMSparkMax m_shooterMotor{ShooterConstants::kShooterMotorPort};

View File

@@ -15,7 +15,8 @@ class Storage : frc2::SubsystemBase {
public:
Storage();
/** Returns a command that runs the storage motor indefinitely. */
[[nodiscard]] frc2::CommandPtr RunCommand();
[[nodiscard]]
frc2::CommandPtr RunCommand();
/** Whether the ball storage is full. */
bool IsFull() const;

View File

@@ -147,10 +147,10 @@ class SwerveDriveKinematics {
* @return The resulting chassis speed.
*/
template <typename... ModuleStates>
requires(std::is_same_v<std::remove_reference_t<ModuleStates>,
SwerveModuleState>&&...) ChassisSpeeds
ToChassisSpeeds(ModuleStates&&... wheelStates)
const;
requires(std::is_same_v<std::remove_reference_t<ModuleStates>,
SwerveModuleState> &&
...)
ChassisSpeeds ToChassisSpeeds(ModuleStates&&... wheelStates) const;
/**
* Performs forward kinematics to return the resulting chassis state from the

View File

@@ -66,11 +66,11 @@ SwerveDriveKinematics<NumModules>::ToSwerveModuleStates(
template <size_t NumModules>
template <typename... ModuleStates>
requires(std::is_same_v<std::remove_reference_t<ModuleStates>,
SwerveModuleState>&&...)
ChassisSpeeds SwerveDriveKinematics<NumModules>::ToChassisSpeeds(
ModuleStates&&... wheelStates)
const {
requires(std::is_same_v<std::remove_reference_t<ModuleStates>,
SwerveModuleState> &&
...)
ChassisSpeeds SwerveDriveKinematics<NumModules>::ToChassisSpeeds(
ModuleStates&&... wheelStates) const {
static_assert(sizeof...(wheelStates) == NumModules,
"Number of modules is not consistent with number of wheel "
"locations provided in constructor.");

View File

@@ -48,9 +48,7 @@ class WebSocketTest : public ::testing::Test {
failTimer->Unreference();
}
~WebSocketTest() override {
Finish();
}
~WebSocketTest() override { Finish(); }
void Finish() {
loop->Walk([](uv::Handle& it) { it.Close(); });

View File

@@ -59,19 +59,13 @@ class MappedFileRegion {
return *this;
}
explicit operator bool() const {
return m_mapping != nullptr;
}
explicit operator bool() const { return m_mapping != nullptr; }
void Flush();
void Unmap();
uint64_t size() const {
return m_size;
}
uint8_t* data() const {
return static_cast<uint8_t*>(m_mapping);
}
uint64_t size() const { return m_size; }
uint8_t* data() const { return static_cast<uint8_t*>(m_mapping); }
const uint8_t* const_data() const {
return static_cast<const uint8_t*>(m_mapping);
}

View File

@@ -65,7 +65,10 @@ class priority_queue {
std::make_heap(c.begin(), c.end(), comp);
}
[[nodiscard]] bool empty() const { return c.empty(); }
[[nodiscard]]
bool empty() const {
return c.empty();
}
size_type size() const { return c.size(); }