Motorcortex Core  version: 2.7.6
drive_sercos_fsm_impl.h
1 /*
2  * Developer : Alexey Zakharov (alexey.zakharov@vectioneer.com)
3  * All rights reserved. Copyright (c) 2018 VECTIONEER.
4  */
5 
6 #ifndef MOTORCORTEX_CORE_DRIVE_SERCOS_FSM_IMPL_H
7 #define MOTORCORTEX_CORE_DRIVE_SERCOS_FSM_IMPL_H
8 
9 #include "drive_sercos_fsm_base.h"
10 
11 namespace mcx {
12 
13 namespace drive {
14 
15 struct SercosFsmData;
16 
17 /*
18  * Drive not ready for power on (e.g. P2)
19  */
21 public:
22  explicit NotReadyToPowerOn(SercosFsmData& data);
23 
24  void enter() override;
25 
26  state_machine::EventStatus faultAcknowledge() override;
27 };
28 
29 /*
30  * Ready for power on (bb)
31  */
33 public:
34  explicit ReadyForPowerOn(SercosFsmData& data);
35 
36  void enter() override;
37 
38  // user input commands
39  state_machine::EventStatus gotoDisengage() override;
40 
41  state_machine::EventStatus gotoEngage() override;
42 };
43 
44 /*
45  * Control section and power ready for op (Ab)
46  */
48 public:
49  explicit ReadyForOperation(SercosFsmData& data);
50 
51  void enter() override;
52 
53  // user input commands
54  state_machine::EventStatus gotoOff() override;
55 
56  state_machine::EventStatus gotoEngage() override;
57 };
58 
59 /*
60  * In operation, with torque (e.g. AF)
61  */
62 class InOperation : public SercosFsmBase {
63 public:
64  explicit InOperation(SercosFsmData& data);
65 
66  void enter() override;
67 
68  void iterate(double dt) override;
69 
70  // user input commands
71  state_machine::EventStatus gotoOff() override;
72 
73  state_machine::EventStatus gotoDisengage() override;
74 
75  state_machine::EventStatus gotoQuickStop() override;
76 
77 };
78 
79 /*
80  * TODO
81  */
82 class Halt : public SercosFsmBase {
83 public:
84  explicit Halt(SercosFsmData& data);
85 
86  void enter() override;
87 
88 // void iterate(double dt) override;
89 
90  // user input commands
91  state_machine::EventStatus gotoOff() override;
92 
93  state_machine::EventStatus gotoDisengage() override;
94 
95  state_machine::EventStatus gotoEngage() override;
96 };
97 
98 /*
99  * TODO
100  */
101 class FaultSercos : public SercosFsmBase {
102 public:
103  explicit FaultSercos(SercosFsmData& data);
104 
105  void enter() override;
106 
107  void iterate(double dt) override;
108 
109  void leave() override;
110 
111  state_machine::EventStatus faultAcknowledge() override;
112 
113 private:
114  double upload_error_code_timer_{};
115 
116 };
117 
118 } // namespace drive
119 
120 } // namespace mcx
121 
122 #endif //MOTORCORTEX_CORE_DRIVE_SERCOS_FSM_IMPL_H
mcx::drive::FaultSercos
Definition: drive_sercos_fsm_impl.h:101
mcx::drive::ReadyForOperation
Definition: drive_sercos_fsm_impl.h:47
mcx::drive::InOperation
Definition: drive_sercos_fsm_impl.h:62
mcx::drive::SercosFsmData
Definition: drive_sercos_fsm_data.h:135
mcx::drive::NotReadyToPowerOn
Definition: drive_sercos_fsm_impl.h:20
mcx::drive::ReadyForPowerOn
Definition: drive_sercos_fsm_impl.h:32
mcx::drive::SercosFsmBase
Definition: drive_sercos_fsm_base.h:18
mcx::drive::Halt
Definition: drive_sercos_fsm_impl.h:82