M1M3 Support System
Loading...
Searching...
No Matches
Context.h
1/*
2 * This file is part of LSST M1M3 support system package.
3 *
4 * Developed for the Vera C. Rubin Telescope and Site System.
5 * This product includes software developed by the LSST Project
6 * (https://www.lsst.org).
7 * See the COPYRIGHT file at the top-level directory of this distribution
8 * for details of code ownership.
9 *
10 * This program is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 */
23
24#ifndef CONTEXT_H_
25#define CONTEXT_H_
26
27#include <AbortProfileCommand.h>
28#include <AbortRaiseM1M3Command.h>
29#include <ApplyActiveOpticForcesCommand.h>
30#include <ApplyOffsetForcesByMirrorForceCommand.h>
31#include <ApplyOffsetForcesCommand.h>
32#include <BoosterValveCloseCommand.h>
33#include <BoosterValveOpenCommand.h>
34#include <ClearActiveOpticForcesCommand.h>
35#include <ClearOffsetForcesCommand.h>
36#include <ClearSlewFlagCommand.h>
37#include <DisableCommand.h>
38#include <DisableForceActuatorCommand.h>
39#include <DisableHardpointChaseCommand.h>
40#include <DisableHardpointCorrectionsCommand.h>
41#include <EnableAllForceActuatorsCommand.h>
42#include <EnableCommand.h>
43#include <EnableDisableForceComponentCommand.h>
44#include <EnableForceActuatorCommand.h>
45#include <EnableHardpointChaseCommand.h>
46#include <EnableHardpointCorrectionsCommand.h>
47#include <EnterControlCommand.h>
48#include <EnterEngineeringCommand.h>
49#include <ExitControlCommand.h>
50#include <ExitEngineeringCommand.h>
51#include <ForceActuatorBumpTestCommand.h>
52#include <KillForceActuatorBumpTestCommand.h>
53#include <KillHardpointTestCommand.h>
54#include <LowerM1M3Command.h>
55#include <Model.h>
56#include <MoveHardpointActuatorsCommand.h>
57#include <PauseM1M3RaisingLoweringCommand.h>
58#include <PositionM1M3Command.h>
59#include <RaiseM1M3Command.h>
60#include <ResetPIDCommand.h>
61#include <ResumeM1M3RaisingLoweringCommand.h>
62#include <RunMirrorForceProfileCommand.h>
63#include <SetSlewControllerSettingsCommand.h>
64#include <SetSlewFlagCommand.h>
65#include <StandbyCommand.h>
66#include <StartCommand.h>
67#include <StateTypes.h>
68#include <StaticStateFactory.h>
69#include <StopHardpointMotionCommand.h>
70#include <TMAAzimuthSampleCommand.h>
71#include <TMAElevationSampleCommand.h>
72#include <TestHardpointCommand.h>
73#include <TranslateM1M3Command.h>
74#include <TurnAirOffCommand.h>
75#include <TurnAirOnCommand.h>
76#include <TurnLightsOffCommand.h>
77#include <TurnLightsOnCommand.h>
78#include <TurnPowerOffCommand.h>
79#include <TurnPowerOnCommand.h>
80#include <UpdateCommand.h>
81#include <UpdatePIDCommand.h>
82
83namespace LSST {
84namespace M1M3 {
85namespace SS {
86
96class Context {
97public:
98 Context();
99
105 static Context &get();
106
112 void enterControl(EnterControlCommand *command);
113 void start(StartCommand *command);
114 void enable(EnableCommand *command);
115 void disable(DisableCommand *command);
116 void standby(StandbyCommand *command);
117 void exitControl(ExitControlCommand *command);
118 void update(UpdateCommand *command);
119 void setSlewFlag(SetSlewFlagCommand *command);
120 void clearSlewFlag(ClearSlewFlagCommand *command);
121 void turnAirOn(TurnAirOnCommand *command);
122 void turnAirOff(TurnAirOffCommand *command);
123 void applyOffsetForces(ApplyOffsetForcesCommand *command);
124 void clearOffsetForces(ClearOffsetForcesCommand *command);
125 void raiseM1M3(RaiseM1M3Command *command);
126 void lowerM1M3(LowerM1M3Command *command);
127 void pauseM1M3RaisingLowering(PauseM1M3RaisingLoweringCommand *command);
128 void resumeM1M3RaisingLowering(ResumeM1M3RaisingLoweringCommand *command);
129 void applyActiveOpticForces(ApplyActiveOpticForcesCommand *command);
130 void clearActiveOpticForces(ClearActiveOpticForcesCommand *command);
131 void enterEngineering(EnterEngineeringCommand *command);
132 void exitEngineering(ExitEngineeringCommand *command);
133 void boosterValveOpen(BoosterValveOpenCommand *command);
134 void boosterValveClose(BoosterValveCloseCommand *command);
135 void testHardpoint(TestHardpointCommand *command);
136 void killHardpointTest(KillHardpointTestCommand *command);
137 void moveHardpointActuators(MoveHardpointActuatorsCommand *command);
138 void enableHardpointChase(EnableHardpointChaseCommand *command);
139 void disableHardpointChase(DisableHardpointChaseCommand *command);
140 void abortRaiseM1M3(AbortRaiseM1M3Command *command);
141 void translateM1M3(TranslateM1M3Command *command);
142 void stopHardpointMotion(StopHardpointMotionCommand *command);
143 void storeTMAAzimuthSample(TMAAzimuthSampleCommand *command);
144 void storeTMAElevationSample(TMAElevationSampleCommand *command);
145 void positionM1M3(PositionM1M3Command *command);
146 void turnLightsOn(TurnLightsOnCommand *command);
147 void turnLightsOff(TurnLightsOffCommand *command);
148 void turnPowerOn(TurnPowerOnCommand *command);
149 void turnPowerOff(TurnPowerOffCommand *command);
150 void enableHardpointCorrections(EnableHardpointCorrectionsCommand *command);
151 void disableHardpointCorrections(DisableHardpointCorrectionsCommand *command);
152 void runMirrorForceProfile(RunMirrorForceProfileCommand *command);
153 void abortProfile(AbortProfileCommand *command);
154 void applyOffsetForcesByMirrorForce(ApplyOffsetForcesByMirrorForceCommand *command);
155 void updatePID(UpdatePIDCommand *command);
156 void resetPID(ResetPIDCommand *command);
157 void forceActuatorBumpTest(ForceActuatorBumpTestCommand *command);
158 void killForceActuatorBumpTest(KillForceActuatorBumpTestCommand *command);
159 void disableForceActuator(DisableForceActuatorCommand *command);
160 void enableForceActuator(EnableForceActuatorCommand *command);
161 void enableAllForceActuators(EnableAllForceActuatorsCommand *command);
162 void enableDisableForceComponent(EnableDisableForceComponentCommand *command);
163 void setSlewControllerSettings(SetSlewControllerSettingsCommand *command);
164
165private:
166 Context &operator=(const Context &) = delete;
167 Context(const Context &) = delete;
168
169 States::Type _currentState;
170
171 void _updateCurrentStateIfRequired(States::Type potentialNewState);
172};
173
174} /* namespace SS */
175} /* namespace M1M3 */
176} /* namespace LSST */
177
178#endif /* CONTEXT_H_ */
Definition AbortProfileCommand.h:35
Definition AbortRaiseM1M3Command.h:37
Definition ApplyActiveOpticForcesCommand.h:35
Definition ApplyOffsetForcesByMirrorForceCommand.h:35
Definition ApplyOffsetForcesCommand.h:35
Sets slew flag for force actuators.
Definition BoosterValveCloseCommand.h:40
Command system to open booster valves.
Definition BoosterValveOpenCommand.h:39
Definition ClearActiveOpticForcesCommand.h:35
Definition ClearOffsetForcesCommand.h:35
Definition ClearSlewFlagCommand.h:35
The context used to execute commands against the current state.
Definition Context.h:96
void enterControl(EnterControlCommand *command)
Executes EnterControlCommand actions.
Definition Context.cpp:45
static Context & get()
Retrieve Context singleton.
Definition Context.cpp:40
Definition DisableCommand.h:40
Disable single force actuator for use in static support.
Definition DisableForceActuatorCommand.h:38
Definition DisableHardpointChaseCommand.h:35
Definition DisableHardpointCorrectionsCommand.h:35
Enable all force actuators for use in static support.
Definition EnableAllForceActuatorsCommand.h:38
Definition EnableCommand.h:40
Definition EnableDisableForceComponentCommand.h:35
Enable single force actuator for use in static support.
Definition EnableForceActuatorCommand.h:38
Definition EnableHardpointChaseCommand.h:35
Definition EnableHardpointCorrectionsCommand.h:35
Definition EnterControlCommand.h:39
Definition EnterEngineeringCommand.h:34
Definition ExitControlCommand.h:40
Definition ExitEngineeringCommand.h:34
Command to start bump testing of force actuator.
Definition ForceActuatorBumpTestCommand.h:40
Stops any running force actuator bump test.
Definition KillForceActuatorBumpTestCommand.h:40
Abort any hardpoint test in progress,.
Definition KillHardpointTestCommand.h:38
Definition LowerM1M3Command.h:35
Definition MoveHardpointActuatorsCommand.h:35
Definition PauseM1M3RaisingLoweringCommand.h:34
Definition PositionM1M3Command.h:35
Definition RaiseM1M3Command.h:35
Definition ResetPIDCommand.h:35
Definition ResumeM1M3RaisingLoweringCommand.h:34
Definition RunMirrorForceProfileCommand.h:35
Definition SetSlewControllerSettingsCommand.h:35
Definition SetSlewFlagCommand.h:35
Definition StandbyCommand.h:40
Definition StartCommand.h:43
Definition StopHardpointMotionCommand.h:35
Definition TMAAzimuthSampleCommand.h:36
Definition TMAElevationSampleCommand.h:36
Definition TestHardpointCommand.h:35
Definition TranslateM1M3Command.h:35
Definition TurnAirOffCommand.h:35
Definition TurnAirOnCommand.h:35
Definition TurnLightsOffCommand.h:35
Definition TurnLightsOnCommand.h:35
Definition TurnPowerOffCommand.h:35
Definition TurnPowerOnCommand.h:35
Definition UpdateCommand.h:39
Definition UpdatePIDCommand.h:35