Moved 2014 drivetrain code into y2014 namespace.
Change-Id: I74a1922f846a288725df2aea01c5c9e1b99e07b3
diff --git a/y2014/control_loops/drivetrain/polydrivetrain.h b/y2014/control_loops/drivetrain/polydrivetrain.h
index 82ebd24..1f9a27b 100644
--- a/y2014/control_loops/drivetrain/polydrivetrain.h
+++ b/y2014/control_loops/drivetrain/polydrivetrain.h
@@ -8,35 +8,34 @@
#include "frc971/control_loops/state_feedback_loop.h"
#include "y2014/control_loops/drivetrain/drivetrain_dog_motor_plant.h"
-namespace frc971 {
+namespace y2014 {
namespace control_loops {
+namespace drivetrain {
class PolyDrivetrain {
public:
enum Gear { HIGH, LOW, SHIFTING_UP, SHIFTING_DOWN };
// Stall Torque in N m
- static constexpr double kStallTorque =
- ::y2014::control_loops::drivetrain::kStallTorque;
+ static constexpr double kStallTorque = kStallTorque;
// Stall Current in Amps
- static constexpr double kStallCurrent = ::y2014::control_loops::drivetrain::kStallCurrent;
+ static constexpr double kStallCurrent = kStallCurrent;
// Free Speed in RPM. Used number from last year.
- static constexpr double kFreeSpeed =
- ::y2014::control_loops::drivetrain::kFreeSpeedRPM;
+ static constexpr double kFreeSpeed = kFreeSpeedRPM;
// Free Current in Amps
- static constexpr double kFreeCurrent =
- ::y2014::control_loops::drivetrain::kFreeCurrent;
- static constexpr double kWheelRadius =
- ::y2014::control_loops::drivetrain::kWheelRadius;
- // Resistance of the motor, divided by the number of motors.
- static constexpr double kR = ::y2014::control_loops::drivetrain::kR;
+ static constexpr double kFreeCurrent = kFreeCurrent;
+ static constexpr double kWheelRadius = kWheelRadius;
+ // Resistance of the motor, divided by the number of motors per side.
+ static constexpr double kR = kR;
// Motor velocity constant
- static constexpr double Kv = ::y2014::control_loops::drivetrain::kV;
+ static constexpr double Kv = kV;
// Torque constant
- static constexpr double Kt = ::y2014::control_loops::drivetrain::kT;
+ static constexpr double Kt = kT;
PolyDrivetrain();
+ int controller_index() const { return loop_->controller_index(); }
+
static bool IsInGear(Gear gear) { return gear == LOW || gear == HIGH; }
static double MotorSpeed(const constants::ShifterHallEffect &hall_effect,
@@ -47,7 +46,8 @@
void SetGoal(double wheel, double throttle, bool quickturn, bool highgear);
- void SetPosition(const DrivetrainQueue::Position *position);
+ void SetPosition(
+ const ::frc971::control_loops::DrivetrainQueue::Position *position);
double FilterVelocity(double throttle);
@@ -55,7 +55,7 @@
void Update();
- void SendMotors(DrivetrainQueue::Output *output);
+ void SendMotors(::frc971::control_loops::DrivetrainQueue::Output *output);
private:
const ::aos::controls::HPolytope<2> U_Poly_;
@@ -70,12 +70,13 @@
double position_time_delta_;
Gear left_gear_;
Gear right_gear_;
- DrivetrainQueue::Position last_position_;
- DrivetrainQueue::Position position_;
+ ::frc971::control_loops::DrivetrainQueue::Position last_position_;
+ ::frc971::control_loops::DrivetrainQueue::Position position_;
int counter_;
};
+} // namespace drivetrain
} // namespace control_loops
-} // namespace frc971
+} // namespace y2014
#endif // Y2014_CONTROL_LOOPS_DRIVETRAIN_POLYDRIVETRAIN_H_