LRT13  1.0
 All Classes Namespaces Functions Variables Enumerations Enumerator
AutoClimb.h
1 #ifndef AUTOCLIMB_H_
2 #define AUTOCLIMB_H_
3 
4 #include "../Config/Configurable.h"
5 #include "../Components/Climber.h"
6 #include "../ComponentData/ClimberData.h"
7 #include "../ComponentData/ShooterData.h"
8 #include "../ComponentData/ComponentData.h"
9 #include "../Process/AsyncProcess.h"
10 #include "../Sensors/IMU.h"
11 
12 using namespace data;
13 using namespace data::climber;
14 
15 typedef enum
16 {
17  USER_ABORT = 0x10,
18  COMMUNICATION_ERROR = 0x20,
19  WINCH_PAWL_TIMEOUT = 0x30,
20  WINCH_PAWL_OVER_CURRENT = 0x40,
21 } ABORT_CODE;
22 
23 typedef enum
24 {
25  ABORT_NEXT_LEVEL = 0x00, // don't attempt to continue the climb
26  LOCKDOWN = 0x10, // brace for impact!
27 } ABORT_MODE;
28 
29 class AutoClimb : public AsyncProcess, Configurable
30 {
31 public:
32  static AutoClimb* Instance();
33 
34  AutoClimb();
35  ~AutoClimb();
36 
37  INT32 Tick();
38 
39  void Configure();
40 
41  void Reset();
42 
43  void ClimbOneLevel(bool force=false);
44 
45  bool CanAbort();
46  void UserAbort(bool force=false, ABORT_MODE severity=ABORT_NEXT_LEVEL);
47 private:
48  static AutoClimb* m_instance;
49 
50  void AbortClimb(ABORT_CODE errorCode, bool force=false, ABORT_MODE severity=ABORT_NEXT_LEVEL);
51 
52  bool m_canAbort;
53  bool m_aborted;
54 
55  bool m_climbRequested;
56  bool m_climbForce;
57 
58  int m_climbLevel;
59 
60  double m_winchPawlAbortThreshold;
61  double m_winchPawlClimbThreshold;
62 
63  ComponentData* m_componentData;
64  ClimberData* m_climber;
65  IMU* m_imu;
66 };
67 
68 #endif