LRT13  1.0
 All Classes Namespaces Functions Variables Enumerations Enumerator
Climber.h
1 #ifndef CLIMBER_H_
2 #define CLIMBER_H_
3 
4 #include <string>
5 
6 #include "../ComponentData/ShooterData.h"
7 #include "../ComponentData/RobotData.h"
8 #include "../ComponentData/WinchPawlData.h"
9 #include "../ComponentData/ClimberData.h"
10 #include "../Config/Configurable.h"
11 #include "../Log/Loggable.h"
12 #include "../Utils/PID.h"
13 #include "../ComponentData/DrivetrainData.h"
14 #include "../SpeedController/AsyncCANJaguar.h"
15 #include "../Pneumatics/Pneumatics.h"
16 #include "../ComponentData/ClimberData.h"
17 #include "../Sensors/DriveEncoders.h"
18 #include "../Servo/LRTServo.h"
19 #include "../Utils/SmarterDashboard.h"
20 #include "../Network/MessageType.h"
21 #include "../Network/NetChannel.h"
22 #include "../Utils/Profiler.h"
23 #include "../Utils/LCD.h"
24 #include "AnalogChannel.h"
25 
26 #include "Component.h"
27 
28 using namespace data;
29 
34 class Climber : public Component, public Configurable, public Loggable
35 {
36 public:
37  Climber();
38  ~Climber();
39 
40  virtual void onEnable();
41  virtual void onDisable();
42 
43  virtual void enabledPeriodic();
44  virtual void disabledPeriodic();
45 
46  virtual void Configure();
47  virtual void Log();
48 private:
49  void disengagePTO(bool force=false);
50  void engagePTO(bool force=false);
51 
52  void winchPawlUp(bool fast=true);
53  void winchPawlDown(bool fast=true);
54  void winchPawlOff();
55 
56  bool m_ptoEngaged;
57 
58  string m_configSection;
59 
60  Pneumatics* m_climberArms;
61  Pneumatics* m_hooks;
62 
63  double m_winch_current_threshold;
64  double m_winch_engage_duty_cycle;
65  int m_timer;
66  int m_timer_threshold;
67  int m_side_engaged;
68  DigitalInput m_digital_input_left, m_digital_input_right;
69  bool m_hasStartedEngaging;
70  bool m_isEnabled;
71  int m_drive_train_position;
72  int m_drive_train_position_threshold;
73  DriveEncoders* m_driving_encoders;
74  LRTServo m_servo_left;
75  LRTServo m_servo_right;
76  int m_servo_left_engaged_position;
77  int m_servo_right_engaged_position;
78  int m_servo_left_disengaged_position;
79  int m_servo_right_disengaged_position;
80  int m_disengageTimer_threshold;
81  GearTooth m_winch_gear_tooth;
82  AnalogChannel *m_pressure_a;
83  AnalogChannel *m_pressure_b;
84  NetworkTable *table;
85  double m_pressure_scale;
86  int m_gear_tooth_ticks_position;
87  int m_gear_tooth_threshold;
88  data::climber::state m_previous_state;
89  bool m_paused;
90  double m_driveSpeed;
91  int m_armUpTicks;
92  int m_armUpTicksComplete;
93  int m_armDownTicks;
94  int m_swingWaitTicks;
95  int m_climbingLevelGearToothTicks[3];
96  float m_drivetrainCurrentLimit;
97 
98  ofstream m_logFile;
99 
100  const static int m_winchPawlUpDirection = 1;
101  const static int m_winchPawlDownDirection = -1;
102 
103  data::climber::state m_state;
104  data::climber::state m_waitGoToState; // when the operator wishes to skip to some state
105 
106  data::shooter::ShooterData* m_shooterData;
107  data::climber::WinchPawlData* m_winchPawl;
108  data::climber::ClimberData* m_climberData;
109 };
110 
111 #endif