M1M3 Support System
Loading...
Searching...
No Matches
ForceComponent.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 LSST_M1M3_SS_FORCECONTROLLER_FORCECOMPONENT_H_
25#define LSST_M1M3_SS_FORCECONTROLLER_FORCECOMPONENT_H_
26
27#include <string>
28
29#include <ForceComponentSettings.h>
30#include <cRIO/DataTypes.h>
31
32namespace LSST {
33namespace M1M3 {
34namespace SS {
35
40enum ForceComponentState { INITIALISING, DISABLED, ENABLED, DISABLING };
41
66public:
73 ForceComponent(const char *name, ForceComponentSettings *forceComponentSettings);
74 virtual ~ForceComponent();
75
81 const char *getName() { return _name; }
82
88 bool isInitialising() { return _state == INITIALISING; }
89
95 bool isEnabled() { return _state == ENABLED; }
96
102 bool isDisabling() { return _state == DISABLING; }
103
110 bool isActive() { return _state == INITIALISING || _state == ENABLED || _state == DISABLING; }
111
115 void enable();
116
121 void disable();
122
129 virtual void postEnableDisableActions() = 0;
130
131 void update();
132
133 void reset();
134
135protected:
142 virtual void postUpdateActions() = 0;
143
145 float xCurrent[FA_X_COUNT];
147 float yCurrent[FA_Y_COUNT];
149 float zCurrent[FA_Z_COUNT];
150
152 float xTarget[FA_X_COUNT];
154 float yTarget[FA_Y_COUNT];
156 float zTarget[FA_Z_COUNT];
157
159 float xOffset[FA_X_COUNT];
161 float yOffset[FA_Y_COUNT];
163 float zOffset[FA_Z_COUNT];
164
165private:
166 ForceComponentSettings *_forceComponentSettings;
167
168 const char *_name;
169
170 ForceComponentState _state;
171
175 void _zeroTarget();
176
177 void _zeroAll();
178};
179
180} /* namespace SS */
181} /* namespace M1M3 */
182} /* namespace LSST */
183
184#endif /* LSST_M1M3_SS_FORCECONTROLLER_FORCECOMPONENT_H_ */
bool isInitialising()
Returns true if the force component is being initialised.
Definition ForceComponent.h:88
float yOffset[FA_Y_COUNT]
difference (error) between current and target Y force
Definition ForceComponent.h:161
float zTarget[FA_Z_COUNT]
target actuator Z force
Definition ForceComponent.h:156
void disable()
Disable the force component.
Definition ForceComponent.cpp:51
float xTarget[FA_X_COUNT]
target actuator X force
Definition ForceComponent.h:152
virtual void postEnableDisableActions()=0
Called after enable/disable changes.
const char * getName()
Returns force component name.
Definition ForceComponent.h:81
void enable()
Enable the force component.
Definition ForceComponent.cpp:43
bool isActive()
Returns true if the force compoment is active - shall be calculated.
Definition ForceComponent.h:110
float xCurrent[FA_X_COUNT]
measured actuator current X force
Definition ForceComponent.h:145
ForceComponent(const char *name, ForceComponentSettings *forceComponentSettings)
Construct ForceComponent.
Definition ForceComponent.cpp:33
float zCurrent[FA_Z_COUNT]
measured actuator current Z force
Definition ForceComponent.h:149
virtual void postUpdateActions()=0
Called after update to forces.
bool isDisabling()
Returns true if the force component is being disabled.
Definition ForceComponent.h:102
float zOffset[FA_Z_COUNT]
difference (error) between current and target Z force
Definition ForceComponent.h:163
float yCurrent[FA_Y_COUNT]
measured actuator current Y force
Definition ForceComponent.h:147
bool isEnabled()
Returns true if the force component is enabled.
Definition ForceComponent.h:95
float xOffset[FA_X_COUNT]
difference (error) between current and target X force
Definition ForceComponent.h:159
float yTarget[FA_Y_COUNT]
target actuator Y force
Definition ForceComponent.h:154
Definition ForceComponentSettings.h:33