Rename our Falcons to TalonFX
This is done because both the Falcons and Krakens use a TalonFX motor
controller and our api to use them will be the same.
Signed-off-by: Maxwell Henderson <mxwhenderson@gmail.com>
Change-Id: I97249c5583e42f5ca346e754499748e555cd9f8b
diff --git a/frc971/wpilib/generic_can_writer.h b/frc971/wpilib/generic_can_writer.h
index 8bacfbd..7555c0a 100644
--- a/frc971/wpilib/generic_can_writer.h
+++ b/frc971/wpilib/generic_can_writer.h
@@ -2,14 +2,14 @@
#include <string_view>
#include "frc971/can_configuration_generated.h"
-#include "frc971/wpilib/falcon.h"
#include "frc971/wpilib/loop_output_handler.h"
+#include "frc971/wpilib/talonfx.h"
namespace frc971 {
namespace wpilib {
/// This class uses a callback whenever it writes so that the caller can use any
-/// flatbuffer to write to the falcon.
+/// flatbuffer to write to the talonfx motor.
template <typename T>
class GenericCANWriter : public LoopOutputHandler<T> {
public:
@@ -17,7 +17,7 @@
::aos::EventLoop *event_loop,
std::function<
void(const T &output,
- std::map<std::string, std::shared_ptr<Falcon>> falcon_map)>
+ std::map<std::string, std::shared_ptr<TalonFX>> talonfx_map)>
write_callback)
: LoopOutputHandler<T>(event_loop, "/superstructure"),
write_callback_(write_callback) {
@@ -27,8 +27,8 @@
}
void HandleCANConfiguration(const CANConfiguration &configuration) {
- for (auto &[_, falcon] : falcon_map_) {
- falcon->PrintConfigs();
+ for (auto &[_, talonfx] : talonfx_map_) {
+ talonfx->PrintConfigs();
}
if (configuration.reapply()) {
@@ -36,33 +36,37 @@
}
}
- void add_falcon(std::string_view name, std::shared_ptr<Falcon> falcon) {
- falcon_map_.insert({name, std::move(falcon)});
+ void add_talonfx(std::string_view name, std::shared_ptr<TalonFX> talonfx) {
+ talonfx_map_.insert({name, std::move(talonfx)});
}
static constexpr int kGenericCANWriterPriority = 35;
private:
void WriteConfigs() {
- for (auto &[_, falcon] : falcon_map_) {
- falcon->WriteConfigs();
+ for (auto &[_, talonfx] : talonfx_map_) {
+ talonfx->WriteConfigs();
}
}
- void Write(const T &output) override { write_callback_(output, falcon_map_); }
+ void Write(const T &output) override {
+ write_callback_(output, talonfx_map_);
+ }
void Stop() override {
AOS_LOG(WARNING, "Generic CAN output too old.\n");
- for (auto &[_, falcon] : falcon_map_) {
- falcon->WriteVoltage(0);
+ for (auto &[_, talonfx] : talonfx_map_) {
+ talonfx->WriteVoltage(0);
}
}
- // Maps each name to a falcon to let the caller retreive them when writing
- std::map<std::string_view, std::shared_ptr<Falcon>> falcon_map_;
+ // Maps each name to a talonfx to let the caller retreive them when
+ // writing
+ std::map<std::string_view, std::shared_ptr<TalonFX>> talonfx_map_;
- std::function<void(const T &output,
- std::map<std::string, std::shared_ptr<Falcon>> falcon_map)>
+ std::function<void(
+ const T &output,
+ std::map<std::string, std::shared_ptr<TalonFX>> talonfx_map)>
write_callback_;
};