M1M3 Support System
Loading...
Searching...
No Matches
Model.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 MODEL_H_
25#define MODEL_H_
26
27#include <chrono>
28#include <mutex>
29#include <string>
30
31#include <cRIO/Singleton.h>
32
33#include <Accelerometer.h>
34#include <BumpTestController.h>
35#include <Displacement.h>
36#include <ForceActuatorApplicationSettings.h>
37#include <ForceController.h>
38#include <Gyro.h>
39#include <HardpointActuatorApplicationSettings.h>
40#include <HardpointMonitorApplicationSettings.h>
41#include <HardpointTestController.h>
42#include <Inclinometer.h>
43#include <InclinometerSettings.h>
44#include <MirrorLowerController.h>
45#include <MirrorRaiseController.h>
46#include <PIDSettings.h>
47#include <PositionController.h>
48#include <PositionControllerSettings.h>
49#include <PowerController.h>
50#include <ProfileController.h>
51#include <SSILCs.h>
52#include <SafetyController.h>
53#include <SlewController.h>
54#include <StartCommand.h>
55#include <StateTypes.h>
56
57namespace LSST {
58namespace M1M3 {
59namespace SS {
60
67class Model : public cRIO::Singleton<Model> {
68public:
69 Model(token);
70 virtual ~Model();
71
72 inline Displacement *getDisplacement() { return _displacement; }
73 inline Inclinometer *getInclinometer() { return _inclinometer; }
74 inline SSILCs *getILC() { return _ilc; }
75 inline ForceController *getForceController() { return _forceController; }
76 inline SafetyController *getSafetyController() { return _safetyController; }
77 inline PositionController *getPositionController() { return _positionController; }
78 inline Accelerometer *getAccelerometer() { return _accelerometer; }
79 inline PowerController *getPowerController() { return _powerController; }
80 inline MirrorRaiseController *getMirrorRaiseController() { return _mirrorRaiseController; }
81 inline MirrorLowerController *getMirrorLowerController() { return _mirrorLowerController; }
82 inline Gyro *getGyro() { return _gyro; }
83 inline ProfileController *getProfileController() { return &_profileController; }
84 inline BumpTestController *getBumpTestController() { return &_bumpTestController; }
85 inline HardpointTestController *getHardpointTestController() { return _hardpointTestController; }
86 inline SlewController *getSlewController() { return &_slewController; }
87
88 void setCachedTimestamp(double timestamp) { this->_cachedTimestamp = timestamp; }
89 double getCachedTimestamp() { return _cachedTimestamp; }
90
91 void loadSettings(const char *settingsToApply);
92 void initialize(StartCommand *command);
93
94 void publishStateChange(States::Type newState);
95 void publishRecommendedSettings();
96 void publishOuterLoop(std::chrono::nanoseconds executionTime);
97
98 void exitControl();
99 void waitForExitControl();
100
101private:
102 Model &operator=(const Model &) = delete;
103 Model(const Model &) = delete;
104
105 void _populateHardpointActuatorInfo(
106 HardpointActuatorApplicationSettings *hardpointActuatorApplicationSettings);
107 void _populateHardpointMonitorInfo(
108 HardpointMonitorApplicationSettings *hardpointMonitorApplicationSettings);
109
110 Displacement *_displacement;
111 Inclinometer *_inclinometer;
112 SSILCs *_ilc;
113 ForceController *_forceController;
114 SafetyController *_safetyController;
115 PositionController *_positionController;
116 Accelerometer *_accelerometer;
117 PowerController *_powerController;
118 MirrorRaiseController *_mirrorRaiseController;
119 MirrorLowerController *_mirrorLowerController;
120 Gyro *_gyro;
121 ProfileController _profileController;
122 BumpTestController _bumpTestController;
123 HardpointTestController *_hardpointTestController;
124 SlewController _slewController;
125
126 std::mutex _mutex;
127
128 double _cachedTimestamp;
129};
130
131} /* namespace SS */
132} /* namespace M1M3 */
133} /* namespace LSST */
134
135#endif /* MODEL_H_ */
Definition Accelerometer.h:38
Performs bump test on single force actuator (FA).
Definition BumpTestController.h:93
Definition Displacement.h:42
Coordinate force actuators force calculcation.
Definition ForceController.h:128
Definition Gyro.h:42
Loads Hardpoint Settings.
Definition HardpointActuatorApplicationSettings.h:51
Definition HardpointMonitorApplicationSettings.h:40
Performs hardpoint test.
Definition HardpointTestController.h:41
Definition Inclinometer.h:42
Controls mirror raising operation.
Definition MirrorLowerController.h:44
Controls mirror raising peration.
Definition MirrorRaiseController.h:50
Contains pointers to objects communicating with cRIO boards.
Definition Model.h:67
Controls M1M3 position.
Definition PositionController.h:61
Definition PowerController.h:45
Definition ProfileController.h:33
Definition SSILCs.h:67
Controls mirror safety.
Definition SafetyController.h:50
Provides methods to enter and exit slew configuration.
Definition SlewController.h:36
Definition StartCommand.h:43