diff --git a/README.md b/README.md index 034a087..87c3476 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ -# 1771-2016-Robot \ No newline at end of file +# 1771-2016-Robot +the only current errors are spelling errors diff --git a/Transmission.hpp b/Transmission.hpp index ef3f16b..846acbf 100644 --- a/Transmission.hpp +++ b/Transmission.hpp @@ -8,32 +8,58 @@ #ifndef SRC_TRANSMISSION_HPP_ #define SRC_TRANSMISSION_HPP_ -Solenoid* shift = new Solenoid(0); +#include"robotMap.h" -template -struct Transmission : motorController +Solenoid* shift = new Solenoid(SHIFT_SOLENOID); + +struct Transmission : CANTalon { public: - explicit Transmission(int t1,int t2): - con1{new motorController(t1)}, - con2{new motorController(t2)} + explicit Transmission(int t1,int t2) { + con1 = new CANTalon(t1); con1->SetFeedbackDevice(CANTalon::QuadEncoder); con1->SetControlMode(CANSpeedController::kCurrent); con1->ConfigNeutralMode(CANSpeedController::kNeutralMode_Coast); con1->EnableControl(); + con2 = new CANTalon(t2); con2->SetFeedbackDevice(CANTalon::QuadEncoder); con2->SetControlMode(CANSpeedController::kCurrent); con2->ConfigNeutralMode(CANSpeedController::kNeutralMode_Coast); con2->EnableControl(); } - void Shove(double j1) + virtual ~Transmission(); + + /** + * General percentage based speed control + * params: -1 - 1 + */ + void Set(float set) + { + if(con1->GetControlMode()!=CANSpeedController::kPercentVbus) + con1->SetControlMode(CANSpeedController::kPercentVbus); + con1->Set(set); + con2->Set(set); + } + + /** + * Prevents the breaker from blowing and + * increases torque in a shoving match + */ + void Shove(double set) { + shift->Set(0); // Shift to low gear + set-=set/80; // Prevent breaker from blowing + set*=40; + if(con1->GetControlMode()!=CANSpeedController::kCurrent) + con1->SetControlMode(CANSpeedController::kCurrent); + con1->Set(set); + con2->Set(set); } private: - motorController *con1, - *con2; + CANTalon *con1, + *con2; }; #endif /* SRC_TRANSMISSION_HPP_ */