Chop out the MotorDanger junk
It had race conditions, and the inheritance hierarchy is a mess.
Change-Id: I4566ee5d7a53ec162c885a70bef3e2774555eef7
diff --git a/third_party/allwpilib_2017/BUILD b/third_party/allwpilib_2017/BUILD
index 054ef08..1903912 100644
--- a/third_party/allwpilib_2017/BUILD
+++ b/third_party/allwpilib_2017/BUILD
@@ -46,6 +46,11 @@
'ADXRS450_Gyro',
'GyroBase',
'IterativeRobot',
+ 'MotorSafety',
+ 'MotorSafetyHelper',
+ 'SafePWM',
+ 'SpeedController',
+ 'PWMSpeedController',
]
# Whole subdirectories of WPILib we don't want around.
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/Relay.h b/third_party/allwpilib_2017/wpilibc/athena/include/Relay.h
index 6d7f877..de550d2 100644
--- a/third_party/allwpilib_2017/wpilibc/athena/include/Relay.h
+++ b/third_party/allwpilib_2017/wpilibc/athena/include/Relay.h
@@ -11,13 +11,10 @@
#include <string>
#include "HAL/Types.h"
-#include "MotorSafety.h"
#include "SensorBase.h"
namespace frc {
-class MotorSafetyHelper;
-
/**
* Class for Spike style relay outputs.
* Relays are intended to be connected to spikes or similar relays. The relay
@@ -29,8 +26,7 @@
* independently for something that does not care about voltage polarity (like
* a solenoid).
*/
-class Relay : public MotorSafety,
- public SensorBase {
+class Relay : public SensorBase {
public:
enum Value { kOff, kOn, kForward, kReverse };
enum Direction { kBothDirections, kForwardOnly, kReverseOnly };
@@ -42,22 +38,12 @@
Value Get() const;
int GetChannel() const;
- void SetExpiration(double timeout) override;
- double GetExpiration() const override;
- bool IsAlive() const override;
- void StopMotor() override;
- bool IsSafetyEnabled() const override;
- void SetSafetyEnabled(bool enabled) override;
- void GetDescription(std::ostringstream& desc) const override;
-
private:
int m_channel;
Direction m_direction;
HAL_RelayHandle m_forwardHandle = HAL_kInvalidHandle;
HAL_RelayHandle m_reverseHandle = HAL_kInvalidHandle;
-
- std::unique_ptr<MotorSafetyHelper> m_safetyHelper;
};
} // namespace frc
diff --git a/third_party/allwpilib_2017/wpilibc/athena/include/Talon.h b/third_party/allwpilib_2017/wpilibc/athena/include/Talon.h
index 793d77b..6b8fb7f 100644
--- a/third_party/allwpilib_2017/wpilibc/athena/include/Talon.h
+++ b/third_party/allwpilib_2017/wpilibc/athena/include/Talon.h
@@ -7,14 +7,14 @@
#pragma once
-#include "PWMSpeedController.h"
+#include "PWM.h"
namespace frc {
/**
* Cross the Road Electronics (CTRE) Talon and Talon SR Speed Controller
*/
-class Talon : public PWMSpeedController {
+class Talon : public PWM {
public:
explicit Talon(int channel);
virtual ~Talon() = default;
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/DriverStation.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/DriverStation.cpp
index 95d20b7..521cf3b 100644
--- a/third_party/allwpilib_2017/wpilibc/athena/src/DriverStation.cpp
+++ b/third_party/allwpilib_2017/wpilibc/athena/src/DriverStation.cpp
@@ -14,7 +14,6 @@
#include "HAL/HAL.h"
#include "HAL/Power.h"
#include "HAL/cpp/Log.h"
-#include "MotorSafetyHelper.h"
#include "Timer.h"
#include "Utility.h"
#include "WPIErrors.h"
@@ -588,7 +587,6 @@
void DriverStation::Run() {
m_isRunning = true;
- int period = 0;
while (m_isRunning) {
HAL_WaitForDSData();
GetData();
@@ -602,10 +600,6 @@
}
m_waitForDataCond.notify_all();
- if (++period >= 4) {
- MotorSafetyHelper::CheckMotors();
- period = 0;
- }
if (m_userInDisabled) HAL_ObserveUserProgramDisabled();
if (m_userInAutonomous) HAL_ObserveUserProgramAutonomous();
if (m_userInTeleop) HAL_ObserveUserProgramTeleop();
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/Relay.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/Relay.cpp
index 201963b..3e9597a 100644
--- a/third_party/allwpilib_2017/wpilibc/athena/src/Relay.cpp
+++ b/third_party/allwpilib_2017/wpilibc/athena/src/Relay.cpp
@@ -12,7 +12,6 @@
#include "HAL/HAL.h"
#include "HAL/Ports.h"
-#include "MotorSafetyHelper.h"
#include "WPIErrors.h"
using namespace frc;
@@ -82,9 +81,6 @@
return;
}
}
-
- m_safetyHelper = std::make_unique<MotorSafetyHelper>(this);
- m_safetyHelper->SetSafetyEnabled(false);
}
/**
@@ -206,57 +202,3 @@
}
int Relay::GetChannel() const { return m_channel; }
-
-/**
- * Set the expiration time for the Relay object
- * @param timeout The timeout (in seconds) for this relay object
- */
-void Relay::SetExpiration(double timeout) {
- m_safetyHelper->SetExpiration(timeout);
-}
-
-/**
- * Return the expiration time for the relay object.
- * @return The expiration time value.
- */
-double Relay::GetExpiration() const { return m_safetyHelper->GetExpiration(); }
-
-/**
- * Check if the relay object is currently alive or stopped due to a timeout.
- *
- * @return a bool value that is true if the motor has NOT timed out and should
- * still be running.
- */
-bool Relay::IsAlive() const { return m_safetyHelper->IsAlive(); }
-
-/**
- * Stop the motor associated with this PWM object.
- *
- * This is called by the MotorSafetyHelper object when it has a timeout for this
- * relay and needs to stop it from running.
- */
-void Relay::StopMotor() { Set(kOff); }
-
-/**
- * Enable/disable motor safety for this device.
- *
- * Turn on and off the motor safety option for this relay object.
- *
- * @param enabled True if motor safety is enforced for this object
- */
-void Relay::SetSafetyEnabled(bool enabled) {
- m_safetyHelper->SetSafetyEnabled(enabled);
-}
-
-/**
- * Check if motor safety is enabled for this object.
- *
- * @returns True if motor safety is enforced for this object
- */
-bool Relay::IsSafetyEnabled() const {
- return m_safetyHelper->IsSafetyEnabled();
-}
-
-void Relay::GetDescription(std::ostringstream& desc) const {
- desc << "Relay " << GetChannel();
-}
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/Talon.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/Talon.cpp
index 8143865..ca2e6c3 100644
--- a/third_party/allwpilib_2017/wpilibc/athena/src/Talon.cpp
+++ b/third_party/allwpilib_2017/wpilibc/athena/src/Talon.cpp
@@ -17,7 +17,7 @@
* @param channel The PWM channel number that the Talon is attached to. 0-9 are
* on-board, 10-19 are on the MXP port
*/
-Talon::Talon(int channel) : PWMSpeedController(channel) {
+Talon::Talon(int channel) : PWM(channel) {
/* Note that the Talon uses the following bounds for PWM values. These values
* should work reasonably well for most controllers, but if users experience
* issues such as asymmetric behavior around the deadband or inability to
diff --git a/y2012/wpilib/wpilib_interface.cc b/y2012/wpilib/wpilib_interface.cc
index 8493496..baefca6 100644
--- a/y2012/wpilib/wpilib_interface.cc
+++ b/y2012/wpilib/wpilib_interface.cc
@@ -252,14 +252,14 @@
virtual void Write() override {
auto &queue = drivetrain_queue.output;
LOG_STRUCT(DEBUG, "will output", *queue);
- left_drivetrain_talon_->Set(-queue->left_voltage / 12.0);
- right_drivetrain_talon_->Set(queue->right_voltage / 12.0);
+ left_drivetrain_talon_->SetSpeed(-queue->left_voltage / 12.0);
+ right_drivetrain_talon_->SetSpeed(queue->right_voltage / 12.0);
}
virtual void Stop() override {
LOG(WARNING, "drivetrain output too old\n");
- left_drivetrain_talon_->Disable();
- right_drivetrain_talon_->Disable();
+ left_drivetrain_talon_->SetDisabled();
+ right_drivetrain_talon_->SetDisabled();
}
::std::unique_ptr<Talon> left_drivetrain_talon_;
@@ -283,15 +283,15 @@
virtual void Write() override {
auto &queue = ::y2012::control_loops::accessories_queue.output;
- talon1_->Set(queue->sticks[0]);
- talon2_->Set(queue->sticks[1]);
+ talon1_->SetSpeed(queue->sticks[0]);
+ talon2_->SetSpeed(queue->sticks[1]);
LOG_STRUCT(DEBUG, "will output", *queue);
}
virtual void Stop() override {
LOG(WARNING, "shooter output too old\n");
- talon1_->Disable();
- talon2_->Disable();
+ talon1_->SetDisabled();
+ talon2_->SetDisabled();
}
::std::unique_ptr<Talon> talon1_, talon2_;
diff --git a/y2014/wpilib/wpilib_interface.cc b/y2014/wpilib/wpilib_interface.cc
index a53d54b..b5dee33 100644
--- a/y2014/wpilib/wpilib_interface.cc
+++ b/y2014/wpilib/wpilib_interface.cc
@@ -590,14 +590,14 @@
virtual void Write() override {
auto &queue = ::frc971::control_loops::drivetrain_queue.output;
LOG_STRUCT(DEBUG, "will output", *queue);
- left_drivetrain_talon_->Set(-queue->left_voltage / 12.0);
- right_drivetrain_talon_->Set(queue->right_voltage / 12.0);
+ left_drivetrain_talon_->SetSpeed(-queue->left_voltage / 12.0);
+ right_drivetrain_talon_->SetSpeed(queue->right_voltage / 12.0);
}
virtual void Stop() override {
LOG(WARNING, "drivetrain output too old\n");
- left_drivetrain_talon_->Disable();
- right_drivetrain_talon_->Disable();
+ left_drivetrain_talon_->SetDisabled();
+ right_drivetrain_talon_->SetDisabled();
}
::std::unique_ptr<Talon> left_drivetrain_talon_;
@@ -618,12 +618,12 @@
virtual void Write() override {
auto &queue = ::y2014::control_loops::shooter_queue.output;
LOG_STRUCT(DEBUG, "will output", *queue);
- shooter_talon_->Set(queue->voltage / 12.0);
+ shooter_talon_->SetSpeed(queue->voltage / 12.0);
}
virtual void Stop() override {
LOG(WARNING, "shooter output too old\n");
- shooter_talon_->Disable();
+ shooter_talon_->SetDisabled();
}
::std::unique_ptr<Talon> shooter_talon_;
@@ -663,22 +663,22 @@
virtual void Write() override {
auto &queue = ::y2014::control_loops::claw_queue.output;
LOG_STRUCT(DEBUG, "will output", *queue);
- intake1_talon_->Set(queue->intake_voltage / 12.0);
- intake2_talon_->Set(queue->intake_voltage / 12.0);
- bottom_claw_talon_->Set(-queue->bottom_claw_voltage / 12.0);
- top_claw_talon_->Set(queue->top_claw_voltage / 12.0);
- left_tusk_talon_->Set(queue->tusk_voltage / 12.0);
- right_tusk_talon_->Set(-queue->tusk_voltage / 12.0);
+ intake1_talon_->SetSpeed(queue->intake_voltage / 12.0);
+ intake2_talon_->SetSpeed(queue->intake_voltage / 12.0);
+ bottom_claw_talon_->SetSpeed(-queue->bottom_claw_voltage / 12.0);
+ top_claw_talon_->SetSpeed(queue->top_claw_voltage / 12.0);
+ left_tusk_talon_->SetSpeed(queue->tusk_voltage / 12.0);
+ right_tusk_talon_->SetSpeed(-queue->tusk_voltage / 12.0);
}
virtual void Stop() override {
LOG(WARNING, "claw output too old\n");
- intake1_talon_->Disable();
- intake2_talon_->Disable();
- bottom_claw_talon_->Disable();
- top_claw_talon_->Disable();
- left_tusk_talon_->Disable();
- right_tusk_talon_->Disable();
+ intake1_talon_->SetDisabled();
+ intake2_talon_->SetDisabled();
+ bottom_claw_talon_->SetDisabled();
+ top_claw_talon_->SetDisabled();
+ left_tusk_talon_->SetDisabled();
+ right_tusk_talon_->SetDisabled();
}
::std::unique_ptr<Talon> top_claw_talon_;
diff --git a/y2014_bot3/wpilib/wpilib_interface.cc b/y2014_bot3/wpilib/wpilib_interface.cc
index 4abbfce..83ec9a9 100644
--- a/y2014_bot3/wpilib/wpilib_interface.cc
+++ b/y2014_bot3/wpilib/wpilib_interface.cc
@@ -276,14 +276,14 @@
virtual void Write() override {
auto &queue = ::frc971::control_loops::drivetrain_queue.output;
LOG_STRUCT(DEBUG, "will output", *queue);
- left_drivetrain_talon_->Set(-queue->left_voltage / 12.0);
- right_drivetrain_talon_->Set(queue->right_voltage / 12.0);
+ left_drivetrain_talon_->SetSpeed(-queue->left_voltage / 12.0);
+ right_drivetrain_talon_->SetSpeed(queue->right_voltage / 12.0);
}
virtual void Stop() override {
LOG(WARNING, "drivetrain output too old\n");
- left_drivetrain_talon_->Disable();
- right_drivetrain_talon_->Disable();
+ left_drivetrain_talon_->SetDisabled();
+ right_drivetrain_talon_->SetDisabled();
}
::std::unique_ptr<Talon> left_drivetrain_talon_;
@@ -315,20 +315,20 @@
virtual void Write() override {
auto &queue = ::y2014_bot3::control_loops::rollers_queue.output;
LOG_STRUCT(DEBUG, "will output", *queue);
- rollers_front_left_intake_talon_->Set(queue->front_intake_voltage / 12.0);
- rollers_front_right_intake_talon_->Set(-(queue->front_intake_voltage / 12.0));
- rollers_back_left_intake_talon_->Set(queue->back_intake_voltage / 12.0);
- rollers_back_right_intake_talon_->Set(-(queue->back_intake_voltage / 12.0));
- rollers_low_goal_talon_->Set(queue->low_goal_voltage / 12.0);
+ rollers_front_left_intake_talon_->SetSpeed(queue->front_intake_voltage / 12.0);
+ rollers_front_right_intake_talon_->SetSpeed(-(queue->front_intake_voltage / 12.0));
+ rollers_back_left_intake_talon_->SetSpeed(queue->back_intake_voltage / 12.0);
+ rollers_back_right_intake_talon_->SetSpeed(-(queue->back_intake_voltage / 12.0));
+ rollers_low_goal_talon_->SetSpeed(queue->low_goal_voltage / 12.0);
}
virtual void Stop() override {
LOG(WARNING, "Intake output too old\n");
- rollers_front_left_intake_talon_->Disable();
- rollers_front_right_intake_talon_->Disable();
- rollers_back_left_intake_talon_->Disable();
- rollers_back_right_intake_talon_->Disable();
- rollers_low_goal_talon_->Disable();
+ rollers_front_left_intake_talon_->SetDisabled();
+ rollers_front_right_intake_talon_->SetDisabled();
+ rollers_back_left_intake_talon_->SetDisabled();
+ rollers_back_right_intake_talon_->SetDisabled();
+ rollers_low_goal_talon_->SetDisabled();
}
::std::unique_ptr<Talon> rollers_front_left_intake_talon_,
diff --git a/y2015/wpilib/wpilib_interface.cc b/y2015/wpilib/wpilib_interface.cc
index 0c643b4..f44b82a 100644
--- a/y2015/wpilib/wpilib_interface.cc
+++ b/y2015/wpilib/wpilib_interface.cc
@@ -520,12 +520,12 @@
virtual void Write() override {
auto &queue = ::y2015::autonomous::can_control;
LOG_STRUCT(DEBUG, "will output", *queue);
- can_talon_->Set(queue->can_voltage / 12.0);
+ can_talon_->SetSpeed(queue->can_voltage / 12.0);
}
virtual void Stop() override {
LOG(WARNING, "Can output too old\n");
- can_talon_->Disable();
+ can_talon_->SetDisabled();
}
::std::unique_ptr<Talon> can_talon_;
@@ -549,14 +549,14 @@
virtual void Write() override {
auto &queue = ::frc971::control_loops::drivetrain_queue.output;
LOG_STRUCT(DEBUG, "will output", *queue);
- left_drivetrain_talon_->Set(queue->left_voltage / 12.0);
- right_drivetrain_talon_->Set(-queue->right_voltage / 12.0);
+ left_drivetrain_talon_->SetSpeed(queue->left_voltage / 12.0);
+ right_drivetrain_talon_->SetSpeed(-queue->right_voltage / 12.0);
}
virtual void Stop() override {
LOG(WARNING, "drivetrain output too old\n");
- left_drivetrain_talon_->Disable();
- right_drivetrain_talon_->Disable();
+ left_drivetrain_talon_->SetDisabled();
+ right_drivetrain_talon_->SetDisabled();
}
::std::unique_ptr<Talon> left_drivetrain_talon_;
@@ -589,18 +589,18 @@
virtual void Write() override {
auto &queue = ::y2015::control_loops::fridge::fridge_queue.output;
LOG_STRUCT(DEBUG, "will output", *queue);
- left_arm_talon_->Set(queue->left_arm / 12.0);
- right_arm_talon_->Set(-queue->right_arm / 12.0);
- left_elevator_talon_->Set(queue->left_elevator / 12.0);
- right_elevator_talon_->Set(-queue->right_elevator / 12.0);
+ left_arm_talon_->SetSpeed(queue->left_arm / 12.0);
+ right_arm_talon_->SetSpeed(-queue->right_arm / 12.0);
+ left_elevator_talon_->SetSpeed(queue->left_elevator / 12.0);
+ right_elevator_talon_->SetSpeed(-queue->right_elevator / 12.0);
}
virtual void Stop() override {
LOG(WARNING, "Fridge output too old.\n");
- left_arm_talon_->Disable();
- right_arm_talon_->Disable();
- left_elevator_talon_->Disable();
- right_elevator_talon_->Disable();
+ left_arm_talon_->SetDisabled();
+ right_arm_talon_->SetDisabled();
+ left_elevator_talon_->SetDisabled();
+ right_elevator_talon_->SetDisabled();
}
::std::unique_ptr<Talon> left_arm_talon_;
@@ -631,16 +631,16 @@
virtual void Write() override {
auto &queue = ::y2015::control_loops::claw_queue.output;
LOG_STRUCT(DEBUG, "will output", *queue);
- left_intake_talon_->Set(queue->intake_voltage / 12.0);
- right_intake_talon_->Set(-queue->intake_voltage / 12.0);
- wrist_talon_->Set(-queue->voltage / 12.0);
+ left_intake_talon_->SetSpeed(queue->intake_voltage / 12.0);
+ right_intake_talon_->SetSpeed(-queue->intake_voltage / 12.0);
+ wrist_talon_->SetSpeed(-queue->voltage / 12.0);
}
virtual void Stop() override {
LOG(WARNING, "Claw output too old.\n");
- left_intake_talon_->Disable();
- right_intake_talon_->Disable();
- wrist_talon_->Disable();
+ left_intake_talon_->SetDisabled();
+ right_intake_talon_->SetDisabled();
+ wrist_talon_->SetDisabled();
}
::std::unique_ptr<Talon> left_intake_talon_;
diff --git a/y2015_bot3/wpilib/wpilib_interface.cc b/y2015_bot3/wpilib/wpilib_interface.cc
index b92d02b..84e8664 100644
--- a/y2015_bot3/wpilib/wpilib_interface.cc
+++ b/y2015_bot3/wpilib/wpilib_interface.cc
@@ -344,14 +344,14 @@
virtual void Write() override {
auto &queue = drivetrain_queue.output;
LOG_STRUCT(DEBUG, "will output", *queue);
- left_drivetrain_talon_->Set(queue->left_voltage / 12.0);
- right_drivetrain_talon_->Set(-queue->right_voltage / 12.0);
+ left_drivetrain_talon_->SetSpeed(queue->left_voltage / 12.0);
+ right_drivetrain_talon_->SetSpeed(-queue->right_voltage / 12.0);
}
virtual void Stop() override {
LOG(WARNING, "drivetrain output too old\n");
- left_drivetrain_talon_->Disable();
- right_drivetrain_talon_->Disable();
+ left_drivetrain_talon_->SetDisabled();
+ right_drivetrain_talon_->SetDisabled();
}
::std::unique_ptr<Talon> left_drivetrain_talon_;
@@ -376,14 +376,14 @@
virtual void Write() override {
auto &queue = ::y2015_bot3::control_loops::elevator_queue.output;
LOG_STRUCT(DEBUG, "will output", *queue);
- elevator_talon1_->Set(queue->elevator / 12.0);
- elevator_talon2_->Set(-queue->elevator / 12.0);
+ elevator_talon1_->SetSpeed(queue->elevator / 12.0);
+ elevator_talon2_->SetSpeed(-queue->elevator / 12.0);
}
virtual void Stop() override {
LOG(WARNING, "Elevator output too old.\n");
- elevator_talon1_->Disable();
- elevator_talon2_->Disable();
+ elevator_talon1_->SetDisabled();
+ elevator_talon2_->SetDisabled();
}
::std::unique_ptr<Talon> elevator_talon1_;
@@ -408,14 +408,14 @@
virtual void Write() override {
auto &queue = ::y2015_bot3::control_loops::intake_queue.output;
LOG_STRUCT(DEBUG, "will output", *queue);
- intake_talon1_->Set(queue->intake / 12.0);
- intake_talon2_->Set(-queue->intake / 12.0);
+ intake_talon1_->SetSpeed(queue->intake / 12.0);
+ intake_talon2_->SetSpeed(-queue->intake / 12.0);
}
virtual void Stop() override {
LOG(WARNING, "Intake output too old.\n");
- intake_talon1_->Disable();
- intake_talon2_->Disable();
+ intake_talon1_->SetDisabled();
+ intake_talon2_->SetDisabled();
}
::std::unique_ptr<Talon> intake_talon1_;
@@ -443,14 +443,14 @@
virtual void Write() override {
auto &queue = ::y2015_bot3::autonomous::can_grabber_control;
LOG_STRUCT(DEBUG, "will output", *queue);
- can_grabber_talon1_->Set(queue->can_grabber_voltage / 12.0);
- can_grabber_talon2_->Set(-queue->can_grabber_voltage / 12.0);
+ can_grabber_talon1_->SetSpeed(queue->can_grabber_voltage / 12.0);
+ can_grabber_talon2_->SetSpeed(-queue->can_grabber_voltage / 12.0);
}
virtual void Stop() override {
LOG(WARNING, "Can grabber output too old\n");
- can_grabber_talon1_->Disable();
- can_grabber_talon2_->Disable();
+ can_grabber_talon1_->SetDisabled();
+ can_grabber_talon2_->SetDisabled();
}
::std::unique_ptr<Talon> can_grabber_talon1_, can_grabber_talon2_;
diff --git a/y2016/wpilib/wpilib_interface.cc b/y2016/wpilib/wpilib_interface.cc
index d7fc261..c998a3a 100644
--- a/y2016/wpilib/wpilib_interface.cc
+++ b/y2016/wpilib/wpilib_interface.cc
@@ -579,14 +579,14 @@
virtual void Write() override {
auto &queue = ::frc971::control_loops::drivetrain_queue.output;
LOG_STRUCT(DEBUG, "will output", *queue);
- drivetrain_left_talon_->Set(queue->left_voltage / 12.0);
- drivetrain_right_talon_->Set(-queue->right_voltage / 12.0);
+ drivetrain_left_talon_->SetSpeed(queue->left_voltage / 12.0);
+ drivetrain_right_talon_->SetSpeed(-queue->right_voltage / 12.0);
}
virtual void Stop() override {
LOG(WARNING, "drivetrain output too old\n");
- drivetrain_left_talon_->Disable();
- drivetrain_right_talon_->Disable();
+ drivetrain_left_talon_->SetDisabled();
+ drivetrain_right_talon_->SetDisabled();
}
::std::unique_ptr<Talon> drivetrain_left_talon_, drivetrain_right_talon_;
@@ -611,14 +611,14 @@
auto &queue = ::y2016::control_loops::shooter::shooter_queue.output;
LOG_STRUCT(DEBUG, "will output", *queue);
- shooter_left_talon_->Set(queue->voltage_left / 12.0);
- shooter_right_talon_->Set(-queue->voltage_right / 12.0);
+ shooter_left_talon_->SetSpeed(queue->voltage_left / 12.0);
+ shooter_right_talon_->SetSpeed(-queue->voltage_right / 12.0);
}
virtual void Stop() override {
LOG(WARNING, "Shooter output too old.\n");
- shooter_left_talon_->Disable();
- shooter_right_talon_->Disable();
+ shooter_left_talon_->SetDisabled();
+ shooter_right_talon_->SetDisabled();
}
::std::unique_ptr<Talon> shooter_left_talon_, shooter_right_talon_;
@@ -658,25 +658,25 @@
virtual void Write() override {
auto &queue = ::y2016::control_loops::superstructure_queue.output;
LOG_STRUCT(DEBUG, "will output", *queue);
- intake_talon_->Set(::aos::Clip(queue->voltage_intake, -kMaxBringupPower,
- kMaxBringupPower) /
- 12.0);
- shoulder_talon_->Set(::aos::Clip(-queue->voltage_shoulder,
- -kMaxBringupPower, kMaxBringupPower) /
- 12.0);
- wrist_talon_->Set(
+ intake_talon_->SetSpeed(::aos::Clip(queue->voltage_intake,
+ -kMaxBringupPower, kMaxBringupPower) /
+ 12.0);
+ shoulder_talon_->SetSpeed(::aos::Clip(-queue->voltage_shoulder,
+ -kMaxBringupPower, kMaxBringupPower) /
+ 12.0);
+ wrist_talon_->SetSpeed(
::aos::Clip(queue->voltage_wrist, -kMaxBringupPower, kMaxBringupPower) /
12.0);
- top_rollers_talon_->Set(-queue->voltage_top_rollers / 12.0);
- bottom_rollers_talon_->Set(-queue->voltage_bottom_rollers / 12.0);
- climber_talon_->Set(-queue->voltage_climber / 12.0);
+ top_rollers_talon_->SetSpeed(-queue->voltage_top_rollers / 12.0);
+ bottom_rollers_talon_->SetSpeed(-queue->voltage_bottom_rollers / 12.0);
+ climber_talon_->SetSpeed(-queue->voltage_climber / 12.0);
}
virtual void Stop() override {
LOG(WARNING, "Superstructure output too old.\n");
- intake_talon_->Disable();
- shoulder_talon_->Disable();
- wrist_talon_->Disable();
+ intake_talon_->SetDisabled();
+ shoulder_talon_->SetDisabled();
+ wrist_talon_->SetDisabled();
}
::std::unique_ptr<Talon> intake_talon_, shoulder_talon_, wrist_talon_,
diff --git a/y2016_bot4/wpilib/wpilib_interface.cc b/y2016_bot4/wpilib/wpilib_interface.cc
index 70039f5..065494f 100644
--- a/y2016_bot4/wpilib/wpilib_interface.cc
+++ b/y2016_bot4/wpilib/wpilib_interface.cc
@@ -171,18 +171,18 @@
virtual void Write() override {
auto &queue = ::frc971::control_loops::drivetrain_queue.output;
LOG_STRUCT(DEBUG, "will output", *queue);
- drivetrain_left_talon_0_->Set(-queue->left_voltage / 12.0);
- drivetrain_left_talon_1_->Set(-queue->left_voltage / 12.0);
- drivetrain_right_talon_0_->Set(queue->right_voltage / 12.0);
- drivetrain_right_talon_1_->Set(queue->right_voltage / 12.0);
+ drivetrain_left_talon_0_->SetSpeed(-queue->left_voltage / 12.0);
+ drivetrain_left_talon_1_->SetSpeed(-queue->left_voltage / 12.0);
+ drivetrain_right_talon_0_->SetSpeed(queue->right_voltage / 12.0);
+ drivetrain_right_talon_1_->SetSpeed(queue->right_voltage / 12.0);
}
virtual void Stop() override {
LOG(WARNING, "drivetrain output too old\n");
- drivetrain_left_talon_0_->Disable();
- drivetrain_right_talon_0_->Disable();
- drivetrain_left_talon_1_->Disable();
- drivetrain_right_talon_1_->Disable();
+ drivetrain_left_talon_0_->SetDisabled();
+ drivetrain_right_talon_0_->SetDisabled();
+ drivetrain_left_talon_1_->SetDisabled();
+ drivetrain_right_talon_1_->SetDisabled();
}
::std::unique_ptr<Talon> drivetrain_left_talon_0_, drivetrain_right_talon_0_,