diff --git a/Common/Servers/ActiveSurfaceUSD/src/ActiveSurfaceUSDImpl.cpp b/Common/Servers/ActiveSurfaceUSD/src/ActiveSurfaceUSDImpl.cpp index d9d23a79552b1895ca678852cd293cbb920d8548..5d30ba85024b8a1f6b4394b04297acbae737951a 100644 --- a/Common/Servers/ActiveSurfaceUSD/src/ActiveSurfaceUSDImpl.cpp +++ b/Common/Servers/ActiveSurfaceUSD/src/ActiveSurfaceUSDImpl.cpp @@ -144,6 +144,7 @@ void USDImpl::initialize() throw (ACSErr::ACSbaseExImpl) _SET_LDEF(acc, "USDImpl::initialize()"); _SET_LDEF(uBits, "USDImpl::initialize()"); } + _GET_PROP(status,m_status,"usdImpl::initialize()") } catch (ASErrors::ASErrorsEx& ex) { @@ -324,6 +325,8 @@ void USDImpl::reset() throw (CORBA::SystemException,ASErrors::ASErrorsEx) //_SET_CDB(calibrate, m_calibrate, "::USDImpl::reset()") action(RESET); + CIRATools::Wait(0, 200000); // 0.2 secs, guard time to wait after a reset command + //* restore defaults *// _SET_LDEF(delay, "USDImpl::reset()"); _SET_LDEF(Fmax, "USDImpl::reset()"); diff --git a/SRT/CDB/MACI/Containers/SRTActiveSurfaceContainer01/SRTActiveSurfaceContainer01.xml b/SRT/CDB/MACI/Containers/SRTActiveSurfaceContainer01/SRTActiveSurfaceContainer01.xml index 9fecba35d662ea7a6c82eb9fd40c956633f6b4f8..f994d42ca724aae6430577b30f6cbfd32e7bddd0 100644 --- a/SRT/CDB/MACI/Containers/SRTActiveSurfaceContainer01/SRTActiveSurfaceContainer01.xml +++ b/SRT/CDB/MACI/Containers/SRTActiveSurfaceContainer01/SRTActiveSurfaceContainer01.xml @@ -22,6 +22,5 @@ flushPeriodSeconds="1" > </LoggingConfig> - </Container> diff --git a/SRT/CDB/MACI/Containers/SRTActiveSurfaceContainer06/SRTActiveSurfaceContainer06.xml b/SRT/CDB/MACI/Containers/SRTActiveSurfaceContainer06/SRTActiveSurfaceContainer06.xml index 69ad936dfd37a48ae10820e5c4ae7649fd089470..f994d42ca724aae6430577b30f6cbfd32e7bddd0 100644 --- a/SRT/CDB/MACI/Containers/SRTActiveSurfaceContainer06/SRTActiveSurfaceContainer06.xml +++ b/SRT/CDB/MACI/Containers/SRTActiveSurfaceContainer06/SRTActiveSurfaceContainer06.xml @@ -1,11 +1,26 @@ -<?xml version='1.0' encoding='ISO-8859-1'?> -<!-- - - History: - - Tue Sep 23 09:22:44 UTC 2008 modified by jDAL ---> -<Container xmlns="urn:schemas-cosylab-com:Container:1.0" xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:log="urn:schemas-cosylab-com:LoggingConfig:1.0" Timeout="30.0" ServerThreads="5" ImplLang="cpp"> +<?xml version="1.0" encoding="ISO-8859-1"?> + +<Container + xmlns="urn:schemas-cosylab-com:Container:1.0" + xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" + xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:log="urn:schemas-cosylab-com:LoggingConfig:1.0" + Timeout="30.0" + ServerThreads="5" + ImplLang="cpp"> + <Autoload> <cdb:e string="baci" /> </Autoload> - <LoggingConfig minLogLevel="5" minLogLevelLocal="10" dispatchPacketSize="0" immediateDispatchLevel="10" flushPeriodSeconds="1" /> + + <LoggingConfig + minLogLevel="5" + minLogLevelLocal="5" + dispatchPacketSize="0" + immediateDispatchLevel="10" + flushPeriodSeconds="1" + > + </LoggingConfig> </Container> + diff --git a/SRT/CDB/MACI/Containers/SRTActiveSurfaceContainer07/SRTActiveSurfaceContainer07.xml b/SRT/CDB/MACI/Containers/SRTActiveSurfaceContainer07/SRTActiveSurfaceContainer07.xml index c2efb0e9b0262511cf4224a2c576b3ecaf4bae99..f994d42ca724aae6430577b30f6cbfd32e7bddd0 100644 --- a/SRT/CDB/MACI/Containers/SRTActiveSurfaceContainer07/SRTActiveSurfaceContainer07.xml +++ b/SRT/CDB/MACI/Containers/SRTActiveSurfaceContainer07/SRTActiveSurfaceContainer07.xml @@ -17,7 +17,7 @@ <LoggingConfig minLogLevel="5" minLogLevelLocal="5" - dispatchPacketSize="10" + dispatchPacketSize="0" immediateDispatchLevel="10" flushPeriodSeconds="1" > diff --git a/SRT/CDB/alma/AS/Boss/Boss.xml b/SRT/CDB/alma/AS/Boss/Boss.xml index d2fdada51be8de2312fc26aefa3b63323352a3a6..0439cefcdcf1c3c5848f2ab613e127472f8101bd 100644 --- a/SRT/CDB/alma/AS/Boss/Boss.xml +++ b/SRT/CDB/alma/AS/Boss/Boss.xml @@ -9,4 +9,5 @@ <enabled /> <pprofile /> <tracking /> -</SRTActiveSurfaceBoss> \ No newline at end of file + <LUT_filename /> +</SRTActiveSurfaceBoss> diff --git a/SRT/Clients/SRTActiveSurfaceGUIClient/include/SRTActiveSurfaceCore.h b/SRT/Clients/SRTActiveSurfaceGUIClient/include/SRTActiveSurfaceCore.h index 6a466ae0346564d96345998f55f8ef046286b76f..47fd52762ef29924c471720d25ba3d176d7b92fc 100644 --- a/SRT/Clients/SRTActiveSurfaceGUIClient/include/SRTActiveSurfaceCore.h +++ b/SRT/Clients/SRTActiveSurfaceGUIClient/include/SRTActiveSurfaceCore.h @@ -73,7 +73,7 @@ class SRTActiveSurfaceCore : public QThread int ActuatorStatusCalLabelCode; signals: - int setGUIActuatorColor(int, int, bool, bool); + int setGUIActuatorColor(int, int, bool, bool, bool); int setGUIAllActuators(bool callfromfunction = false); int setGUIcircleORradius(bool callfromfunction = false); int setGUIActuator(bool callfromfunction = false); @@ -82,6 +82,7 @@ class SRTActiveSurfaceCore : public QThread int setGUIActuatorStatusLabels(); int setGUIasStatusCode(int); int setGUIasProfileCode(int); + int setGUIasLUTFileName(QString); private: ActiveSurface::SRTActiveSurfaceBoss_var tASBoss; diff --git a/SRT/Clients/SRTActiveSurfaceGUIClient/include/SRTActiveSurfaceGUIui.h b/SRT/Clients/SRTActiveSurfaceGUIClient/include/SRTActiveSurfaceGUIui.h index c2c110cb9239c704a7567f03a6845e0a972cffe9..66c398444bc67ae9ded894fc1bf1b13fae5445df 100644 --- a/SRT/Clients/SRTActiveSurfaceGUIClient/include/SRTActiveSurfaceGUIui.h +++ b/SRT/Clients/SRTActiveSurfaceGUIClient/include/SRTActiveSurfaceGUIui.h @@ -45,7 +45,7 @@ class SRTActiveSurfaceGUI : public QWidget, public Ui_SRTActiveSurfaceGUI void setactuator(); private slots: - void changeGUIActuatorColor(int, int, bool, bool); + void changeGUIActuatorColor(int, int, bool, bool, bool); void changeGUIAllActuators(bool callfromfunction = false); void changeGUIcircleORradius(bool callfromfunction = false); void changeGUIActuator(bool callfromfunction = false); @@ -54,6 +54,7 @@ class SRTActiveSurfaceGUI : public QWidget, public Ui_SRTActiveSurfaceGUI void changeGUIActuatorStatusLabels(); void changeGUIasStatusCode(int); void changeGUIasProfileCode(int); + void changeGUIasLUTFileName(QString); private: SRTActiveSurfaceCore mySRTActiveSurfaceCore; diff --git a/SRT/Clients/SRTActiveSurfaceGUIClient/src/SRTActiveSurfaceCore.cpp b/SRT/Clients/SRTActiveSurfaceGUIClient/src/SRTActiveSurfaceCore.cpp index 112f53d862afdc96f0d512472588f04ef8be1260..f3a3b578bd0e4b4b9e37d90ef3766e28aa41f1a8 100644 --- a/SRT/Clients/SRTActiveSurfaceGUIClient/src/SRTActiveSurfaceCore.cpp +++ b/SRT/Clients/SRTActiveSurfaceGUIClient/src/SRTActiveSurfaceCore.cpp @@ -8,6 +8,7 @@ #include <SRTActiveSurfaceCore.h> // mask pattern for status +#define UNAV 0xFF000000 #define MRUN 0x000080 #define CAMM 0x000100 #define ENBL 0x002000 @@ -58,6 +59,7 @@ void SRTActiveSurfaceCore::run(void) Management::ROTSystemStatus_var bossStatus_var; ActiveSurface::ROTASProfile_var asProfile_var; + ACS::ROstring_var asLUTFileName_var; while (monitor == true) { @@ -71,6 +73,9 @@ void SRTActiveSurfaceCore::run(void) asProfile_var = tASBoss->pprofile(); emit setGUIasProfileCode((int)asProfile_var->get_sync(completion.out())); + asLUTFileName_var = tASBoss->LUT_filename(); + emit setGUIasLUTFileName(QString(asLUTFileName_var->get_sync(completion.out()))); + ACS::longSeq_var asStatus; tASBoss->asStatus4GUIClient(asStatus); @@ -123,13 +128,23 @@ void SRTActiveSurfaceCore::run(void) CORBA::Long status = asStatus[actuator - 1]; - bool active; - if ((status & ENBL) == 0) - active = false; + bool active, statusColor; + + if(status == UNAV) + active = false; // red else + { active = true; - emit setGUIActuatorColor(i, l, active, true); + if((status & ENBL) == 0 || (status & CAL) == 0) + { + statusColor = true; // yellow + } + else + statusColor = false; // green + } + + emit setGUIActuatorColor(i, l, active, statusColor, true); } /*CIRATools::getTime(clock); @@ -149,7 +164,8 @@ void SRTActiveSurfaceCore::setactuator(int circle, int actuator) CORBA::Long acc_val; CORBA::Long delay_val; CORBA::Long status; - + bool active; + bool statusColor; /* ActuatorNumber_str = QString("%1_%2").arg(circle).arg(actuator); @@ -182,41 +198,51 @@ void SRTActiveSurfaceCore::setactuator(int circle, int actuator) try { tASBoss->usdStatus4GUIClient(circle, actuator, status); + active = true; + } + catch (ComponentErrors::ComponentNotActiveExImpl& ex) { + active = false; + ex.log(LM_DEBUG); } catch (ComponentErrors::ComponentErrorsExImpl& ex) { //clearactuatorslineedit(); + active = false; ex.log(LM_DEBUG); } catch (CORBA::SystemException& sysEx) { + active = false; _EXCPT(ClientErrors::CORBAProblemExImpl,impl,"SRTActiveSurfaceGUIClient::SRTActiveSurfaceCore::setactuator()"); impl.setName(sysEx._name()); impl.setMinor(sysEx.minor()); impl.log(); } catch (...) { + active = false; _EXCPT(ClientErrors::UnknownExImpl,impl,"SRTActiveSurfaceGUIClient::SRTActiveSurfaceCore::setactuator()"); impl.log(); } - if ((status & ENBL) == 0) { + if (active == true) + { + //if ((status & ENBL) == 0) { /*qApp->lock(); tGUI->ActuatorStatusEnblLabel->clear(); qApp->unlock(); qApp->lock(); tGUI->ActuatorStatusEnblLabel->setText("UNABLED"); qApp->unlock();*/ - ActuatorStatusEnblLabelCode = -1; - emit setGUIActuatorStatusEnblLabel(); - } - else { + //ActuatorStatusEnblLabelCode = -1; + //emit setGUIActuatorStatusEnblLabel(); + //} + //else { /*qApp->lock(); tGUI->ActuatorStatusEnblLabel->clear(); qApp->unlock(); qApp->lock(); tGUI->ActuatorStatusEnblLabel->setText("ENABLED"); qApp->unlock();*/ - ActuatorStatusEnblLabelCode = 1; - emit setGUIActuatorStatusEnblLabel(); + //ActuatorStatusEnblLabelCode = 1; + //emit setGUIActuatorStatusEnblLabel(); try { tASBoss->setActuator(circle, actuator, actPos_val, cmdPos_val, Fmin_val, Fmax_val, acc_val, delay_val); ActuatorActualPosition_str.setNum(actPos_val); @@ -256,7 +282,7 @@ void SRTActiveSurfaceCore::setactuator(int circle, int actuator) //ActuatorStatus_color.setRgb( 0, 170, 0 ); //setactuatorcolor(circle, actuator, ActuatorStatus_color); //theCircle = i; theActuator = l; - emit setGUIActuatorColor(circle, actuator, true, false); + //emit setGUIActuatorColor(circle, actuator, active, statusColor, false); //setactuatorstatuslabels(circle,actuator); //The status has been updated right before this if-else section, there is no need to ask it again @@ -272,7 +298,8 @@ void SRTActiveSurfaceCore::setactuator(int circle, int actuator) //tGUI->ActuatorStatusRunLabel->clear(); //tGUI->ActuatorStatusRunLabel->setText("RUNNING"); } - if ((status & ENBL) == 0) { + ActuatorStatusEnblLabelCode = 1; + /*if ((status & ENBL) == 0) { ActuatorStatusEnblLabelCode = -1; //tGUI->ActuatorStatusEnblLabel->clear(); //tGUI->ActuatorStatusEnblLabel->setText("UNABLED"); @@ -281,7 +308,7 @@ void SRTActiveSurfaceCore::setactuator(int circle, int actuator) ActuatorStatusEnblLabelCode = 1; //tGUI->ActuatorStatusEnblLabel->clear(); //tGUI->ActuatorStatusEnblLabel->setText("ENABLED"); - } + }*/ if ((status & CAMM) == 0) { ActuatorStatusCammLabelCode = -1; //tGUI->ActuatorStatusCammLabel->clear(); @@ -302,33 +329,53 @@ void SRTActiveSurfaceCore::setactuator(int circle, int actuator) //tGUI->ActuatorStatusLoopLabel->clear(); //tGUI->ActuatorStatusLoopLabel->setText("LOOP"); } - if ((status & CAL) == 0) { + if ((status & CAL) == 0) + { ActuatorStatusCalLabelCode = -1; + statusColor = true; //tGUI->ActuatorStatusCalLabel->clear(); //tGUI->ActuatorStatusCalLabel->setText("UNCALIBRATED"); + //printf("uncalibrated\n"); + //emit setGUIActuatorColor(circle, actuator, false, false); } else { ActuatorStatusCalLabelCode = 1; + statusColor = false; //tGUI->ActuatorStatusCalLabel->clear(); //tGUI->ActuatorStatusCalLabel->setText("CALIBRATED"); } - emit setGUIActuatorStatusLabels(); + //emit setGUIActuatorStatusLabels(); + //emit setGUIActuatorColor(circle, actuator, active, statusColor, false); } catch (ComponentErrors::ComponentErrorsExImpl& ex) { // clearactuatorslineedit(); + active = false; ex.log(LM_DEBUG); } catch (CORBA::SystemException& sysEx) { + active = false; _EXCPT(ClientErrors::CORBAProblemExImpl,impl,"SRTActiveSurfaceGUIClient::SRTActiveSurfaceCore::setActuator()"); impl.setName(sysEx._name()); impl.setMinor(sysEx.minor()); impl.log(); } catch (...) { + active = false; _EXCPT(ClientErrors::UnknownExImpl,impl,"SRTActiveSurfaceGUIClient::SRTActiveSurfaceCore::setActuator()"); impl.log(); } } + else { + active = false; + statusColor = true; + ActuatorStatusRunLabelCode = 0; + ActuatorStatusEnblLabelCode = -1; + ActuatorStatusCammLabelCode = 0; + ActuatorStatusLoopLabelCode = 0; + ActuatorStatusCalLabelCode = 0; + } + emit setGUIActuatorStatusLabels(); + emit setGUIActuatorColor(circle, actuator, active, statusColor, false); } diff --git a/SRT/Clients/SRTActiveSurfaceGUIClient/src/SRTActiveSurfaceGUI.ui b/SRT/Clients/SRTActiveSurfaceGUIClient/src/SRTActiveSurfaceGUI.ui index 561b9138c6ee630c74f2d0d3fead3018a4445fc6..6e7eb895f7b6b84311484b7f232d0d245770a0dc 100644 --- a/SRT/Clients/SRTActiveSurfaceGUIClient/src/SRTActiveSurfaceGUI.ui +++ b/SRT/Clients/SRTActiveSurfaceGUIClient/src/SRTActiveSurfaceGUI.ui @@ -29,7 +29,7 @@ <property name="geometry"> <rect> <x>970</x> - <y>15</y> + <y>50</y> <width>130</width> <height>30</height> </rect> @@ -48,7 +48,7 @@ <property name="geometry"> <rect> <x>970</x> - <y>152</y> + <y>187</y> <width>130</width> <height>20</height> </rect> @@ -67,7 +67,7 @@ <property name="geometry"> <rect> <x>970</x> - <y>225</y> + <y>260</y> <width>130</width> <height>20</height> </rect> @@ -89,7 +89,7 @@ <property name="geometry"> <rect> <x>970</x> - <y>305</y> + <y>340</y> <width>90</width> <height>35</height> </rect> @@ -114,7 +114,7 @@ <property name="geometry"> <rect> <x>1065</x> - <y>305</y> + <y>340</y> <width>95</width> <height>35</height> </rect> @@ -139,7 +139,7 @@ <property name="geometry"> <rect> <x>1115</x> - <y>265</y> + <y>300</y> <width>140</width> <height>35</height> </rect> @@ -164,7 +164,7 @@ <property name="geometry"> <rect> <x>970</x> - <y>265</y> + <y>300</y> <width>140</width> <height>35</height> </rect> @@ -189,7 +189,7 @@ <property name="geometry"> <rect> <x>1165</x> - <y>305</y> + <y>340</y> <width>90</width> <height>35</height> </rect> @@ -211,7 +211,7 @@ <property name="geometry"> <rect> <x>970</x> - <y>105</y> + <y>140</y> <width>130</width> <height>42</height> </rect> @@ -230,7 +230,7 @@ <property name="geometry"> <rect> <x>970</x> - <y>60</y> + <y>95</y> <width>130</width> <height>42</height> </rect> @@ -249,7 +249,7 @@ <property name="geometry"> <rect> <x>970</x> - <y>176</y> + <y>211</y> <width>130</width> <height>20</height> </rect> @@ -268,7 +268,7 @@ <property name="geometry"> <rect> <x>970</x> - <y>200</y> + <y>235</y> <width>130</width> <height>20</height> </rect> @@ -287,7 +287,7 @@ <property name="geometry"> <rect> <x>1120</x> - <y>15</y> + <y>50</y> <width>135</width> <height>30</height> </rect> @@ -312,7 +312,7 @@ <property name="geometry"> <rect> <x>1120</x> - <y>60</y> + <y>95</y> <width>30</width> <height>20</height> </rect> @@ -331,7 +331,7 @@ <property name="geometry"> <rect> <x>1120</x> - <y>82</y> + <y>117</y> <width>30</width> <height>20</height> </rect> @@ -350,7 +350,7 @@ <property name="geometry"> <rect> <x>1120</x> - <y>106</y> + <y>141</y> <width>30</width> <height>20</height> </rect> @@ -369,7 +369,7 @@ <property name="geometry"> <rect> <x>1120</x> - <y>127</y> + <y>162</y> <width>30</width> <height>20</height> </rect> @@ -388,7 +388,7 @@ <property name="geometry"> <rect> <x>1153</x> - <y>60</y> + <y>95</y> <width>100</width> <height>20</height> </rect> @@ -407,7 +407,7 @@ <property name="geometry"> <rect> <x>1153</x> - <y>82</y> + <y>117</y> <width>100</width> <height>20</height> </rect> @@ -426,7 +426,7 @@ <property name="geometry"> <rect> <x>1154</x> - <y>106</y> + <y>141</y> <width>100</width> <height>20</height> </rect> @@ -445,7 +445,7 @@ <property name="geometry"> <rect> <x>1154</x> - <y>127</y> + <y>162</y> <width>100</width> <height>20</height> </rect> @@ -464,7 +464,7 @@ <property name="geometry"> <rect> <x>1120</x> - <y>152</y> + <y>187</y> <width>135</width> <height>20</height> </rect> @@ -483,7 +483,7 @@ <property name="geometry"> <rect> <x>1120</x> - <y>176</y> + <y>211</y> <width>135</width> <height>20</height> </rect> @@ -502,7 +502,7 @@ <property name="geometry"> <rect> <x>1120</x> - <y>200</y> + <y>235</y> <width>135</width> <height>20</height> </rect> @@ -521,7 +521,7 @@ <property name="geometry"> <rect> <x>1120</x> - <y>225</y> + <y>260</y> <width>135</width> <height>20</height> </rect> @@ -543,7 +543,7 @@ <property name="geometry"> <rect> <x>970</x> - <y>760</y> + <y>755</y> <width>287</width> <height>32</height> </rect> @@ -568883,9 +568883,6 @@ <property name="text"> <string>Calibration</string> </property> - <attribute name="buttonGroup"> - <string/> - </attribute> </widget> <widget class="QPushButton" name="StopButton"> <property name="geometry"> @@ -569347,9 +569344,6 @@ <property name="text"> <string>Stop</string> </property> - <attribute name="buttonGroup"> - <string/> - </attribute> </widget> <widget class="QPushButton" name="ResetButton"> <property name="geometry"> @@ -569811,9 +569805,6 @@ <property name="text"> <string>Reset</string> </property> - <attribute name="buttonGroup"> - <string/> - </attribute> </widget> <widget class="QPushButton" name="RefPosButton"> <property name="geometry"> @@ -570275,9 +570266,6 @@ <property name="text"> <string>RefPos</string> </property> - <attribute name="buttonGroup"> - <string/> - </attribute> </widget> <widget class="QPushButton" name="TopButton"> <property name="geometry"> @@ -570739,9 +570727,6 @@ <property name="text"> <string>Top</string> </property> - <attribute name="buttonGroup"> - <string/> - </attribute> </widget> <widget class="QPushButton" name="StowButton"> <property name="geometry"> @@ -571203,9 +571188,6 @@ <property name="text"> <string>Stow</string> </property> - <attribute name="buttonGroup"> - <string/> - </attribute> </widget> <widget class="QPushButton" name="BottomButton"> <property name="geometry"> @@ -571667,9 +571649,6 @@ <property name="text"> <string>Bottom</string> </property> - <attribute name="buttonGroup"> - <string/> - </attribute> </widget> <widget class="QPushButton" name="SetupButton"> <property name="geometry"> @@ -572131,9 +572110,6 @@ <property name="text"> <string>Setup</string> </property> - <attribute name="buttonGroup"> - <string/> - </attribute> </widget> <widget class="QPushButton" name="DownButton"> <property name="geometry"> @@ -572595,9 +572571,6 @@ <property name="text"> <string>Down</string> </property> - <attribute name="buttonGroup"> - <string/> - </attribute> </widget> <widget class="QPushButton" name="UpButton"> <property name="geometry"> @@ -573059,9 +573032,6 @@ <property name="text"> <string>Up</string> </property> - <attribute name="buttonGroup"> - <string/> - </attribute> </widget> <widget class="QPushButton" name="MoveButton"> <property name="geometry"> @@ -573523,9 +573493,6 @@ <property name="text"> <string>Move</string> </property> - <attribute name="buttonGroup"> - <string/> - </attribute> </widget> <widget class="QLineEdit" name="ActuatorMovelineEdit"> <property name="geometry"> @@ -574008,9 +573975,6 @@ <property name="text"> <string>Correction</string> </property> - <attribute name="buttonGroup"> - <string/> - </attribute> </widget> <widget class="QLineEdit" name="ActuatorCorrectionlineEdit"> <property name="geometry"> @@ -574493,9 +574457,6 @@ <property name="text"> <string>Update</string> </property> - <attribute name="buttonGroup"> - <string/> - </attribute> </widget> <widget class="QLineEdit" name="ActuatorUpdatelineEdit"> <property name="geometry"> @@ -574523,7 +574484,7 @@ <property name="geometry"> <rect> <x>970</x> - <y>830</y> + <y>825</y> <width>90</width> <height>30</height> </rect> @@ -574983,8 +574944,8 @@ <widget class="QPushButton" name="stowASbutton"> <property name="geometry"> <rect> - <x>1164</x> - <y>830</y> + <x>1170</x> + <y>825</y> <width>90</width> <height>30</height> </rect> @@ -575444,8 +575405,8 @@ <widget class="QPushButton" name="stopASbutton"> <property name="geometry"> <rect> - <x>1067</x> - <y>830</y> + <x>1070</x> + <y>825</y> <width>90</width> <height>30</height> </rect> @@ -575905,9 +575866,9 @@ <widget class="QLineEdit" name="StatuslineEdit_2"> <property name="geometry"> <rect> - <x>990</x> + <x>970</x> <y>890</y> - <width>120</width> + <width>140</width> <height>30</height> </rect> </property> @@ -575930,10 +575891,10 @@ <widget class="QLineEdit" name="StatuslineEdit"> <property name="geometry"> <rect> - <x>990</x> - <y>870</y> - <width>120</width> - <height>20</height> + <x>970</x> + <y>860</y> + <width>140</width> + <height>30</height> </rect> </property> <property name="autoFillBackground"> @@ -575955,8 +575916,8 @@ <widget class="QComboBox" name="SetProfilecomboBox"> <property name="geometry"> <rect> - <x>1104</x> - <y>792</y> + <x>1110</x> + <y>790</y> <width>151</width> <height>30</height> </rect> @@ -575992,7 +575953,7 @@ <property name="geometry"> <rect> <x>970</x> - <y>792</y> + <y>790</y> <width>131</width> <height>30</height> </rect> @@ -576453,9 +576414,9 @@ <property name="geometry"> <rect> <x>1120</x> - <y>870</y> - <width>120</width> - <height>20</height> + <y>860</y> + <width>140</width> + <height>30</height> </rect> </property> <property name="autoFillBackground"> @@ -576479,7 +576440,7 @@ <rect> <x>1120</x> <y>890</y> - <width>120</width> + <width>140</width> <height>30</height> </rect> </property> @@ -576499,6 +576460,56 @@ <bool>true</bool> </property> </widget> + <widget class="QLabel" name="LUTLabel"> + <property name="geometry"> + <rect> + <x>970</x> + <y>10</y> + <width>131</width> + <height>30</height> + </rect> + </property> + <property name="text"> + <string>LUT File</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="wordWrap"> + <bool>false</bool> + </property> + </widget> + <widget class="QLineEdit" name="LUTLabelFileName"> + <property name="geometry"> + <rect> + <x>1074</x> + <y>10</y> + <width>181</width> + <height>30</height> + </rect> + </property> + <property name="font"> + <font> + <family>Cantarell</family> + <pointsize>12</pointsize> + </font> + </property> + <property name="text"> + <string/> + </property> + <property name="maxLength"> + <number>32767</number> + </property> + <property name="frame"> + <bool>true</bool> + </property> + <property name="alignment"> + <set>Qt::AlignHCenter</set> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + </widget> </widget> <layoutdefault spacing="0" margin="1"/> <customwidgets> diff --git a/SRT/Clients/SRTActiveSurfaceGUIClient/src/SRTActiveSurfaceGUIui.cpp b/SRT/Clients/SRTActiveSurfaceGUIClient/src/SRTActiveSurfaceGUIui.cpp index 9abe44d9e4345d506257285a7e5ea1d776c4ed85..2f3b92a9bf25201b7ab695c0ec3e8fd448d01b68 100644 --- a/SRT/Clients/SRTActiveSurfaceGUIClient/src/SRTActiveSurfaceGUIui.cpp +++ b/SRT/Clients/SRTActiveSurfaceGUIClient/src/SRTActiveSurfaceGUIui.cpp @@ -12,7 +12,7 @@ SRTActiveSurfaceGUI::SRTActiveSurfaceGUI(QWidget *parent) : QWidget(parent) { setupUi(this); - QObject::connect(&mySRTActiveSurfaceCore, SIGNAL(setGUIActuatorColor(int,int,bool,bool)), this, SLOT(changeGUIActuatorColor(int,int,bool,bool))); + QObject::connect(&mySRTActiveSurfaceCore, SIGNAL(setGUIActuatorColor(int,int,bool,bool,bool)), this, SLOT(changeGUIActuatorColor(int,int,bool,bool,bool))); QObject::connect(&mySRTActiveSurfaceCore, SIGNAL(setGUIAllActuators(bool)), this, SLOT(changeGUIAllActuators(bool))); QObject::connect(&mySRTActiveSurfaceCore, SIGNAL(setGUIcircleORradius(bool)), this, SLOT(changeGUIcircleORradius(bool))); QObject::connect(&mySRTActiveSurfaceCore, SIGNAL(setGUIActuator(bool)), this, SLOT(changeGUIActuator(bool))); @@ -21,6 +21,7 @@ SRTActiveSurfaceGUI::SRTActiveSurfaceGUI(QWidget *parent) : QWidget(parent) QObject::connect(&mySRTActiveSurfaceCore, SIGNAL(setGUIActuatorStatusLabels()), this, SLOT(changeGUIActuatorStatusLabels())); QObject::connect(&mySRTActiveSurfaceCore, SIGNAL(setGUIasStatusCode(int)), this, SLOT(changeGUIasStatusCode(int))); QObject::connect(&mySRTActiveSurfaceCore, SIGNAL(setGUIasProfileCode(int)), this, SLOT(changeGUIasProfileCode(int))); + QObject::connect(&mySRTActiveSurfaceCore, SIGNAL(setGUIasLUTFileName(QString)), this, SLOT(changeGUIasLUTFileName(QString))); #ifdef MANAGEMENT buttonGroup1->setEnabled(true); @@ -526,7 +527,7 @@ void SRTActiveSurfaceGUI::recoverUSD() } } -void SRTActiveSurfaceGUI::changeGUIActuatorColor(int tcircle, int tactuator, bool active, bool fromRun) +void SRTActiveSurfaceGUI::changeGUIActuatorColor(int tcircle, int tactuator, bool active, bool statusColor, bool fromRun) { if (!fromRun) { @@ -542,13 +543,17 @@ void SRTActiveSurfaceGUI::changeGUIActuatorColor(int tcircle, int tactuator, boo QPushButton* ActuatorButton = this->findChild<QPushButton*>(ActuatorButtonName.str().c_str()); - if(active) + if(active == true && statusColor == false) // attivo e calibrato { - ActuatorButton->setStyleSheet("background-color: rgb(85, 255, 0)"); + ActuatorButton->setStyleSheet("background-color: rgb(85, 255, 0)"); // verde + } + else if (active == true && statusColor == true) // attivo e scalibrato + { + ActuatorButton->setStyleSheet("background-color: rgb(255, 255, 0)"); // giallo } else { - ActuatorButton->setStyleSheet("background-color: rgb(255, 0, 0)"); + ActuatorButton->setStyleSheet("background-color: rgb(255, 0, 0)"); // rosso } } @@ -712,10 +717,18 @@ void SRTActiveSurfaceGUI::changeGUIasProfileCode(int asProfileCode) ProfilelineEdit_2->setText(QApplication::translate("SRTActiveSurfaceGUI", asProfileString.c_str(), 0, QApplication::UnicodeUTF8)); } +void SRTActiveSurfaceGUI::changeGUIasLUTFileName(QString filename) +{ + LUTLabelFileName->setText(filename); +} + void SRTActiveSurfaceGUI::changeGUIActuatorStatusLabels() { ActuatorStatusRunLabel->clear(); switch (mySRTActiveSurfaceCore.ActuatorStatusRunLabelCode) { + case (0): + ActuatorStatusRunLabel->setText(""); + break; case (-1): ActuatorStatusRunLabel->setText("STOPPED"); break; @@ -736,6 +749,9 @@ void SRTActiveSurfaceGUI::changeGUIActuatorStatusLabels() ActuatorStatusCammLabel->clear(); switch (mySRTActiveSurfaceCore.ActuatorStatusCammLabelCode) { + case (0): + ActuatorStatusCammLabel->setText(""); + break; case (-1): ActuatorStatusCammLabel->setText("NO CAMM"); break; @@ -746,6 +762,9 @@ void SRTActiveSurfaceGUI::changeGUIActuatorStatusLabels() ActuatorStatusLoopLabel->clear(); switch (mySRTActiveSurfaceCore.ActuatorStatusLoopLabelCode) { + case (0): + ActuatorStatusLoopLabel->setText(""); + break; case (-1): ActuatorStatusLoopLabel->setText("NO LOOP"); break; @@ -756,6 +775,9 @@ void SRTActiveSurfaceGUI::changeGUIActuatorStatusLabels() ActuatorStatusCalLabel->clear(); switch (mySRTActiveSurfaceCore.ActuatorStatusCalLabelCode) { + case (0): + ActuatorStatusCalLabel->setText(""); + break; case (-1): ActuatorStatusCalLabel->setText("UNCALIBRATED"); break; diff --git a/SRT/Configuration/CDB/alma/AS/Boss/Boss.xml b/SRT/Configuration/CDB/alma/AS/Boss/Boss.xml index 3482c519340f8be5765444f5a750f48251fcaecb..770a0535e82afaea6107aac3c393eff944b9408a 100644 --- a/SRT/Configuration/CDB/alma/AS/Boss/Boss.xml +++ b/SRT/Configuration/CDB/alma/AS/Boss/Boss.xml @@ -4,4 +4,5 @@ <enabled /> <pprofile /> <tracking /> + <LUT_filename /> </SRTActiveSurfaceBoss> diff --git a/SRT/Interfaces/SRTActiveSurfaceInterface/config/CDB/schemas/SRTActiveSurfaceBoss.xsd b/SRT/Interfaces/SRTActiveSurfaceInterface/config/CDB/schemas/SRTActiveSurfaceBoss.xsd index 3907fddd48682039140565890d5fc25ab44dcd10..ee4bb987e14cb98fdb92d206b283227e4f0a86d2 100644 --- a/SRT/Interfaces/SRTActiveSurfaceInterface/config/CDB/schemas/SRTActiveSurfaceBoss.xsd +++ b/SRT/Interfaces/SRTActiveSurfaceInterface/config/CDB/schemas/SRTActiveSurfaceBoss.xsd @@ -30,6 +30,7 @@ <xs:element name="enabled" type="mng:BooleanType" /> <xs:element name="pprofile" type="as:ActiveSurfaceProfileType" /> <xs:element name="tracking" type="mng:BooleanType" /> + <xs:element name="LUT_filename" type="baci:ROstring" /> </xs:sequence> <!-- sleep time of the watching thread (microseconds), this is the thread that keeps data up to date --> <xs:attribute name="WatchingThreadTime" type="xs:unsignedLong" use="required" /> diff --git a/SRT/Interfaces/SRTActiveSurfaceInterface/idl/SRTActiveSurfaceBoss.midl b/SRT/Interfaces/SRTActiveSurfaceInterface/idl/SRTActiveSurfaceBoss.midl index 634d21e768054a5c1785ad247d55d61ac8e7b280..fd92b43e92306cfbbdc360947b7eb7c068e8acf7 100644 --- a/SRT/Interfaces/SRTActiveSurfaceInterface/idl/SRTActiveSurfaceBoss.midl +++ b/SRT/Interfaces/SRTActiveSurfaceInterface/idl/SRTActiveSurfaceBoss.midl @@ -66,6 +66,11 @@ module ActiveSurface { */ readonly attribute Management::ROTBoolean tracking; + /* + * This attribute shows the filename of the currently loaded lookup table + */ + readonly attribute ACS::ROstring LUT_filename; + /** * This method can be called in order to disable the component. That * means that the activesurface subsystem cannot be commanded any more via the diff --git a/SRT/Servers/SRTActiveSurfaceBoss/include/DevIOLUT.h b/SRT/Servers/SRTActiveSurfaceBoss/include/DevIOLUT.h new file mode 100644 index 0000000000000000000000000000000000000000..8c83a47e8d439f49685760e4b59b27161d0a4659 --- /dev/null +++ b/SRT/Servers/SRTActiveSurfaceBoss/include/DevIOLUT.h @@ -0,0 +1,56 @@ +#ifndef _SRTACTIVESURFACEBOSSIMPLDEVIOLUT_H_ +#define _SRTACTIVESURFACEBOSSIMPLDEVIOLUT_H_ + +/****************************************************************************************/ +/* OAC Osservatorio Astronomico di Cagliari */ +/* $Id: DevIOLUT.h,v 1.0 2025-01-13 15:42:32 G. Carboni Exp $ */ +/* */ +/* This code is under GNU General Public Licence (GPL). */ +/* */ +/* Who when What */ +/* Giuseppe Carboni (giuseppe.carboni@inaf.it) 13/01/2025 Creation */ + +#include <baciDevIO.h> +#include <IRA> + +using namespace baci; + +/** + * This class is derived from the template DevIO. + * @author <a href=mailto:giuseppe.carboni@inaf.it>Giuseppe Carboni</a>, + * Osservatorio Astronomico di Cagliari, Italia<br> + */ +class SRTActiveSurfaceBossImplDevIOLUT: public virtual DevIO<ACE_CString> +{ +public: + + SRTActiveSurfaceBossImplDevIOLUT(IRA::CSecureArea<CSRTActiveSurfaceBossCore>* core): m_core(core) { + AUTO_TRACE("SRTActiveSurfaceBossImplDevIOLUT::SRTActiveSurfaceBossImplDevIOLUT()"); + } + + ~SRTActiveSurfaceBossImplDevIOLUT() { + AUTO_TRACE("SRTActiveSurfaceBossImplDevIOLUT::~SRTActiveSurfaceBossImplDevIOLUT()"); + } + + bool initializeValue() + { + return false; + } + + ACE_CString read(ACS::Time& timestamp) throw (ACSErr::ACSbaseExImpl) + { + CSecAreaResourceWrapper<CSRTActiveSurfaceBossCore> resource=m_core->Get(); + AUTO_TRACE("SRTActiveSurfaceBossImplDevIOLUT::read()"); + timestamp=getTimeStamp(); + return resource->getLUTfilename().c_str(); + } + + void write(const CORBA::Long& value, ACS::Time& timestamp) throw (ACSErr::ACSbaseExImpl) { + AUTO_TRACE("SRTActiveSurfaceBossImplDevIOLUT::write()"); + } + +private: + IRA::CSecureArea<CSRTActiveSurfaceBossCore> *m_core; +}; + +#endif /*DEVIOLUT_H_*/ diff --git a/SRT/Servers/SRTActiveSurfaceBoss/include/SRTActiveSurfaceBossCore.h b/SRT/Servers/SRTActiveSurfaceBoss/include/SRTActiveSurfaceBossCore.h index 89494afaeefdafbb563e4d2fd3f8417d251664fb..1b3ceb2b94a07bd3102b391fa332111dc9b80b02 100644 --- a/SRT/Servers/SRTActiveSurfaceBoss/include/SRTActiveSurfaceBossCore.h +++ b/SRT/Servers/SRTActiveSurfaceBoss/include/SRTActiveSurfaceBossCore.h @@ -46,6 +46,7 @@ #define DELTAEL 15.0 // mask pattern for status +#define UNAV 0xFF000000 #define MRUN 0x000080 #define CAMM 0x000100 #define ENBL 0x002000 @@ -80,6 +81,7 @@ class CSRTActiveSurfaceBossCore { //friend class CSRTActiveSurfaceBossWatchingThread; friend class CSRTActiveSurfaceBossWorkingThread; friend class CSRTActiveSurfaceBossSectorThread; + friend class CSRTActiveSurfaceBossInitializationThread; public: /** * Constructor. Default Constructor. @@ -145,6 +147,8 @@ public: inline bool getTracking() const { return m_tracking; } + inline std::string getLUTfilename() const { return m_lut.substr(m_lut.find_last_of('/') + 1); } + /** * Sets the <i>AutoUpdate</i> flag to false, i.e. the component will not update automatically the surface. */ @@ -188,9 +192,6 @@ private: int actuatorcounter, circlecounter, totacts; ACS::doubleSeq actuatorsCorrections; - /** pointer to the component itself */ - acscomponent::ACSComponentImpl *m_thisIsMe; - /** * This represents the status of the whole Active Surface subsystem, it also includes and sammerizes the status of the boss component */ @@ -220,15 +221,17 @@ private: char *s_usdCorrections; - std::vector<bool> m_sector; - bool m_profileSetted; bool m_ASup; bool m_newlut; + bool m_initialized; + std::string m_lut; + + std::vector<int> actuatorsInCircle; }; #endif /*SRTACTIVESURFACEBOSSCORE_H_*/ diff --git a/SRT/Servers/SRTActiveSurfaceBoss/include/SRTActiveSurfaceBossImpl.h b/SRT/Servers/SRTActiveSurfaceBoss/include/SRTActiveSurfaceBossImpl.h index d2f2c7be7c67a7542a3331c94b304b8d4963f299..a7832376dad0b048a27b1424f6e5f4dd64995b71 100644 --- a/SRT/Servers/SRTActiveSurfaceBoss/include/SRTActiveSurfaceBossImpl.h +++ b/SRT/Servers/SRTActiveSurfaceBoss/include/SRTActiveSurfaceBossImpl.h @@ -30,11 +30,10 @@ #include <ManagementErrors.h> #include "SRTActiveSurfaceBossCore.h" #include "SRTActiveSurfaceBossWorkingThread.h" -#include "SRTActiveSurfaceBossSectorThread.h" +#include "SRTActiveSurfaceBossInitializationThread.h" #include <SP_parser.h> #define LOOPSTATUSTIME 10000000 // 1.0 second -#define SECTORTIME 1000000 // 0.1 seconds #define _SET_CDB(PROP,LVAL,ROUTINE) { \ maci::ContainerServices* cs=getContainerServices();\ @@ -129,6 +128,12 @@ class SRTActiveSurfaceBossImpl: public virtual CharacteristicComponentImpl, publ */ virtual Management::ROTBoolean_ptr tracking() throw (CORBA::SystemException); + /** + * Returns a reference to the tracking property implementation of IDL interface. + * @return pointer to read-only ACS::ROString property enabled + */ + virtual ACS::ROstring_ptr LUT_filename() throw (CORBA::SystemException); + /** * This method can be called in order to disable the automatic update of the surface. * @throw CORBA::SystemException @@ -213,7 +218,7 @@ class SRTActiveSurfaceBossImpl: public virtual CharacteristicComponentImpl, publ CSRTActiveSurfaceBossWorkingThread *m_workingThread; - std::vector<CSRTActiveSurfaceBossSectorThread*> m_sectorThread; + CSRTActiveSurfaceBossInitializationThread *m_initializationThread; SimpleParser::CParser<CSRTActiveSurfaceBossCore> *m_parser; @@ -222,6 +227,7 @@ class SRTActiveSurfaceBossImpl: public virtual CharacteristicComponentImpl, publ SmartPropertyPointer< ROEnumImpl<ACS_ENUM_T(Management::TBoolean), POA_Management::ROTBoolean> > m_penabled; SmartPropertyPointer< ROEnumImpl<ACS_ENUM_T(ActiveSurface::TASProfile), POA_ActiveSurface::ROTASProfile> > m_pprofile; SmartPropertyPointer< ROEnumImpl<ACS_ENUM_T(Management::TBoolean), POA_Management::ROTBoolean> > m_ptracking; + SmartPropertyPointer<ROstring> m_pLUT_filename; IRA::CSecureArea<CSRTActiveSurfaceBossCore> *m_core; /* * diff --git a/SRT/Servers/SRTActiveSurfaceBoss/include/SRTActiveSurfaceBossInitializationThread.h b/SRT/Servers/SRTActiveSurfaceBoss/include/SRTActiveSurfaceBossInitializationThread.h new file mode 100644 index 0000000000000000000000000000000000000000..274963ae03b82ef199ab9d95457ac21e2fc44f76 --- /dev/null +++ b/SRT/Servers/SRTActiveSurfaceBoss/include/SRTActiveSurfaceBossInitializationThread.h @@ -0,0 +1,65 @@ +#ifndef _SRTACTIVESURFACEBOSSINITIALIZATIONTHREAD_H_ +#define _SRTACTIVESURFACEBOSSINITIALIZATIONTHREAD_H_ + +/********************************************************************************************/ +/* OAC Osservatorio Astronomico di Cagliari */ +/* $Id: SRTActiveSurfaceBossInitializationThread.h,v 1.1 2010-07-26 12:36:49 c.migoni Exp $ */ +/* */ +/* This code is under GNU General Public Licence (GPL). */ +/* */ +/* Who When What */ +/* Giuseppe Carboni (giuseppe.carboni@inaf.it) 09/01/2025 Creation */ +/********************************************************************************************/ + +#include <acsThread.h> +#include <IRA> +#include "SRTActiveSurfaceBossCore.h" +#include "SRTActiveSurfaceBossSectorThread.h" +#include <ComponentErrors.h> + +#define SECTORTIME 1000000 // 0.1 seconds + +/** + * This class implements an initialization thread. This thread is in charge of setting up the active surface +*/ +class CSRTActiveSurfaceBossInitializationThread : public ACS::Thread +{ +public: + /** + * Constructor(). + * @param name thread name + * @param responseTime thread's heartbeat response time in 100ns unit. Default value is 1s. + * @param sleepTime thread's sleep time in 100ns unit. Default value is 100ms. + */ + CSRTActiveSurfaceBossInitializationThread(const ACE_CString& name, CSRTActiveSurfaceBossCore *param, + const ACS::TimeInterval& responseTime=ThreadBase::defaultResponseTime,const ACS::TimeInterval& sleepTime=ThreadBase::defaultSleepTime); + + /** + * Destructor. + */ + ~CSRTActiveSurfaceBossInitializationThread(); + + /** + * This method is executed once when the thread starts. + */ + virtual void onStart(); + + /** + * This method is executed once when the thread stops. + */ + virtual void onStop(); + + /** + * This method overrides the thread implementation class. + * The thread can be exited by calling ACS::ThreadBase::stop or ACS::ThreadBase::exit command. + */ + virtual void runLoop(); + +private: + CSRTActiveSurfaceBossCore *m_boss; + std::string m_thread_name; + ACS::Time timestart; + std::vector<CSRTActiveSurfaceBossSectorThread*> m_sectorThread; +}; + +#endif /*_SRTACTIVESURFACEBOSSINITIALIZATIONTHREAD_H_*/ diff --git a/SRT/Servers/SRTActiveSurfaceBoss/src/Makefile b/SRT/Servers/SRTActiveSurfaceBoss/src/Makefile index c9a65272d4efc7e61a4bad5962cef34f6cc73a9b..b55f8c3676f299ce4182eb58e2a21e98e93ae6e0 100644 --- a/SRT/Servers/SRTActiveSurfaceBoss/src/Makefile +++ b/SRT/Servers/SRTActiveSurfaceBoss/src/Makefile @@ -83,7 +83,7 @@ LIBRARIES = SRTActiveSurfaceBossImpl LIBRARIES_L = # # <brief description of lllll library> -SRTActiveSurfaceBossImpl_OBJECTS = SRTActiveSurfaceBossImpl SRTActiveSurfaceBossCore SRTActiveSurfaceBossWorkingThread SRTActiveSurfaceBossSectorThread +SRTActiveSurfaceBossImpl_OBJECTS = SRTActiveSurfaceBossImpl SRTActiveSurfaceBossCore SRTActiveSurfaceBossWorkingThread SRTActiveSurfaceBossInitializationThread SRTActiveSurfaceBossSectorThread SRTActiveSurfaceBossImpl_LIBS = lanStubs usdStubs ActiveSurfaceBossStubs SRTActiveSurfaceBossStubs AntennaDefinitionsStubs ManagmentDefinitionsStubs AntennaBossStubs ComponentErrors ASErrors ManagementErrors AntennaErrors IRALibrary ParserErrors DiscosVersion # diff --git a/SRT/Servers/SRTActiveSurfaceBoss/src/SRTActiveSurfaceBossCore.cpp b/SRT/Servers/SRTActiveSurfaceBoss/src/SRTActiveSurfaceBossCore.cpp index bfe1c7c69407ae14cc1cf174bb596d8b42f61123..a958afa13e292e86742b9c5e420b521c2cfcb064 100644 --- a/SRT/Servers/SRTActiveSurfaceBoss/src/SRTActiveSurfaceBossCore.cpp +++ b/SRT/Servers/SRTActiveSurfaceBoss/src/SRTActiveSurfaceBossCore.cpp @@ -2,11 +2,9 @@ #include <Definitions.h> #include <cstdio> -int actuatorsInCircle[] = {0,24,24,48,48,48,48,96,96,96,96,96,96,96,96,96,8,4}; - CSRTActiveSurfaceBossCore::CSRTActiveSurfaceBossCore(ContainerServices *service, acscomponent::ACSComponentImpl *me) : m_services(service), - m_thisIsMe(me) + actuatorsInCircle{0,24,24,48,48,48,48,96,96,96,96,96,96,96,96,96,8,4} { m_error_strings[ASErrors::NoError ] = "NoError"; m_error_strings[ASErrors::USDCalibrated ] = "USD calibrated"; @@ -43,14 +41,15 @@ void CSRTActiveSurfaceBossCore::initialize() { ACS_LOG(LM_FULL_INFO,"CSRTActiveSurfaceBossCore::initialize()",(LM_INFO,"CSRTActiveSurfaceBossCore::initialize")); + m_initialized = false; m_enable = false; m_tracking = false; m_status = Management::MNG_WARNING; + m_lut = USDTABLECORRECTIONS; AutoUpdate = false; actuatorcounter = circlecounter = totacts = 1; for(int i = 0; i < SECTORS; i++) { - m_sector.push_back(false); usdCounters.push_back(0); } m_profileSetted = false; @@ -1366,16 +1365,7 @@ void CSRTActiveSurfaceBossCore::asSetLUT(const char *newlut) void CSRTActiveSurfaceBossCore::setProfile(const ActiveSurface::TASProfile& newProfile) throw (ComponentErrors::ComponentErrorsExImpl) { - bool all_sectors = true; - for(unsigned int i = 0; i < SECTORS; i++) - { - if(!m_sector[i]) all_sectors = false; - } - - if (m_newlut == false) - m_lut = USDTABLECORRECTIONS; - - if(all_sectors) // USD tables has not been loaded yet + if(m_initialized) // USD tables has not been loaded yet { ifstream usdCorrections(m_lut); if(!usdCorrections) @@ -1640,7 +1630,8 @@ void CSRTActiveSurfaceBossCore::asStatus4GUIClient(ACS::longSeq& status) throw ( { for (int actuator = 1; actuator <= actuatorsInCircle[circle]; actuator++) { - int usdStatus = 0; + // Initialize the status word as component unavailable. If the component is available it will be overwritten + int usdStatus = UNAV; if(!CORBA::is_nil(usd[circle][actuator])) { diff --git a/SRT/Servers/SRTActiveSurfaceBoss/src/SRTActiveSurfaceBossImpl.cpp b/SRT/Servers/SRTActiveSurfaceBoss/src/SRTActiveSurfaceBossImpl.cpp index 54cb831db89bfef9ffe45aeb1ff8ae80b771f8c5..0be0e130bba3e6ad9bec2163e9144b859ec17d32 100644 --- a/SRT/Servers/SRTActiveSurfaceBoss/src/SRTActiveSurfaceBossImpl.cpp +++ b/SRT/Servers/SRTActiveSurfaceBoss/src/SRTActiveSurfaceBossImpl.cpp @@ -6,6 +6,7 @@ #include "DevIOEnable.h" #include "DevIOProfile.h" #include "DevIOTracking.h" +#include "DevIOLUT.h" static char const *rcsId="@(#) $Id: SRTActiveSurfaceBossImpl.cpp,v 1.2 2010-07-26 12:37:07 c.migoni Exp $"; static void *use_rcsId = ((void)&use_rcsId,(void *) &rcsId); @@ -58,6 +59,7 @@ SRTActiveSurfaceBossImpl::SRTActiveSurfaceBossImpl(const ACE_CString &CompName, m_penabled(this), m_pprofile(this), m_ptracking(this), + m_pLUT_filename(this), m_core(NULL) { AUTO_TRACE("SRTActiveSurfaceBossImpl::SRTActiveSurfaceBossImpl()"); @@ -86,6 +88,7 @@ void SRTActiveSurfaceBossImpl::initialize() throw (ACSErr::ACSbaseExImpl) (getContainerServices()->getName()+":pprofile",getComponent(),new SRTActiveSurfaceBossImplDevIOProfile(m_core),true); m_ptracking=new ROEnumImpl<ACS_ENUM_T(Management::TBoolean),POA_Management::ROTBoolean> (getContainerServices()->getName()+":tracking",getComponent(),new SRTActiveSurfaceBossImplDevIOTracking(m_core),true); + m_pLUT_filename=new ROstring(getContainerServices()->getName()+":LUT_filename",getComponent(),new SRTActiveSurfaceBossImplDevIOLUT(m_core),true); // create the parser for command line execution m_parser = new SimpleParser::CParser<CSRTActiveSurfaceBossCore>(boss,10); @@ -125,25 +128,18 @@ void SRTActiveSurfaceBossImpl::initialize() throw (ACSErr::ACSbaseExImpl) _THROW_EXCPT(ComponentErrors::UnexpectedExImpl,"SRTActiveSurfaceBossImpl::initialize()"); } - for(int sector = 0; sector < SECTORS; sector++) + try { - std::stringstream threadName; - threadName << "SRTACTIVESURFACEBOSSSECTOR"; - threadName << sector+1; - try - { - CSRTActiveSurfaceBossSectorThread* sectorThread = getContainerServices()->getThreadManager()->create<CSRTActiveSurfaceBossSectorThread,CSRTActiveSurfaceBossCore *> (threadName.str().c_str(), boss); - m_sectorThread.push_back(sectorThread); - } - catch (acsthreadErrType::acsthreadErrTypeExImpl& ex) - { - _ADD_BACKTRACE(ComponentErrors::ThreadErrorExImpl,_dummy,ex,"SRTActiveSurfaceBossImpl::initialize()"); - throw _dummy; - } - catch (...) - { - _THROW_EXCPT(ComponentErrors::UnexpectedExImpl,"SRTActiveSurfaceBossImpl::initialize()"); - } + m_initializationThread=getContainerServices()->getThreadManager()->create<CSRTActiveSurfaceBossInitializationThread,CSRTActiveSurfaceBossCore *>("SRTACTIVESURFACEBOSSINITTHREAD",boss); + } + catch (acsthreadErrType::acsthreadErrTypeExImpl& ex) + { + _ADD_BACKTRACE(ComponentErrors::ThreadErrorExImpl,_dummy,ex,"SRTActiveSurfaceBossImpl::initialize()"); + throw _dummy; + } + catch (...) + { + _THROW_EXCPT(ComponentErrors::UnexpectedExImpl,"SRTActiveSurfaceBossImpl::initialize()"); } // configure the parser..... @@ -170,12 +166,7 @@ void SRTActiveSurfaceBossImpl::execute() throw (ACSErr::ACSbaseExImpl) throw _dummy; } m_workingThread->resume(); - - for(unsigned int i = 0; i < m_sectorThread.size(); i++) - { - m_sectorThread[i]->setSleepTime(SECTORTIME); - m_sectorThread[i]->resume(); - } + m_initializationThread->resume(); ACS_LOG(LM_FULL_INFO,"SRTActiveSurfaceBossImpl::execute()",(LM_INFO,"SRTActiveSurfaceBossImpl::COMPSTATE_OPERATIONAL")); } @@ -188,13 +179,10 @@ void SRTActiveSurfaceBossImpl::cleanUp() m_workingThread->suspend(); getContainerServices()->getThreadManager()->destroy(m_workingThread); } - for(unsigned int i = 0; i < m_sectorThread.size(); i++) + if (m_initializationThread!=NULL) { - if(m_sectorThread[i] != NULL) - { - m_sectorThread[i]->suspend(); - getContainerServices()->getThreadManager()->destroy(m_sectorThread[i]); - } + m_initializationThread->suspend(); + getContainerServices()->getThreadManager()->destroy(m_initializationThread); } ACS_LOG(LM_FULL_INFO,"SRTActiveSurfaceBossImpl::cleanUp()",(LM_INFO,"SRTActiveSurfaceBossImpl::THREADS_TERMINATED")); if (m_parser!=NULL) delete m_parser; @@ -619,6 +607,7 @@ _PROPERTY_REFERENCE_CPP(SRTActiveSurfaceBossImpl,Management::ROTSystemStatus,m_p _PROPERTY_REFERENCE_CPP(SRTActiveSurfaceBossImpl,Management::ROTBoolean,m_penabled,enabled); _PROPERTY_REFERENCE_CPP(SRTActiveSurfaceBossImpl,ActiveSurface::ROTASProfile,m_pprofile,pprofile); _PROPERTY_REFERENCE_CPP(SRTActiveSurfaceBossImpl,Management::ROTBoolean,m_ptracking,tracking); +_PROPERTY_REFERENCE_CPP(SRTActiveSurfaceBossImpl,ACS::ROstring,m_pLUT_filename,LUT_filename); /* --------------- [ MACI DLL support functions ] -----------------*/ #include <maciACSComponentDefines.h> MACI_DLL_SUPPORT_FUNCTIONS(SRTActiveSurfaceBossImpl) diff --git a/SRT/Servers/SRTActiveSurfaceBoss/src/SRTActiveSurfaceBossInitializationThread.cpp b/SRT/Servers/SRTActiveSurfaceBoss/src/SRTActiveSurfaceBossInitializationThread.cpp new file mode 100644 index 0000000000000000000000000000000000000000..007a43ac869fc75c5d837f9af747af510c0e1010 --- /dev/null +++ b/SRT/Servers/SRTActiveSurfaceBoss/src/SRTActiveSurfaceBossInitializationThread.cpp @@ -0,0 +1,97 @@ +#include "SRTActiveSurfaceBossInitializationThread.h" + +CSRTActiveSurfaceBossInitializationThread::CSRTActiveSurfaceBossInitializationThread(const ACE_CString& name, CSRTActiveSurfaceBossCore *param, + const ACS::TimeInterval& responseTime,const ACS::TimeInterval& sleepTime) : ACS::Thread(name,responseTime,sleepTime), m_boss(param) +{ + m_thread_name = "SRTActiveSurfaceBossInitializationThread"; + + this->setSleepTime(1000000); + + AUTO_TRACE(std::string(m_thread_name + "::CSRTActiveSurfaceBossInitializationThread()").c_str()); +} + +CSRTActiveSurfaceBossInitializationThread::~CSRTActiveSurfaceBossInitializationThread() +{ + for(unsigned int i = 0; i < m_sectorThread.size(); i++) + { + if(m_sectorThread[i] != NULL) + { + m_sectorThread[i]->suspend(); + m_boss->m_services->getThreadManager()->destroy(m_sectorThread[i]); + } + } + + AUTO_TRACE(std::string(m_thread_name + "::~CSRTActiveSurfaceBossInitializationThread()").c_str()); +} + +void CSRTActiveSurfaceBossInitializationThread::onStart() +{ + AUTO_TRACE(std::string(m_thread_name + "::onStart()").c_str()); + + for(int sector = 0; sector < SECTORS; sector++) + { + std::stringstream threadName; + threadName << "SRTACTIVESURFACEBOSSSECTOR"; + threadName << sector+1; + try + { + CSRTActiveSurfaceBossSectorThread* sectorThread = m_boss->m_services->getThreadManager()->create<CSRTActiveSurfaceBossSectorThread,CSRTActiveSurfaceBossCore *> (threadName.str().c_str(), m_boss); + sectorThread->setSleepTime(SECTORTIME); + sectorThread->resume(); + m_sectorThread.push_back(sectorThread); + } + catch (acsthreadErrType::acsthreadErrTypeExImpl& ex) + { + _ADD_BACKTRACE(ComponentErrors::ThreadErrorExImpl,_dummy,ex,"SRTActiveSurfaceBossInitializationThread::onStart()"); + throw _dummy; + } + catch (...) + { + _THROW_EXCPT(ComponentErrors::UnexpectedExImpl,"SRTActiveSurfaceBossInitializationThread::onStart()"); + } + } + + TIMEVALUE now; + CIRATools::getTime(now); + this->timestart = now.value().value; +} + +void CSRTActiveSurfaceBossInitializationThread::onStop() +{ + m_boss->m_initialized = true; + + ACS_LOG(LM_FULL_INFO, std::string(m_thread_name + "::onStop()").c_str(), (LM_NOTICE, "ACTIVE SURFACE INITIALIZED")); + + AUTO_TRACE(std::string(m_thread_name + "::onStop()").c_str()); +} + +void CSRTActiveSurfaceBossInitializationThread::runLoop() +{ + for(unsigned int i = 0; i < m_sectorThread.size(); i++) + { + if(m_sectorThread[i]->isAlive()) + { + return; + } + } + + // Set CDB calibrate parameter to 0 where needed + for(int circle = 1; circle <= CIRCLES; circle++) + { + for(int actuator = 1; actuator <= m_boss->actuatorsInCircle[circle]; actuator++) + { + if(!CORBA::is_nil(m_boss->usd[circle][actuator])) + { + int usdStatus = 0; + m_boss->usd[circle][actuator]->getStatus(usdStatus); + + if(!(usdStatus & CAL)) + { + CIRATools::setDBValue(m_boss->m_services, "calibrate", (const long)0, "alma/", m_boss->usd[circle][actuator]->name()); + } + } + } + } + + this->setStopped(); +} diff --git a/SRT/Servers/SRTActiveSurfaceBoss/src/SRTActiveSurfaceBossSectorThread.cpp b/SRT/Servers/SRTActiveSurfaceBoss/src/SRTActiveSurfaceBossSectorThread.cpp index 0d35aed430aceec860c18b7059c8befa6d1e875b..5abef165e8619c8407c2c18456127516151bd159 100644 --- a/SRT/Servers/SRTActiveSurfaceBoss/src/SRTActiveSurfaceBossSectorThread.cpp +++ b/SRT/Servers/SRTActiveSurfaceBoss/src/SRTActiveSurfaceBossSectorThread.cpp @@ -83,7 +83,6 @@ void CSRTActiveSurfaceBossSectorThread::runLoop() } else { - m_boss->m_sector[m_sector] = true; this->setStopped(); } }