diff --git a/.github/utils/download_from_gdrive.py b/.github/utils/download_from_gdrive.py deleted file mode 100755 index 1a01b42db8a5a5e02a31bee40fd1df503a4a41a1..0000000000000000000000000000000000000000 --- a/.github/utils/download_from_gdrive.py +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env python -from google.oauth2.credentials import Credentials -from google.auth.transport.requests import Request -from googleapiclient.discovery import build -from googleapiclient.http import MediaIoBaseDownload -import os -import io - -TOKEN_FILE = 'token.json' -VM_FILE_PATH = '/home/runner/discos_manager.ova' -ARCHIVE_FILE_PATH = '/home/runner/vagrant.tar.gz' -SCOPES = ['https://www.googleapis.com/auth/drive.readonly'] - -# Create the token file from the GH Secret -with open(TOKEN_FILE, 'w') as tokenfile: - tokenfile.write(os.environ.get('GOOGLE_DRIVE_TOKEN')) - -# Authenticate with the token and eventually update it -creds = Credentials.from_authorized_user_file(TOKEN_FILE, SCOPES) -if creds.expired and creds.refresh_token: - creds.refresh(Request()) - -# Download the VM -creds = Credentials.from_authorized_user_file(TOKEN_FILE, SCOPES) -if creds.expired and creds.refresh_token: - creds.refresh(Request()) - -service = build('drive', 'v3', credentials=creds) - -downloader = MediaIoBaseDownload( - io.FileIO(ARCHIVE_FILE_PATH, 'wb'), - service.files().get_media( - fileId=os.environ.get('PROVISIONED_ARCHIVE_GDRIVE_ID') - ) -) -done = False -while not done: - _, done = downloader.next_chunk() - -downloader = MediaIoBaseDownload( - io.FileIO(VM_FILE_PATH, 'wb'), - service.files().get_media( - fileId=os.environ.get('PROVISIONED_VM_GDRIVE_ID'), - ), - chunksize=5*1024*1024 -) -done = False -while not done: - _, done = downloader.next_chunk() - -# Finally update the token file -with open(TOKEN_FILE, 'w') as tokenfile: - tokenfile.write(creds.to_json()) diff --git a/.github/utils/gdrive_requirements.txt b/.github/utils/gdrive_requirements.txt deleted file mode 100644 index 7c68661757fab083504dd82d496d285635f78a96..0000000000000000000000000000000000000000 --- a/.github/utils/gdrive_requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -google-auth -google-auth-oauthlib -google-auth-httplib2 -google-api-python-client diff --git a/.github/workflows/workflow.yml b/.github/workflows/deploy-discos.yml similarity index 69% rename from .github/workflows/workflow.yml rename to .github/workflows/deploy-discos.yml index b31e196449faccb35c03a3254d91baeb652bc776..86de67074a56d176f7a6e0a2d40e8dc87938f674 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/deploy-discos.yml @@ -2,10 +2,22 @@ name: DISCOS deployment and build on: push: - workflow_dispatch: + pull_request: jobs: + wait-for-download: + name: Wait for any pending download + runs-on: ubuntu-latest + concurrency: + group: download + cancel-in-progress: false + steps: + - name: Go on with deployment + run: true deploy-discos: + name: Deploy DISCOS + runs-on: ubuntu-latest + needs: wait-for-download env: REPOSITORY_TOKEN: "${{ secrets.DEPENDENCIES_TOKEN }}" GH_TOKEN: "${{ secrets.GH_WORKFLOWS_TOKEN }}" @@ -16,33 +28,37 @@ jobs: fail-fast: false matrix: station: ['SRT', 'Medicina', 'Noto'] - runs-on: ubuntu-22.04 steps: - name: Free up space uses: jlumbroso/free-disk-space@main with: tool-cache: true - - name: Install Vagrant + - name: Install Vagrant and VirtualBox run: | wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list sudo apt update && sudo apt install vagrant - - name: Install VirtualBox - run: | - wget https://download.virtualbox.org/virtualbox/7.0.14/virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb - sudo apt install ./virtualbox-7.0_7.0.14-161095~Ubuntu~jammy_amd64.deb - - name: Clone the repository - uses: actions/checkout@v4 + sudo apt install virtualbox - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3' check-latest: true - - name: Download the provisioned virtual machine from Google Drive + - name: Clone the deployment repository + uses: actions/checkout@v4 + with: + repository: 'discos/deployment' + - name: Install deployment package and dependencies run: | - pip install -r .github/utils/gdrive_requirements.txt - python .github/utils/download_from_gdrive.py - gh secret set GOOGLE_DRIVE_TOKEN --org discos --visibility selected --repos discos,deployment < token.json + python -m pip install -r requirements.txt + pip install . + - name: Retrieve the VM from cache + uses: actions/cache/restore@v4 + with: + key: discos-manager-vm + path: | + /home/runner/discos_manager.ova + /home/runner/vagrant.tar.gz - name: Install the virtual machine run: | vboxmanage import discos_manager.ova --vsys 0 --options keepallmacs @@ -54,17 +70,16 @@ jobs: sed -i "s/$(cat id)/$(vboxmanage list vms | grep 'discos_manager' | grep -oP '(?<=\{)[0-9a-fA-F-]+(?=\})')/" action_provision sed -i "s/$(cat id)/$(vboxmanage list vms | grep 'discos_manager' | grep -oP '(?<=\{)[0-9a-fA-F-]+(?=\})')/" id working-directory: /home/runner/.deployment/.vagrant/machines/manager/virtualbox/ - - name: Clone the deployment repository - uses: actions/checkout@v4 - with: - repository: 'discos/deployment' - - name: Install deployment package and dependencies + - name: Set the branch name run: | - python -m pip install -r requirements.txt - pip install . + if [ "${{ github.event_name }}" == "push" ]; then + echo "BRANCH_NAME=${{ github.ref_name }}" >> $GITHUB_ENV + elif [ "${{ github.event_name }}" == "pull_request" ]; then + echo "BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV + fi - name: Deploy DISCOS run: | - discos-deploy manager:development --deploy-only -s ${{ matrix.station }} -b ${{ github.ref_name }} + discos-deploy manager:development --deploy-only -s ${{ matrix.station }} -b ${{ env.BRANCH_NAME }} - name: Shutdown the virtual machine run: | discos-vms stop diff --git a/Common/Libraries/IRALibrary/include/IRATools.h b/Common/Libraries/IRALibrary/include/IRATools.h index 33a03b6870363c129ac8f9b5c2083cff736b27e9..3525548d7ed8f08ad0703acf0d87dbd80c511c75 100644 --- a/Common/Libraries/IRALibrary/include/IRATools.h +++ b/Common/Libraries/IRALibrary/include/IRATools.h @@ -354,10 +354,23 @@ public: * @param start position inside the string from which to start the next token, if a new token has been found * it points to the character immediately after the localized token * @param delimiter this is the character that separates the token - * @param it returns the next token in the string + * @param ret it returns the next token in the string + * @param stopAtFirst immediately returns (true) if the first character found is one of the delimiters, otherwise it goes further inside str * @return true if a token has been found */ - static bool getNextToken(const IRA::CString& str,int &start,char delimiter,IRA::CString &ret); + static bool getNextToken(const IRA::CString& str,int &start,const char& delimiter,IRA::CString &ret, const bool& stopAtFirst=true); + + /** + * Use this function to divide a string into separated tokens. Multiple token delimiters can be specified. + * @param str string to be divided into tokens + * @param start position inside the string from which to start the next token, if a new token has been found + * it points to the character immediately after the localized token + * @param delimiters vector that contains characters that separate the token + * @param ret it returns the next token in the string + * @param stopAtFirst immediately returns (true) if the first character found is one of the delimiters, otherwise it goes further inside str + * @return true if a token has been found + */ + static bool getNextToken(const IRA::CString& str,int &start,const std::vector& delimiters,IRA::CString &ret, const bool& stopAtFirst=true); /** * Computes the normalized (+/-PI) difference between two angles expressed in radians(a-b). For example 359°-1°=-2°,1°-359°=2°, 179°-360°=179° and so on. diff --git a/Common/Libraries/IRALibrary/src/IRATools.cpp b/Common/Libraries/IRALibrary/src/IRATools.cpp index ab893ab5157988309410c616d0dfd6f2c70d73f3..ede299471e4977e0de4cf6126a96e68a4a5f8f33 100644 --- a/Common/Libraries/IRALibrary/src/IRATools.cpp +++ b/Common/Libraries/IRALibrary/src/IRATools.cpp @@ -40,13 +40,13 @@ void CIRATools::Wait(long long micro) DDWORD CIRATools::timeMicroSeconds(TIMEDIFFERENCE& time) { DDWORD tmp; - tmp=((((time.day()*24+time.hour())*60LL+time.minute())*60+time.second())*1000000+time.microSecond()); + tmp=((((time.day()*24+time.hour())*60LL+time.minute())*60+time.second())*1000000+time.microSecond()); return tmp; } void CIRATools::getTime(TIMEVALUE& Now) { - Now.value(TimeUtil::ace2epoch(ACE_OS::gettimeofday())); + Now.value(TimeUtil::ace2epoch(ACE_OS::gettimeofday())); } ACS::Time CIRATools::getACSTime() @@ -89,7 +89,7 @@ DDWORD CIRATools::timeDifference(TIMEVALUE& First,TIMEVALUE& Last) diff=Last.difference(First.value()); } DurationHelper diffHelper(diff); - return timeMicroSeconds(diffHelper); + return timeMicroSeconds(diffHelper); } long long CIRATools::timeSubtract(const TIMEVALUE& First,const TIMEVALUE& Second) @@ -114,7 +114,7 @@ bool CIRATools::getDBValue(maci::ContainerServices *Services,CString fieldName,d try { CDB::DAL_var Dal_p=Services->getCDB(); CDB::DAO_var Dao_p=Dal_p->get_DAO_Servant((const char *)fullName); - Val=Dao_p->get_double((const char *)fieldName); + Val=Dao_p->get_double((const char *)fieldName); } catch (...) { return false; @@ -130,7 +130,7 @@ bool CIRATools::getDBValue(maci::SimpleClient *client,CString fieldName,double & CORBA::Object_var obj=client->getComponent("CDB",0,false); CDB::DAL_var Dal_p=CDB::DAL::_narrow(obj); CDB::DAO_var Dao_p=Dal_p->get_DAO_Servant((const char *)fullName); - Val=Dao_p->get_double((const char *)fieldName); + Val=Dao_p->get_double((const char *)fieldName); } catch (...) { return false; @@ -146,7 +146,7 @@ bool CIRATools::getDBValue(maci::ContainerServices *Services,CString fieldName,l try { CDB::DAL_var Dal_p=Services->getCDB(); CDB::DAO_var Dao_p=Dal_p->get_DAO_Servant((const char *)fullName); - Val=Dao_p->get_long((const char *)fieldName); + Val=Dao_p->get_long((const char *)fieldName); } catch (...) { return false; @@ -162,7 +162,7 @@ bool CIRATools::getDBValue(maci::SimpleClient *client,CString fieldName,long &Va CORBA::Object_var obj=client->getComponent("CDB",0,false); CDB::DAL_var Dal_p=CDB::DAL::_narrow(obj); CDB::DAO_var Dao_p=Dal_p->get_DAO_Servant((const char *)fullName); - Val=Dao_p->get_long((const char *)fieldName); + Val=Dao_p->get_long((const char *)fieldName); } catch (...) { return false; @@ -179,13 +179,13 @@ bool CIRATools::getDBValue(maci::ContainerServices *Services,CString fieldName,D try { CDB::DAL_var Dal_p=Services->getCDB(); CDB::DAO_var Dao_p=Dal_p->get_DAO_Servant((const char *)fullName); - app=Dao_p->get_long((const char *)fieldName); + app=Dao_p->get_long((const char *)fieldName); } catch (...) { return false; } Val=(DWORD)app; - return true; + return true; } bool CIRATools::getDBValue(maci::SimpleClient *client,CString fieldName,DWORD &Val,CString Domain,CString name) @@ -197,13 +197,13 @@ bool CIRATools::getDBValue(maci::SimpleClient *client,CString fieldName,DWORD &V CORBA::Object_var obj=client->getComponent("CDB",0,false); CDB::DAL_var Dal_p=CDB::DAL::_narrow(obj); CDB::DAO_var Dao_p=Dal_p->get_DAO_Servant((const char *)fullName); - app=Dao_p->get_long((const char *)fieldName); + app=Dao_p->get_long((const char *)fieldName); } catch (...) { return false; } Val=(DWORD)app; - return true; + return true; } bool CIRATools::getDBValue(maci::ContainerServices *Services,CString fieldName,CString &Val,CString Domain,CString name) @@ -227,7 +227,7 @@ bool CIRATools::getDBValue(maci::SimpleClient *client,CString fieldName,CString { CString fullName; fullName=Domain+name; - try { + try { CORBA::Object_var obj=client->getComponent("CDB",0,false); CDB::DAL_var Dal_p=CDB::DAL::_narrow(obj); CDB::DAO_var Dao_p=Dal_p->get_DAO_Servant((const char *)fullName); @@ -249,7 +249,7 @@ bool CIRATools::setDBValue(maci::ContainerServices* Services,CString fieldName,c CDB::DAL_var Dal_p=Services->getCDB(); CDB::WDAL_var wDal_p=CDB::WDAL::_narrow(Dal_p); CDB::WDAO_var wDao_p=wDal_p->get_WDAO_Servant((const char *)fullName); - wDao_p->set_double((const char *)fieldName,Val); + wDao_p->set_double((const char *)fieldName,Val); } catch (...) { return false; @@ -266,7 +266,7 @@ bool CIRATools::setDBValue(maci::ContainerServices* Services,CString fieldName,c CDB::DAL_var Dal_p=Services->getCDB(); CDB::WDAL_var wDal_p=CDB::WDAL::_narrow(Dal_p); CDB::WDAO_var wDao_p=wDal_p->get_WDAO_Servant((const char *)fullName); - wDao_p->set_long((const char *)fieldName,Val); + wDao_p->set_long((const char *)fieldName,Val); } catch (...) { return false; @@ -283,12 +283,12 @@ bool CIRATools::setDBValue(maci::ContainerServices* Services,CString fieldName,c CDB::DAL_var Dal_p=Services->getCDB(); CDB::WDAL_var wDal_p=CDB::WDAL::_narrow(Dal_p); CDB::WDAO_var wDao_p=wDal_p->get_WDAO_Servant((const char *)fullName); - wDao_p->set_long((const char *)fieldName,Val); + wDao_p->set_long((const char *)fieldName,Val); } catch (...) { return false; } - return true; + return true; } bool CIRATools::setDBValue(maci::ContainerServices* Services,CString fieldName,const CString &Val,CString Domain,CString name) @@ -300,7 +300,7 @@ bool CIRATools::setDBValue(maci::ContainerServices* Services,CString fieldName,c CDB::DAL_var Dal_p=Services->getCDB(); CDB::WDAL_var wDal_p=CDB::WDAL::_narrow(Dal_p); CDB::WDAO_var wDao_p=wDal_p->get_WDAO_Servant((const char *)fullName); - wDao_p->set_string((const char *)fieldName,(const char*)Val); + wDao_p->set_string((const char *)fieldName,(const char*)Val); } catch (...) { return false; @@ -340,11 +340,11 @@ double CIRATools::getHWAzimuth(const double& current,const double& dest,const do } if (d1<=d2) { newOne=tmpCurrent+d1; - if ((newOne>tmpMaxAz) || (newOnetmpMaxAz) || (newOnetmpMaxAz) || (newOnetmpMaxAz) || (newOne0) { //CW (typically 180...450 @@ -369,7 +369,7 @@ double CIRATools::getHWAzimuth(const double& current,const double& dest,const do } else { // not reachable in this sector (typically 180..270 newOne=tmpDest; - } + } } return newOne; } @@ -397,7 +397,12 @@ bool CIRATools::skyFrequency(const double& bf,const double& bbw,const double& rf }*/ } -bool CIRATools::getNextToken(const IRA::CString& str,int &start,char delimiter,IRA::CString &ret) +bool CIRATools::getNextToken(const IRA::CString& str,int &start,const char& delimiter,IRA::CString &ret, const bool& stopAtFirst) +{ + return getNextToken(str, start, std::vector{ delimiter }, ret, stopAtFirst); +} + +bool CIRATools::getNextToken(const IRA::CString& str,int &start,const std::vector& delimiters,IRA::CString &ret, const bool& stopAtFirst) { int i; bool ok=false; @@ -406,22 +411,24 @@ bool CIRATools::getNextToken(const IRA::CString& str,int &start,char delimiter,I token=new char[i+1]; i=0; while (str[start]!=0) { + char c = str[start]; ok=true; - if ((str[start]==delimiter)) { - start++; + start++; + if (std::any_of(delimiters.begin(), delimiters.end(), [c](char d){ return c == d; })) { + // We still have not found any meaningful character, stop if stopAtFirst or continue skipping a delimiter + if(!stopAtFirst && i==0) + continue; break; } else { - token[i]=str[start]; - start++; + token[i]=c; i++; } } token[i]=0; ret=IRA::CString(token); delete []token; - if (!ok) return false; - else return true; + return ok; } double CIRATools::differenceBetweenAnglesRad(const double& a,const double& b) @@ -504,7 +511,7 @@ bool CIRATools::strToInterval(const IRA::CString& durationString,ACS::TimeInterv else { hour=0; minute=0; - second=timeToken[0].ToDouble(); + second=timeToken[0].ToDouble(); } } else if (dCounter==2) { @@ -522,7 +529,7 @@ bool CIRATools::strToInterval(const IRA::CString& durationString,ACS::TimeInterv else if (dCounter==3) { hour=timeToken[0].ToLong(); minute=timeToken[1].ToLong(); - second=timeToken[2].ToDouble(); + second=timeToken[2].ToDouble(); } if ((hour<0) || (hour>23)) return false; if ((minute<0) || (minute>59)) return false; @@ -541,7 +548,7 @@ bool CIRATools::strToInterval(const IRA::CString& durationString,ACS::TimeInterv usec=(long)(second*1000000.0); period.hour(hour); period.minute(minute); period.second(sec); period.microSecond(usec); interval=period.value().value; - return true; + return true; } bool CIRATools::intervalToStr(const ACS::TimeInterval& interval,IRA::CString& outString,char dateDelimiter,char timeDelimiter) @@ -565,7 +572,7 @@ bool CIRATools::strToTime(const IRA::CString& timeString,ACS::Time& time,bool co IRA::CIRATools::getTime(now); int p,i=0,dCounter=0; IRA::CDateTime dt; - + while (((p=timeString.Find(dateDelimiter,i))>0) && (dCounter<2)) { dateToken[dCounter]=timeString.Mid(i,p-i); dCounter++; @@ -582,25 +589,25 @@ bool CIRATools::strToTime(const IRA::CString& timeString,ACS::Time& time,bool co } else { year=dateToken[0].ToLong(); - doy=dateToken[1].ToLong(); + doy=dateToken[1].ToLong(); } if (getNextToken(timeString,i,timeDelimiter,token)) { //now read all three fields of the time representation hour=token.ToLong(); if (getNextToken(timeString,i,timeDelimiter,token)) { minute=token.ToLong(); - if (getNextToken(timeString,i,timeDelimiter,token)) { + if (getNextToken(timeString,i,timeDelimiter,token)) { second=token.ToDouble(); } else { if (complete) return false; second=0.0; - } + } } else { if (complete) return false; minute=0; second=0.0; - } + } } else { return false; @@ -631,7 +638,7 @@ bool CIRATools::timeToStr(const ACS::Time& time,IRA::CString& outString,char dat TIMEVALUE timeE(time); outString.Format("%04lu%c%03ld%c%02ld%c%02ld%c%02ld.%03ld",(unsigned long)timeE.year(),dateDelimiter,(long)timeE.dayOfYear(),dateDelimiter,(long)timeE.hour(), timeDelimiter,(long)timeE.minute(),timeDelimiter,(long)timeE.second(),(long)timeE.microSecond()/1000); - return true; + return true; } bool CIRATools::timeToStrExtended(const ACS::Time& time,IRA::CString& outString,char dateDelimiter,char timeDelimiter) @@ -676,7 +683,7 @@ bool CIRATools::longSeqToStr(const ACS::longSeq& val,IRA::CString& outString,cha bool CIRATools::hourAngleToRad(const IRA::CString& angle,double& rad,bool complete,char delimiter) { - int p,i=0,dCounter=0; + int p,i=0,dCounter=0; long hour=0,minute=0; double second=0.0; bool sign; @@ -704,7 +711,7 @@ bool CIRATools::hourAngleToRad(const IRA::CString& angle,double& rad,bool comple else if (dCounter==3) { hour=token[0].ToLong(); minute=token[1].ToLong(); - second=token[2].ToDouble(); + second=token[2].ToDouble(); } if (token[0][0]=='-') { sign=true; @@ -720,8 +727,8 @@ bool CIRATools::hourAngleToRad(const IRA::CString& angle,double& rad,bool comple rad=slaDranrm(rad); if (sign) { rad*=-1; - } - return true; + } + return true; } bool CIRATools::radToHourAngle(const double& rad,IRA::CString& outString,char delimiter) @@ -741,7 +748,7 @@ bool CIRATools::radToHourAngle(const double& rad,IRA::CString& outString,char de bool CIRATools::sexagesimalAngleToRad(const IRA::CString& angle,double& rad,bool complete,char delimiter) { - int p,i=0,dCounter=0; + int p,i=0,dCounter=0; long deg=0,arcminute=0; double arcsecond=0.0; bool sign; @@ -769,14 +776,14 @@ bool CIRATools::sexagesimalAngleToRad(const IRA::CString& angle,double& rad,bool else if (dCounter==3) { deg=token[0].ToLong(); arcminute=token[1].ToLong(); - arcsecond=token[2].ToDouble(); + arcsecond=token[2].ToDouble(); } //degrees could also be negative...... if (token[0][0]=='-') { sign=true; deg*=-1; } - else { + else { sign=false; } if ((arcminute<0) || (arcminute>59)) return false; @@ -786,16 +793,16 @@ bool CIRATools::sexagesimalAngleToRad(const IRA::CString& angle,double& rad,bool if (sign) { rad*=-1; } - return true; + return true; } bool CIRATools::radToSexagesimalAngle(const double& rad,IRA::CString& outString,char delimiter) { char sign; - int dmsf[4]; + int dmsf[4]; double ranged=dmod(rad,D2PI); // put the angle in the range -2PI..2PI // convert it into hour minute second anf fraction..keeping track of the sign - slaDr2af(3,ranged,&sign,dmsf); + slaDr2af(3,ranged,&sign,dmsf); if (sign=='+') { outString.Format("%02d%c%02d%c%02d.%03d",dmsf[0],delimiter,dmsf[1],delimiter,dmsf[2],dmsf[3]); } @@ -810,7 +817,7 @@ bool CIRATools::angleToRad(const IRA::CString& angle,double& rad) double deg=angle.ToDouble(); rad=deg*DD2R; rad=dmod(rad,D2PI); - return true; + return true; } bool CIRATools::radToAngle(const double& rad,IRA::CString& outString) @@ -866,7 +873,7 @@ bool CIRATools::latitudeToRad(const IRA::CString& lat,double& rad,bool complete, bool CIRATools::rightAscensionToRad(const IRA::CString& ra,double& rad,bool complete,char delimiter) { //long len=ra.GetLength(); - int len=ra.GetLength(); + int len=ra.GetLength(); bool res; if (len==0) return false; if (ra[len-1]=='d') { @@ -926,7 +933,7 @@ bool CIRATools::azimuthToRad(const IRA::CString& az,double& rad,bool complete) } else return res; } - + bool CIRATools::elevationToRad(const IRA::CString& el,double& rad,bool complete) { bool res=angleToRad(el,rad); @@ -1140,13 +1147,13 @@ bool CIRATools::makeDirectory(const IRA::CString& pathName) bool CIRATools::directoryExists(const IRA::CString& path) { DIR *dir; - bool exists=false; - dir=opendir((const char *)path); - if (dir!=NULL) { - exists=true; - closedir(dir); - } - return exists; + bool exists=false; + dir=opendir((const char *)path); + if (dir!=NULL) { + exists=true; + closedir(dir); + } + return exists; } bool CIRATools::fileExists(const IRA::CString& file) @@ -1178,27 +1185,27 @@ bool CIRATools::deleteFile(const IRA::CString& file) bool CIRATools::copyFile(const IRA::CString& src,const IRA::CString& dst) { - std::ifstream in ((const char *)src); - if (in.fail()) return false; - std::ofstream out ((const char *)dst); - if (out.fail()) return false; - out << in.rdbuf(); - out.close(); - in.close(); - return true; + std::ifstream in ((const char *)src); + if (in.fail()) return false; + std::ofstream out ((const char *)dst); + if (out.fail()) return false; + out << in.rdbuf(); + out.close(); + in.close(); + return true; } bool CIRATools::extractFileName(const IRA::CString& fullPath,IRA::CString& baseDir,IRA::CString& baseName, IRA::CString& extension) { - char *dirc, *basec; - dirc=strdup((const char *)fullPath); // the APIs called below might change the content of the input string - basec=strdup((const char *)fullPath); - baseDir=IRA::CString(dirname(dirc)); - baseName=IRA::CString(basename(basec)); - if ((baseDir.GetLength()==0) || (baseName.GetLength()==0)) { - return false; - } + char *dirc, *basec; + dirc=strdup((const char *)fullPath); // the APIs called below might change the content of the input string + basec=strdup((const char *)fullPath); + baseDir=IRA::CString(dirname(dirc)); + baseName=IRA::CString(basename(basec)); + if ((baseDir.GetLength()==0) || (baseName.GetLength()==0)) { + return false; + } int pos=baseName.Find('.'); if (pos<0) { // not found extension=""; @@ -1297,9 +1304,9 @@ bool CIRATools::matchRegExp(const IRA::CString& input,const IRA::CString& expr,s std::string out(what[i].first,what[i].second); res.push_back(out.c_str()); } - start=what[0].second; - //flags|=boost::match_prev_avail; - //flags|=boost::match_not_bob; + start=what[0].second; + //flags|=boost::match_prev_avail; + //flags|=boost::match_not_bob; } return true; } diff --git a/Common/Servers/Scheduler/include/Schedule.h b/Common/Servers/Scheduler/include/Schedule.h index 6aba618e94dc75fda40d7fc66a720c3e59742c66..1badc85c13d1b0d5244d8b39158837c72703e80c 100644 --- a/Common/Servers/Scheduler/include/Schedule.h +++ b/Common/Servers/Scheduler/include/Schedule.h @@ -24,7 +24,7 @@ #include "Configuration.h" #define _SCHED_NULLTARGET "NULL" -#define SEPARATOR '\t' +#define SEPARATORS std::vector{'\t', ' '} #define MAX_SCHED_NAME_LEN 37 /** diff --git a/Common/Servers/Scheduler/src/Makefile b/Common/Servers/Scheduler/src/Makefile index d1639108f2a37a4db5d4ee06a1419da42fccecf3..706a0f297808150385a7f95b2757476e0970b96c 100644 --- a/Common/Servers/Scheduler/src/Makefile +++ b/Common/Servers/Scheduler/src/Makefile @@ -38,13 +38,16 @@ RESTRICT_PERMS=_tp_agc # C programs (public and local) # ----------------------------- EXECUTABLES = scheduleChecker -EXECUTABLES_L = testSched testLSTtoUT +EXECUTABLES_L = testSched testSchedules testLSTtoUT # # testSched_OBJECTS = testSchedule Schedule SubScanBinder Schedule_ScanList Configuration testSched_LIBS = IRALibrary ComponentErrors +testSchedules_OBJECTS = testSchedules Schedule SubScanBinder Schedule_ScanList Configuration +testSchedules_LIBS = IRALibrary ComponentErrors boost_system boost_filesystem + testLSTtoUT_OBJECTS = testLST2UT testLSTtoUT_LIBS = IRALibrary ComponentErrors diff --git a/Common/Servers/Scheduler/src/Schedule.cpp b/Common/Servers/Scheduler/src/Schedule.cpp index 60c1c9775da72aa88d908104bc91a6be06c66823..3d315dd025f836f331c4c9d1b1195f317b7336f7 100644 --- a/Common/Servers/Scheduler/src/Schedule.cpp +++ b/Common/Servers/Scheduler/src/Schedule.cpp @@ -920,48 +920,48 @@ bool CSchedule::parseLine(const IRA::CString& line,const DWORD& lnNumber,IRA::CS { int start=0; IRA::CString ret; - if (!IRA::CIRATools::getNextToken(line,start,SEPARATOR,ret)) { + if (!IRA::CIRATools::getNextToken(line,start,SEPARATORS,ret,false)) { return false; } else { // token could be extracted ret.MakeUpper(); if (ret==PROJECT) { - if (!IRA::CIRATools::getNextToken(line,start,SEPARATOR,m_projectName)) { + if (!IRA::CIRATools::getNextToken(line,start,SEPARATORS,m_projectName,false)) { errorMsg="cannot parse project name"; return false; } else return true; } else if (ret==OBSERVER) { - if (!IRA::CIRATools::getNextToken(line,start,SEPARATOR,m_observer)) { + if (!IRA::CIRATools::getNextToken(line,start,SEPARATORS,m_observer,false)) { errorMsg="cannot parse observer name"; return false; } else return true; } else if (ret==SCANLIST) { - if (!IRA::CIRATools::getNextToken(line,start,SEPARATOR,m_scanList)) { + if (!IRA::CIRATools::getNextToken(line,start,SEPARATORS,m_scanList,false)) { errorMsg="cannot parse scan list file name"; return false; } else return true; } else if (ret==PROCLIST) { - if (!IRA::CIRATools::getNextToken(line,start,SEPARATOR,m_configList)) { + if (!IRA::CIRATools::getNextToken(line,start,SEPARATORS,m_configList,false)) { errorMsg="cannot parse procedure list file name"; return false; } else return true; } else if (ret==BACKENDLIST) { - if (!IRA::CIRATools::getNextToken(line,start,SEPARATOR,m_backendList)) { + if (!IRA::CIRATools::getNextToken(line,start,SEPARATORS,m_backendList,false)) { errorMsg="cannot parse backend configurations file name"; return false; } else return true; } else if (ret==SCANLAYOUT) { - if (!IRA::CIRATools::getNextToken(line,start,SEPARATOR,m_layoutFile)) { + if (!IRA::CIRATools::getNextToken(line,start,SEPARATORS,m_layoutFile,false)) { errorMsg="cannot parse scan layouts file name"; return false; } @@ -969,14 +969,14 @@ bool CSchedule::parseLine(const IRA::CString& line,const DWORD& lnNumber,IRA::CS } else if (ret==MODE) { IRA::CString mode,rep,startTime; - if (!IRA::CIRATools::getNextToken(line,start,SEPARATOR,mode)) { + if (!IRA::CIRATools::getNextToken(line,start,SEPARATORS,mode,false)) { errorMsg="cannot parse schedule mode"; return false; } else { m_modeDone=true; if (mode==LSTMODE) { - if (!IRA::CIRATools::getNextToken(line,start,SEPARATOR,rep)) { + if (!IRA::CIRATools::getNextToken(line,start,SEPARATORS,rep,false)) { errorMsg="cannot parse repetitions number for LST mode"; return false; } @@ -989,7 +989,7 @@ bool CSchedule::parseLine(const IRA::CString& line,const DWORD& lnNumber,IRA::CS } } else if (mode==SEQMODE) { - if (!IRA::CIRATools::getNextToken(line,start,SEPARATOR,startTime)) { + if (!IRA::CIRATools::getNextToken(line,start,SEPARATORS,startTime,false)) { m_mode=SEQ; //if it has not an extra argument the sequential is pure return true; } @@ -1011,11 +1011,11 @@ bool CSchedule::parseLine(const IRA::CString& line,const DWORD& lnNumber,IRA::CS } else if (ret==ELEVATIONLIMITS) { IRA::CString minEl,maxEl; - if (!IRA::CIRATools::getNextToken(line,start,SEPARATOR,minEl)) { + if (!IRA::CIRATools::getNextToken(line,start,SEPARATORS,minEl,false)) { errorMsg="elevation lower limit missing or not correct"; return false; } - if (!IRA::CIRATools::getNextToken(line,start,SEPARATOR,maxEl)) { + if (!IRA::CIRATools::getNextToken(line,start,SEPARATORS,maxEl,false)) { errorMsg="elevation upper limit missing or not correct"; return false; } @@ -1039,7 +1039,7 @@ bool CSchedule::parseLine(const IRA::CString& line,const DWORD& lnNumber,IRA::CS } else if (ret==SCANTAG) { IRA::CString scanTag; - if (!IRA::CIRATools::getNextToken(line,start,SEPARATOR,scanTag)) { + if (!IRA::CIRATools::getNextToken(line,start,SEPARATORS,scanTag,false)) { errorMsg="cannot parse scan tag"; return false; } @@ -1049,7 +1049,7 @@ bool CSchedule::parseLine(const IRA::CString& line,const DWORD& lnNumber,IRA::CS return true; } else if (ret==INITPROC) { - if (!IRA::CIRATools::getNextToken(line,start,SEPARATOR,m_initProc)) { + if (!IRA::CIRATools::getNextToken(line,start,SEPARATORS,m_initProc,false)) { errorMsg="cannot parse schedule initialization procedure"; return false; } @@ -1080,7 +1080,7 @@ bool CSchedule::parseScans(const IRA::CString& line,const DWORD& lnNumber,IRA::C //ACS::Time ut; TRecord *p; start=0; - if (!IRA::CIRATools::getNextToken(line,start,SEPARATOR,ret)) { + if (!IRA::CIRATools::getNextToken(line,start,SEPARATORS,ret,false)) { errorMsg="schedule format error"; return false; } @@ -1088,7 +1088,7 @@ bool CSchedule::parseScans(const IRA::CString& line,const DWORD& lnNumber,IRA::C ret.MakeUpper(); if (ret==SCAN_START) { //process scan definition m_currentScanDef.valid=false; - if (!IRA::CIRATools::getNextToken(line,start,SEPARATOR,ret)) { // scan id + if (!IRA::CIRATools::getNextToken(line,start,SEPARATORS,ret,false)) { // scan id errorMsg="scan identifier cannot be found"; return false; } @@ -1104,14 +1104,14 @@ bool CSchedule::parseScans(const IRA::CString& line,const DWORD& lnNumber,IRA::C } m_currentScanDef.id=tempId; } - if (!IRA::CIRATools::getNextToken(line,start,SEPARATOR,ret)) { //suffix + if (!IRA::CIRATools::getNextToken(line,start,SEPARATORS,ret,false)) { //suffix errorMsg="scan suffix cannot be found"; return false; } else { m_currentScanDef.suffix=ret; } - if (!IRA::CIRATools::getNextToken(line,start,SEPARATOR,ret)) { //backend:datawriter + if (!IRA::CIRATools::getNextToken(line,start,SEPARATORS,ret,false)) { //backend:datawriter errorMsg="backend/datawriter cannot be found"; return false; } @@ -1131,7 +1131,7 @@ bool CSchedule::parseScans(const IRA::CString& line,const DWORD& lnNumber,IRA::C m_currentScanDef.writerInstance=_SCHED_NULLTARGET; } } - if (IRA::CIRATools::getNextToken(line,start,SEPARATOR,ret)) { //layout...not mandatory + if (IRA::CIRATools::getNextToken(line,start,SEPARATORS,ret,false)) { //layout...not mandatory if (m_layoutFile=="") { // if the layout file has not been given errorMsg="scan layout without providing the scan layouts file"; return false; diff --git a/Common/Servers/Scheduler/src/ScheduleChecker.cpp b/Common/Servers/Scheduler/src/ScheduleChecker.cpp index 928c03e6fcdb5f42ce4f142a2da91f63d370d135..5232866e4bb169fa8e129114b35097c0459bf3a7 100644 --- a/Common/Servers/Scheduler/src/ScheduleChecker.cpp +++ b/Common/Servers/Scheduler/src/ScheduleChecker.cpp @@ -3,6 +3,7 @@ #include "Schedule.h" #include #include +#include using namespace IRA; @@ -80,6 +81,13 @@ int main(int argc, char *argv[]) exit(-1); } if (sched.isComplete()) { + if(getpwuid(getuid())->pw_name != sched.getProjectName()) + { + CString err; + err.Format("Error found: Schedule PROJECT keyword does not match with active project!\n"); + printMessage((const char*)err); + exit(-1); + } CString msg; msg.Format("%u subscans were successfully parsed!\n",sched.getSubScansNumber()); printMessage((const char *)msg); diff --git a/Common/Servers/Scheduler/src/Schedule_ScanList.cpp b/Common/Servers/Scheduler/src/Schedule_ScanList.cpp index c03b2c1b091a2bf7487da6f9535d56fff80cd077..7f538e62ce60cd703734352cbfd16b5ef864a538 100644 --- a/Common/Servers/Scheduler/src/Schedule_ScanList.cpp +++ b/Common/Servers/Scheduler/src/Schedule_ScanList.cpp @@ -144,12 +144,12 @@ bool CScanList::parseLine(const IRA::CString& line,const DWORD& lnNumber,IRA::CS IRA::CString ret; Management::TScanTypes type; // get the second item..... - if (!IRA::CIRATools::getNextToken(line,start,SEPARATOR,ret)) { + if (!IRA::CIRATools::getNextToken(line,start,SEPARATORS,ret,false)) { errMsg="format error"; return false; } //...the scan type - if (!IRA::CIRATools::getNextToken(line,start,SEPARATOR,ret)) { + if (!IRA::CIRATools::getNextToken(line,start,SEPARATORS,ret,false)) { errMsg="could not read scan type"; return false; } @@ -592,7 +592,7 @@ bool CScanList::parseSidereal2(const IRA::CString& val,DWORD& id,IRA::CString& e Antenna::TSystemEquinox scanEquinox; // get the second item..... - if (!IRA::CIRATools::getNextToken(val,start,SEPARATOR,token)) { // id + if (!IRA::CIRATools::getNextToken(val,start,SEPARATORS,token,false)) { // id errMsg="cannot read scan identifier"; return false; } @@ -601,12 +601,12 @@ bool CScanList::parseSidereal2(const IRA::CString& val,DWORD& id,IRA::CString& e errMsg="scan identifier cannot be zero"; return false; } - if (!IRA::CIRATools::getNextToken(val,start,SEPARATOR,token)) { // type + if (!IRA::CIRATools::getNextToken(val,start,SEPARATORS,token,false)) { // type errMsg="cannot read scan type"; return false; } //scan->type=Antenna::ANT_SIDEREAL; //already know it is a sidereal - if (!IRA::CIRATools::getNextToken(val,start,SEPARATOR,token)) { // name + if (!IRA::CIRATools::getNextToken(val,start,SEPARATORS,token,false)) { // name errMsg="cannot read source name"; return false; } @@ -626,7 +626,7 @@ bool CScanList::parseSidereal2(const IRA::CString& val,DWORD& id,IRA::CString& e //scan->VradDefinition=Antenna::ANT_UNDEF_DEF; //scan->RadialVelocity=0.0; frame=Antenna::ANT_EQUATORIAL; - while (IRA::CIRATools::getNextToken(val,start,SEPARATOR,token)) { //get the next token...it represents the frame in which the coordinates are expressed + while (IRA::CIRATools::getNextToken(val,start,SEPARATORS,token,false)) { //get the next token...it represents the frame in which the coordinates are expressed bool ok=IRA::CIRATools::strToCoordinateFrame(token,frame); if ((frame==Antenna::ANT_EQUATORIAL) && (ok)) { if (frameOpen || offFrameOpen) { @@ -899,7 +899,7 @@ bool CScanList::parseSidereal2(const IRA::CString& val,DWORD& id,IRA::CString& e IRA::CString token; Antenna::TCoordinateFrame frame; // get the second item..... - if (!IRA::CIRATools::getNextToken(val,start,SEPARATOR,token)) { // id + if (!IRA::CIRATools::getNextToken(val,start,SEPARATORS,token,false)) { // id errMsg="cannot read scan identifier"; return false; } @@ -908,12 +908,12 @@ bool CScanList::parseSidereal2(const IRA::CString& val,DWORD& id,IRA::CString& e errMsg="scan identifier cannot be zero"; return false; } - if (!IRA::CIRATools::getNextToken(val,start,SEPARATOR,token)) { // type + if (!IRA::CIRATools::getNextToken(val,start,SEPARATORS,token,false)) { // type errMsg="cannot read scan type"; return false; } scan->type=Antenna::ANT_SIDEREAL; //already know it is a sidereal - if (!IRA::CIRATools::getNextToken(val,start,SEPARATOR,token)) { // name + if (!IRA::CIRATools::getNextToken(val,start,SEPARATORS,token,false)) { // name errMsg="cannot read source name"; return false; } @@ -932,7 +932,7 @@ bool CScanList::parseSidereal2(const IRA::CString& val,DWORD& id,IRA::CString& e scan->VradDefinition=Antenna::ANT_UNDEF_DEF; scan->RadialVelocity=0.0; frame=Antenna::ANT_EQUATORIAL; - while (IRA::CIRATools::getNextToken(val,start,SEPARATOR,token)) { //get the next token...it represents the frame in which the coordinates are expressed + while (IRA::CIRATools::getNextToken(val,start,SEPARATORS,token,false)) { //get the next token...it represents the frame in which the coordinates are expressed bool ok=IRA::CIRATools::strToCoordinateFrame(token,frame); if ((frame==Antenna::ANT_EQUATORIAL) && (ok)) { if (frameOpen || offFrameOpen) { @@ -1186,14 +1186,14 @@ bool CScanList::parseOffsetSwitch(const IRA::CString& val,int& start, IRA::CString lontoken,lattoken,token; errMsg=""; res=false; - while (IRA::CIRATools::getNextToken(val,start,SEPARATOR,token)) { + while (IRA::CIRATools::getNextToken(val,start,SEPARATORS,token,false)) { if (strcmp(token,OFFFRAMEEQ)==0) { offsetFrame=Antenna::ANT_EQUATORIAL; - if (!IRA::CIRATools::getNextToken(val,start,SEPARATOR,lontoken)) { + if (!IRA::CIRATools::getNextToken(val,start,SEPARATORS,lontoken,false)) { errMsg="not enough parameters for equatorial offset switch"; return false; } - if (!IRA::CIRATools::getNextToken(val,start,SEPARATOR,lattoken)) { + if (!IRA::CIRATools::getNextToken(val,start,SEPARATORS,lattoken,false)) { errMsg="not enough parameters for equatorial offset switch"; return false; } @@ -1210,11 +1210,11 @@ bool CScanList::parseOffsetSwitch(const IRA::CString& val,int& start, } else if (strcmp(token,OFFFRAMEHOR)==0) { offsetFrame=Antenna::ANT_HORIZONTAL; - if (!IRA::CIRATools::getNextToken(val,start,SEPARATOR,lontoken)) { + if (!IRA::CIRATools::getNextToken(val,start,SEPARATORS,lontoken,false)) { errMsg="not enough parameters for horizontal offset switch"; return false; } - if (!IRA::CIRATools::getNextToken(val,start,SEPARATOR,lattoken)) { + if (!IRA::CIRATools::getNextToken(val,start,SEPARATORS,lattoken,false)) { errMsg="not enough parameters for horizontal offset switch"; return false; } @@ -1231,11 +1231,11 @@ bool CScanList::parseOffsetSwitch(const IRA::CString& val,int& start, } else if (strcmp(token,OFFFRAMEGAL)==0) { offsetFrame=Antenna::ANT_GALACTIC; - if (!IRA::CIRATools::getNextToken(val,start,SEPARATOR,lontoken)) { + if (!IRA::CIRATools::getNextToken(val,start,SEPARATORS,lontoken,false)) { errMsg="not enough parameters for galactic offset switch"; return false; } - if (!IRA::CIRATools::getNextToken(val,start,SEPARATOR,lattoken)) { + if (!IRA::CIRATools::getNextToken(val,start,SEPARATORS,lattoken,false)) { errMsg="not enough parameters for galactic offset switch"; return false; } @@ -1260,7 +1260,7 @@ bool CScanList::parseVRADSwitch(const IRA::CString& val,int& start,double& vrad, IRA::CString token; errMsg=""; result=false; - while (IRA::CIRATools::getNextToken(val,start,SEPARATOR,token)) { + while (IRA::CIRATools::getNextToken(val,start,SEPARATORS,token,false)) { if (strcmp(token,RVEL)==0) { if (parseVRADSwitch(val,start,vrad,frame,ref,errMsg)) { result=true; @@ -1277,14 +1277,14 @@ bool CScanList::parseVRADSwitch(const IRA::CString& val,int& start,double& vrad, bool CScanList::parseVRADSwitch(const IRA::CString& val,int& start,double& vrad,Antenna::TReferenceFrame& frame,Antenna::TVradDefinition& ref,IRA::CString& errMsg) { IRA::CString token; - if (IRA::CIRATools::getNextToken(val,start,SEPARATOR,token)) { + if (IRA::CIRATools::getNextToken(val,start,SEPARATORS,token,false)) { vrad=token.ToDouble(); } else { errMsg="not enough parameters for the radial velocity switch"; return false; } - if (IRA::CIRATools::getNextToken(val,start,SEPARATOR,token)) { + if (IRA::CIRATools::getNextToken(val,start,SEPARATORS,token,false)) { if (!Antenna::Definitions::map(token,frame)) { errMsg="the reference frame of the radial velocity is incorrect"; return false; @@ -1294,7 +1294,7 @@ bool CScanList::parseVRADSwitch(const IRA::CString& val,int& start,double& vrad, errMsg="not enough parameters for the radial velocity switch"; return false; } - if (IRA::CIRATools::getNextToken(val,start,SEPARATOR,token)) { + if (IRA::CIRATools::getNextToken(val,start,SEPARATORS,token,false)) { if (!Antenna::Definitions::map(token,ref)) { errMsg="the radial velocity definition is incorrect"; return false; diff --git a/Common/Servers/Scheduler/src/testSchedule.cpp b/Common/Servers/Scheduler/src/testSchedule.cpp index e678e416e017ed32de6e5e3cd07ab318092f8c49..99cda2ee84fab1527d6b755c6713cb7f4f60d5d5 100644 --- a/Common/Servers/Scheduler/src/testSchedule.cpp +++ b/Common/Servers/Scheduler/src/testSchedule.cpp @@ -35,7 +35,7 @@ IRA::CString toDescription(const Antenna::TsubScanDescription& des) IRA::CString toType(const Management::TScanTypes& tp) { - if (tp==Management::MNG_SIDEREAL) return IRA::CString("SIDEREAL"); + if (tp==Management::MNG_SIDEREAL) return IRA::CString("SIDEREAL"); else if (tp==Management::MNG_SUN) return IRA::CString("SUN"); else if (tp==Management::MNG_MOON) return IRA::CString("MOON"); else if (tp==Management::MNG_SATELLITE) return IRA::CString("SATELLITE"); @@ -66,7 +66,10 @@ int main(int argc, char *argv[]) Management::TSubScanConfiguration *subScanConf; CSchedule::TRecord rec; ACS::stringSeq layoutDef; - CSchedule sched("../templates/","schedule.tmpl"); + std::string schedfile = "schedule.tmpl"; + if(argc > 1) + schedfile = std::string(argv[1]); + CSchedule sched("../templates/",schedfile.c_str()); //CSchedule sched("/archive/schedules/maintenance/","mbfitstest-CrossEQEQ.scd"); //CSchedule sched("/archive/schedules/","calibrationSeq.scd"); diff --git a/Common/Servers/Scheduler/src/testSchedules.cpp b/Common/Servers/Scheduler/src/testSchedules.cpp new file mode 100644 index 0000000000000000000000000000000000000000..62e88a391049e273a4cd7b0e8b4c756a938a436c --- /dev/null +++ b/Common/Servers/Scheduler/src/testSchedules.cpp @@ -0,0 +1,38 @@ +#include +#include +#include +#include +#include +#include + +std::string exec(const std::string command) +{ + std::array buffer; + std::string result; + + std::unique_ptr pipe(popen(command.c_str(), "r"), pclose); + if(!pipe) + { + throw std::runtime_error("popen() failed!"); + } + while(fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr) + { + result += buffer.data(); + } + return result; +} + +int main() +{ + std::string binpath = boost::filesystem::canonical("/proc/self/exe").parent_path().string(); + + std::string output_tab = exec(binpath + "/testSched"); + std::string output_spaces = exec(binpath + "/testSched schedule_ws.tmpl"); + if(output_tab != output_spaces) + { + std::cout << "testSched and testSchedSpaces have different outputs, FAILURE!" << std::endl; + return -1; + } + std::cout << "testSched and testSchedSpaces have the same output, OK!" << std::endl; + return 0; +} diff --git a/Common/Servers/Scheduler/templates/schedule.tmpl b/Common/Servers/Scheduler/templates/schedule.tmpl index 9bb098c800e21c8f8ddab7e293aade4fa5cf6706..5ab342f9615b357c6cd0f54aa4018a6f691bf6b3 100644 --- a/Common/Servers/Scheduler/templates/schedule.tmpl +++ b/Common/Servers/Scheduler/templates/schedule.tmpl @@ -39,7 +39,7 @@ SCANTAG: 1024 INITPROC: INITALL #This is an optional field which allows to control which targets are observed or not based on elevation limits. The two values are degrees and are the lower and the upper limit #respectively. If the keyword is not provided the default values will be kept by the system -ELEVATIONLIMITS 15.0 80.0 +ELEVATIONLIMITS: 15.0 80.0 #The schedule itself, the fields are tab separated diff --git a/Common/Servers/Scheduler/templates/schedule_ws.tmpl b/Common/Servers/Scheduler/templates/schedule_ws.tmpl new file mode 100644 index 0000000000000000000000000000000000000000..bf4a836738315138fd531ee9197b6785bf130c9a --- /dev/null +++ b/Common/Servers/Scheduler/templates/schedule_ws.tmpl @@ -0,0 +1,88 @@ +# A project string,it can be any combination of characters but spaces and blanks, it is not the project code which is used to compose the output +# file name but it can be used to distinguish between various activities during the project, for example A1245-Map and A1245-Calib. It is used +# to add a keyword in the file +PROJECT: skySurvey +# the name of the observer, can be any combination of characters but blanks +OBSERVER: AndreaOrlati +#the file that contains the parameters that defines the scans from the telescope positioning point of view. For +#example sidereal tracking or On the fly scan, and so on...... Every scan is enumerated +SCANLIST: scan.tmpl +#the file that contains the telescopes setups procedures (receiver, local oscillator, ....) that can be used during +#the observation. +PROCEDURELIST: config.tmpl +#file that contains the backend configurations that are required during the observation. This section is not +#mandatory provided that a NULL in the backend field of the schedule is given +BACKENDLIST: backend.tmpl +#file that contains extra information that define the scan to be passed to the the data recorder. This field is not mandatory. +SCANLAYOUT: layoutfile.tmpl +#This defines the schedule mode. +#In this example we have the LST based schedule. That means the various scans are +#performed based on LST mark. The telescope will be driven on the next scan that can be reached on time. If the target is not reachable the scan is skipped. +#The recording will start at exactly at the time mark given for the scan. The stop recording command will be issued at the time which is the result of scheduled start time plus +#the scheduled duration. +#The second parameter is the number of repetitions, it means the times the schedule is repeated. A -1 means +#repeat continuously. A zero or null is not allowed. +MODE: LST 1 +#in this mode the single scans are performed sequentially in the order they appear in the schedule. In that +#mode no timestamps are required. The target is checked top be above the horizon, if the test is failed the scan is skipped. The start to the acquisition is given when +#the telescope is on target. The stop time will be at effective start time plus the scheduled duration. In that mode the schedule is continuously run. +#The second argument, which is optional gives the start LST for the schedule. +#MODE: SEQ +#MODE: SEQ 21:15:36.00 +#this field is used to enumerate the scans of the schedule. The first scan will be marked with the number reported here. +# The identifier will be incremented every scan....and stored into the output file. If negative, or not given (this field is not mandatory) the +# enumeration capability is turned off. +SCANTAG: 1024 +#This procedure will be executed once at the start of the schedule. It could be NULL, in that case nothing is done. If not present it is considered to be +# NULL. The procedure must be defined in the PROCEDURELIST file. It is always executed in blocking mode, the schedule is started only when the procedure +# has been done. +INITPROC: INITALL +#This is an optional field which allows to control which targets are observed or not based on elevation limits. The two values are degrees and are the lower and the upper limit +#respectively. If the keyword is not provided the default values will be kept by the system +ELEVATIONLIMITS: 15.0 80.0 + + +#The schedule itself, the fields are tab separated +#the keyword SCAN identifies the beginning of a scan, a scan includes all the subscan enlisted before the next SCAN keyword or the end of the schedule. +#SCAN scan_id suffix backend:writer [layout] +#scan_id is progressive number (zero is not allowed) (must be unique in the schedule) that identifies the current scan. +#suffix this is the suffix of the output file. The final name of the file will be composed by the date and time of observation then the local sidereal time +# (if the schedule is LST) then the project name and at the end the suffix. +#backend this field reports about the definition (in BACKENDLIST file) to be used in the current scan. After the colon the scheduler +# expects to find the instance of the data receiver to be used. The provided name could be composed by any litteral or numerical character. +# There is reserved string that has special meanings. "NULL" means that the scan must be done with no acquisition. +#writer name of the writer instance in charge to store the data. There is reserved string that has special meanings. +# "NULL" means that the data coming from the backend are not to be stored. +#layout this is the label of the current layout to be used for the current scan. If provided the scan layout file must be given and the corresponding layout must +# exists in the file +#The subscan definition match the following pattern: +#subscan_id [startLST] duration scan PreScan PostScan +#subscan_id is the identifier of the subscan. The format must be scanid_subscanid, where the scanid and subscanid are integers, the former must match the id of the above +# scan, the former can be any positive number (a part from zero) that cannot be repeated twice inside the same scan. +#startLST if the schedule is a LST schedule this field stores the local sidereal time to start the current subscan, the format is hh:mm:ss.sss. The antenna is moved +# in the correct position in advance and the data acquisition is started. No time repetitions are allowed and +# the various times must be incrementally ordered. 00:00:00 could come after 23:59:59. +#duration number of seconds that the scan is supposed to perform data recording. After that period the data recording is stopped. +#scan the scan number (inside the file given in SCANLIST section) +#PreScan A name of a procedure that must be executed before the scan starts. It may be NULL in that case nothing is done. +# If not reported in the procedure list file the schedule is considered correct; the system will try to match the procedure with one of the system commands at +# runtime. The procedure can also be given a list of arguments. +# The default behavior is that the scheduler will wait for the procedure to finish before doing anything else. If this is not the desired approach a '@' must +# be appended to the procedure name,in that case the scheduler won't wait for the procedure completion. +#PostScan A name of a procedure that must be executed at the end of the scan. It may be NULL in that case nothing is done. It has to be reported in the procedure list file. +# The async/sync execution mode is identical to the prescan procedure. + +SC: 1 dr21 STD:MANAGEMENT/MBFits EQMAPLAYOUT +1_1 10:12:04.000 60.0 1 STANDARDPRESCAN@ STANDARDPOSTSCAN +1_2 10:12:25.000 100.0 12 NULL NULL +1_10 10:14:04.000 60.0 1 STANDARDPRESCAN@ STANDARDPOSTSCAN +1_11 10:16:29.000 60.0 1 NULL ENDSCAN=10.66@ + +SC: 2 mySource HIGH:MANAGEMENT/MBFits +2_1 10:30:14.000 300.0 4 STANDARDPRESCAN NULL +2_2 10:45:16.000 6.0 9 NULL NULL + +#id duration scan PreScan PostScan backend Writer +SC: 3 dr21 LOW::MANAGEMENT/FitsZilla +3_1 11:30:10.000 60.0 1 STANDARDPRESCAN NULL +3_2 11:36:22.200 60.0 1 STANDARDPRESCAN NULL diff --git a/SRT/CDB/alma/DataBlock/MinorServo/Boss/Configurations/Configurations.xml b/SRT/CDB/alma/DataBlock/MinorServo/Boss/Configurations/Configurations.xml new file mode 100644 index 0000000000000000000000000000000000000000..5159bf12d7bab9574639f1ace0cfed60ea3c4556 --- /dev/null +++ b/SRT/CDB/alma/DataBlock/MinorServo/Boss/Configurations/Configurations.xml @@ -0,0 +1,27 @@ + + + + + + LLP Primario + PPP Primario + PLP Primario + HHP Primario + XKP Primario + CCG Gregoriano1 + KKG Gregoriano2 + WWG Gregoriano3 + QQG Gregoriano4 + CTR Gregoriano5 + MISTRAL Gregoriano6 + CCB BWG1 + XB BWG3 + + diff --git a/SRT/CDB/alma/DataBlock/MinorServo/GFR/Coefficients/Coefficients.xml b/SRT/CDB/alma/DataBlock/MinorServo/GFR/Coefficients/Coefficients.xml new file mode 100644 index 0000000000000000000000000000000000000000..d48dd3cd6e38e1d150000f4cefba902fd7c10b4e --- /dev/null +++ b/SRT/CDB/alma/DataBlock/MinorServo/GFR/Coefficients/Coefficients.xml @@ -0,0 +1,29 @@ + + + + + + + + CCG ROTATION

-88.70659

+ + KKG ROTATION

-159.8899

+ + WWG ROTATION

90.971610

+ + QQG ROTATION

162.771

+ + CTR ROTATION

55.373967

+ + MISTRAL ROTATION

-51.821170

+ + + +
diff --git a/SRT/CDB/alma/DataBlock/MinorServo/GFR/LookupTables/LookupTables.xml b/SRT/CDB/alma/DataBlock/MinorServo/GFR/LookupTables/LookupTables.xml deleted file mode 100644 index 9481f7890788a154112c0b50bd231433a4a1be92..0000000000000000000000000000000000000000 --- a/SRT/CDB/alma/DataBlock/MinorServo/GFR/LookupTables/LookupTables.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - ROTATION -88.70659 - ROTATION -88.70659 - ROTATION -159.8899 - ROTATION -159.8899 - ROTATION 90.971610 - ROTATION 90.971610 - ROTATION 162.771 - ROTATION 162.771 - ROTATION 55.373967 - ROTATION 55.373967 - ROTATION -51.821170 - ROTATION -51.821170 - - - - - - - - diff --git a/SRT/CDB/alma/DataBlock/MinorServo/M3R/Coefficients/Coefficients.xml b/SRT/CDB/alma/DataBlock/MinorServo/M3R/Coefficients/Coefficients.xml new file mode 100644 index 0000000000000000000000000000000000000000..296a8bdb4fd4aa6eafdda595a452e432b2feb0e5 --- /dev/null +++ b/SRT/CDB/alma/DataBlock/MinorServo/M3R/Coefficients/Coefficients.xml @@ -0,0 +1,19 @@ + + + + + + + + CCBROTATION

44.95999544939037931

+ + XB ROTATION

135.003886290282340384

+ +
diff --git a/SRT/CDB/alma/DataBlock/MinorServo/M3R/LookupTables/LookupTables.xml b/SRT/CDB/alma/DataBlock/MinorServo/M3R/LookupTables/LookupTables.xml deleted file mode 100644 index cfc134bab0b4b1337494a3c065e16c4d6b63f8ae..0000000000000000000000000000000000000000 --- a/SRT/CDB/alma/DataBlock/MinorServo/M3R/LookupTables/LookupTables.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - ROTATION 44.95999544939037931 - ROTATION 44.95999544939037931 - ROTATION 135.003886290282340384 - ROTATION 135.003886290282340384 - - diff --git a/SRT/CDB/alma/DataBlock/MinorServo/PFP/Coefficients/Coefficients.xml b/SRT/CDB/alma/DataBlock/MinorServo/PFP/Coefficients/Coefficients.xml new file mode 100644 index 0000000000000000000000000000000000000000..b553b2235d73efb25dadc42a0adf2536ee7ea531 --- /dev/null +++ b/SRT/CDB/alma/DataBlock/MinorServo/PFP/Coefficients/Coefficients.xml @@ -0,0 +1,35 @@ + + + + + + + + LLPTX

0

+ LLPTZ

0

+ LLPRTHETA

0

+ + PPPTX

0

+ PPPTZ

0

+ PPPRTHETA

0

+ + PLPTX

0

+ PLPTZ

0

+ PLPRTHETA

0

+ + HHPTX

0

+ HHPTZ

0

+ HHPRTHETA

0

+ + XKPTX

0

+ XKPTZ

0

+ XKPRTHETA

0

+ +
diff --git a/SRT/CDB/alma/DataBlock/MinorServo/PFP/LookupTables/LookupTables.xml b/SRT/CDB/alma/DataBlock/MinorServo/PFP/LookupTables/LookupTables.xml deleted file mode 100644 index 086b3785bfad3d4cf429fc8d5b6703514c07c6f6..0000000000000000000000000000000000000000 --- a/SRT/CDB/alma/DataBlock/MinorServo/PFP/LookupTables/LookupTables.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - TX 0 - TZ 0 - RTHETA 0 - - TX 0 - TZ 0 - RTHETA 0 - - TX 0 - TZ 0 - RTHETA 0 - - TX 0 - TZ 0 - RTHETA 0 - - TX 0 - TZ 0 - RTHETA 0 - - diff --git a/SRT/CDB/alma/DataBlock/MinorServo/SRP/Coefficients/Coefficients.xml b/SRT/CDB/alma/DataBlock/MinorServo/SRP/Coefficients/Coefficients.xml new file mode 100644 index 0000000000000000000000000000000000000000..23ce8bfe37a250a8e223b8e0adfb0e1fa397d7af --- /dev/null +++ b/SRT/CDB/alma/DataBlock/MinorServo/SRP/Coefficients/Coefficients.xml @@ -0,0 +1,99 @@ + + + + + + + + CCG TX

-1.5

+ CCG TY

29.556666666666498, 0.263472663139432, -0.018206701940039, 0.000072373113855

+ CCG TZ

-15.6669651675, 1.9293068324, -0.0628990613, 0.0007771141, -0.0000032940

+ CCG RX

-0.0055555555555569409, 0.00014822163433269445, 0.000027586713698, -0.000000077732053

+ CCG RY

-0.036111111111111108

+ CCG RZ

0

+ + CCG_AS_OFFTX

-1.5

+ CCG_AS_OFFTY

28.256852219272844, -0.002707044952, -0.009870218853, 0.000031617958

+ CCG_AS_OFFTZ

9.530113849340003, -0.169826241752, 0.000419997047, 0.000003985237

+ CCG_AS_OFFRX

-0.011392527142374848, -0.0001426193499425, 0.000039508844799, -0.000000131010010

+ CCG_AS_OFFRY

-0.03611111111111111

+ CCG_AS_OFFRZ

0

+ + KKG TX

-1.5

+ KKG TY

29.556666666666498, 0.263472663139432, -0.018206701940039, 0.000072373113855

+ KKG TZ

-15.6669651675, 1.9293068324, -0.0628990613, 0.0007771141, -0.0000032940

+ KKG RX

-0.0055555555555569409, 0.00014822163433269445, 0.000027586713698, -0.000000077732053

+ KKG RY

-0.036111111111111108

+ KKG RZ

0

+ + KKG_AS_OFFTX

-1.5

+ KKG_AS_OFFTY

28.256852219272844, -0.002707044952, -0.009870218853, 0.000031617958

+ KKG_AS_OFFTZ

9.530113849340003, -0.169826241752, 0.000419997047, 0.000003985237

+ KKG_AS_OFFRX

-0.011392527142374848, -0.0001426193499425, 0.000039508844799, -0.000000131010010

+ KKG_AS_OFFRY

-0.03611111111111111

+ KKG_AS_OFFRZ

0

+ + WWG TX

0

+ WWG TY

0

+ WWG TZ

0

+ WWG RX

0

+ WWG RY

0

+ WWG RZ

0

+ + QQG TX

0

+ QQG TY

0

+ QQG TZ

0

+ QQG RX

0

+ QQG RY

0

+ QQG RZ

0

+ + CTR TX

0

+ CTR TY

0

+ CTR TZ

0

+ CTR RX

0

+ CTR RY

0

+ CTR RZ

0

+ + MISTRAL TX

-1.5

+ MISTRAL TY

29.556666666666498, 0.263472663139432, -0.018206701940039, 0.000072373113855

+ MISTRAL TZ

-15.6669651675, 1.9293068324, -0.0628990613, 0.0007771141, -0.0000032940

+ MISTRAL RX

-0.0055555555555569409, 0.00014822163433269445, 0.000027586713698, -0.000000077732053

+ MISTRAL RY

-0.036111111111111108

+ MISTRAL RZ

0

+ + CCB TX

-1.5

+ CCB TY

29.556666666666498, 0.263472663139432, -0.018206701940039, 0.000072373113855

+ CCB TZ

91.5590595452, -16.4202062811, 1.16941963489, -0.040640240455, 0.000733782714288, -6.62393455442e-06, 2.36410838911e-08

+ CCB RX

-0.0055555555555569409, 0.00014822163433269445, 0.000027586713698, -0.000000077732053

+ CCB RY

-0.036111111111111108

+ CCB RZ

0

+ + CCB_AS_OFFTX

-1.5

+ CCB_AS_OFFTY

28.256852219272844,-0.002707044952,-0.009870218853,0.000031617958

+ CCB_AS_OFFTZ

9.530113849340003,-0.169826241752,0.000419997047,0.000003985237

+ CCB_AS_OFFRX

-0.011392527142374848,-0.0001426193499425,0.000039508844799,-0.000000131010010

+ CCB_AS_OFFRY

-0.03611111111111111

+ CCB_AS_OFFRZ

0

+ + XB TX

-1.5

+ XB TY

29.556666666666498, 0.263472663139432, -0.018206701940039, 0.000072373113855

+ XB TZ

-38.3143893309, 4.30888128547, -0.18265795755, 0.00350049382452, -3.17057523513e-05, 1.11006707448e-07

+ XB RX

-0.0055555555555569409, 0.00014822163433269445, 0.000027586713698, -0.000000077732053

+ XB RY

-0.036111111111111108

+ XB RZ

0

+ + XB_AS_OFF TX

-1.5

+ XB_AS_OFF TY

28.256852219272844,-0.002707044952,-0.009870218853,0.000031617958

+ XB_AS_OFF TZ

7.92754535681,-1.73279985542,0.147346047014,-0.00516934108597,7.69094654954e-05,-4.0697957632e-07

+ XB_AS_OFF RX

-0.011392527142374848,-0.0001426193499425,0.000039508844799,-0.000000131010010

+ XB_AS_OFF RY

-0.03611111111111111

+ XB_AS_OFF RZ

0

+ +
diff --git a/SRT/CDB/alma/DataBlock/MinorServo/SRP/LookupTables/LookupTables.xml b/SRT/CDB/alma/DataBlock/MinorServo/SRP/LookupTables/LookupTables.xml deleted file mode 100644 index 0cabed4bb1d96c2b14934d348734095c81fcd5e3..0000000000000000000000000000000000000000 --- a/SRT/CDB/alma/DataBlock/MinorServo/SRP/LookupTables/LookupTables.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - TX-1.5 - TY28.256852219272844,-0.002707044952,-0.009870218853,0.000031617958 - TZ9.530113849340003,-0.169826241752,0.000419997047,0.000003985237 - RX-0.011392527142374848,-0.0001426193499425,0.000039508844799,-0.000000131010010 - RY-0.03611111111111111 - RZ0 - - TX-1.5 - TY29.556666666666498,0.263472663139432,-0.018206701940039,0.000072373113855 - TZ-15.6669651675,1.9293068324,-0.0628990613,0.0007771141,-0.0000032940 - RX-0.0055555555555569409, 0.00014822163433269445, 0.000027586713698, -0.000000077732053 - RY-0.036111111111111108 - RZ0 - - TX-1.5 - TY28.256852219272844,-0.002707044952,-0.009870218853,0.000031617958 - TZ9.530113849340003,-0.169826241752,0.000419997047,0.000003985237 - RX-0.011392527142374848,-0.0001426193499425,0.000039508844799,-0.000000131010010 - RY-0.03611111111111111 - RZ0 - - TX-1.5 - TY29.556666666666498,0.263472663139432,-0.018206701940039,0.000072373113855 - TZ-15.6669651675,1.9293068324,-0.0628990613,0.0007771141,-0.0000032940 - RX-0.0055555555555569409, 0.00014822163433269445, 0.000027586713698, -0.000000077732053 - RY-0.036111111111111108 - RZ0 - - TX0 - TY0 - TZ0 - RX0 - RY0 - RZ0 - - TX0 - TY0 - TZ0 - RX0 - RY0 - RZ0 - - TX0 - TY0 - TZ0 - RX0 - RY0 - RZ0 - - TX0 - TY0 - TZ0 - RX0 - RY0 - RZ0 - - TX0 - TY0 - TZ0 - RX0 - RY0 - RZ0 - - TX0 - TY0 - TZ0 - RX0 - RY0 - RZ0 - - TX-1.5 - TY28.256852219272844,-0.002707044952,-0.009870218853,0.000031617958 - TZ9.530113849340003,-0.169826241752,0.000419997047,0.000003985237 - RX-0.011392527142374848,-0.0001426193499425,0.000039508844799,-0.000000131010010 - RY-0.03611111111111111 - RZ0 - - TX-1.5 - TY29.556666666666498,0.263472663139432,-0.018206701940039,0.000072373113855 - TZ-15.6669651675,1.9293068324,-0.0628990613,0.0007771141,-0.0000032940 - RX-0.0055555555555569409, 0.00014822163433269445, 0.000027586713698, -0.000000077732053 - RY-0.036111111111111108 - RZ0 - - TX-1.5 - TY28.256852219272844,-0.002707044952,-0.009870218853,0.000031617958 - TZ9.530113849340003,-0.169826241752,0.000419997047,0.000003985237 - RX-0.011392527142374848,-0.0001426193499425,0.000039508844799,-0.000000131010010 - RY-0.03611111111111111 - RZ0 - - TX-1.5 - TY29.556666666666498,0.263472663139432,-0.018206701940039,0.000072373113855 - TZ91.5590595452,-16.4202062811,1.16941963489,-0.040640240455,0.000733782714288,-6.62393455442e-06,2.36410838911e-08 - RX-0.0055555555555569409,0.00014822163433269445,0.000027586713698,-0.000000077732053 - RY-0.036111111111111108 - RZ0 - - TX-1.5 - TY28.256852219272844,-0.002707044952,-0.009870218853,0.000031617958 - TZ7.92754535681,-1.73279985542,0.147346047014,-0.00516934108597,7.69094654954e-05,-4.0697957632e-07 - RX-0.011392527142374848,-0.0001426193499425,0.000039508844799,-0.000000131010010 - RY-0.03611111111111111 - RZ0 - - TX-1.5 - TY29.556666666666498,0.263472663139432,-0.018206701940039,0.000072373113855 - TZ-38.3143893309,4.30888128547,-0.18265795755,0.00350049382452,-3.17057523513e-05,1.11006707448e-07 - RX-0.0055555555555569409,0.00014822163433269445,0.000027586713698,-0.000000077732053 - RY-0.036111111111111108 - RZ0 - - diff --git a/SRT/Configuration/CDB/alma/DataBlock/MinorServo/Boss/Configurations/Configurations.xml b/SRT/Configuration/CDB/alma/DataBlock/MinorServo/Boss/Configurations/Configurations.xml new file mode 100644 index 0000000000000000000000000000000000000000..20b7e32c3d6d535dd1fa7d94ddc32133280425cd --- /dev/null +++ b/SRT/Configuration/CDB/alma/DataBlock/MinorServo/Boss/Configurations/Configurations.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + CCG Gregoriano1 + KKG Gregoriano2 + WWG Gregoriano3 + QQG Gregoriano4 + CTR Gregoriano5 + MISTRAL Gregoriano6 + MISTRAL_OLD Gregoriano6 + CABINET Gregoriano7 + CCB BWG1 + XB BWG3 + + diff --git a/SRT/Configuration/CDB/alma/DataBlock/MinorServo/GFR/Coefficients/Coefficients.xml b/SRT/Configuration/CDB/alma/DataBlock/MinorServo/GFR/Coefficients/Coefficients.xml new file mode 100644 index 0000000000000000000000000000000000000000..53a0d26f02bfa56aecfc554ea20f9a0cc44616db --- /dev/null +++ b/SRT/Configuration/CDB/alma/DataBlock/MinorServo/GFR/Coefficients/Coefficients.xml @@ -0,0 +1,32 @@ + + + + + + + + CCG ROTATION

-88.70659

+ + KKG ROTATION

-159.8899

+ + WWG ROTATION

90.971610

+ + QQG ROTATION

162.771

+ + CTR ROTATION

55.373967

+ + MISTRAL ROTATION

-51.821170

+ MISTRAL_OLD ROTATION

-51.821170

+ + CABINET ROTATION

40

+ + + +
diff --git a/SRT/Configuration/CDB/alma/DataBlock/MinorServo/GFR/LookupTables/LookupTables.xml b/SRT/Configuration/CDB/alma/DataBlock/MinorServo/GFR/LookupTables/LookupTables.xml deleted file mode 100644 index 55854cfe23392bbc6c96afb05fc1172077b49e04..0000000000000000000000000000000000000000 --- a/SRT/Configuration/CDB/alma/DataBlock/MinorServo/GFR/LookupTables/LookupTables.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - ROTATION -88.70659 - ROTATION -88.70659 - ROTATION -159.8899 - ROTATION -159.8899 - ROTATION -159.8899 - ROTATION 90.971610 - ROTATION 90.971610 - ROTATION 162.771 - ROTATION 162.771 - ROTATION 55.373967 - ROTATION 55.373967 - ROTATION -51.821170 - ROTATION -51.821170 - ROTATION -51.821170 - ROTATION -51.821170 - - ROTATION 40 - - - - - - - - diff --git a/SRT/Configuration/CDB/alma/DataBlock/MinorServo/M3R/Coefficients/Coefficients.xml b/SRT/Configuration/CDB/alma/DataBlock/MinorServo/M3R/Coefficients/Coefficients.xml new file mode 100644 index 0000000000000000000000000000000000000000..296a8bdb4fd4aa6eafdda595a452e432b2feb0e5 --- /dev/null +++ b/SRT/Configuration/CDB/alma/DataBlock/MinorServo/M3R/Coefficients/Coefficients.xml @@ -0,0 +1,19 @@ + + + + + + + + CCBROTATION

44.95999544939037931

+ + XB ROTATION

135.003886290282340384

+ +
diff --git a/SRT/Configuration/CDB/alma/DataBlock/MinorServo/M3R/LookupTables/LookupTables.xml b/SRT/Configuration/CDB/alma/DataBlock/MinorServo/M3R/LookupTables/LookupTables.xml deleted file mode 100644 index 2c09bec47bc4527da06d71157a2423d8f7697cd9..0000000000000000000000000000000000000000 --- a/SRT/Configuration/CDB/alma/DataBlock/MinorServo/M3R/LookupTables/LookupTables.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - ROTATION -44.95999544939037931 - ROTATION -44.95999544939037931 - ROTATION -135.003886290282340384 - ROTATION -135.003886290282340384 - - diff --git a/SRT/Configuration/CDB/alma/DataBlock/MinorServo/SRP/Coefficients/Coefficients.xml b/SRT/Configuration/CDB/alma/DataBlock/MinorServo/SRP/Coefficients/Coefficients.xml new file mode 100644 index 0000000000000000000000000000000000000000..144c45283f5582f9176cdd5c07b6d173b4788148 --- /dev/null +++ b/SRT/Configuration/CDB/alma/DataBlock/MinorServo/SRP/Coefficients/Coefficients.xml @@ -0,0 +1,106 @@ + + + + + + + + CCG TX

-1.5

+ CCG TY

29.556666666666498, 0.263472663139432, -0.018206701940039, 0.000072373113855

+ CCG TZ

-15.6669651675, 1.9293068324, -0.0628990613, 0.0007771141, -0.0000032940

+ CCG RX

-0.0055555555555569409, 0.00014822163433269445, 0.000027586713698, -0.000000077732053

+ CCG RY

-0.036111111111111108

+ CCG RZ

0

+ + CCG_AS_OFF TX

-1.5

+ CCG_AS_OFF TY

28.256852219272844, -0.002707044952, -0.009870218853, 0.000031617958

+ CCG_AS_OFF TZ

9.530113849340003, -0.169826241752, 0.000419997047, 0.000003985237

+ CCG_AS_OFF RX

-0.011392527142374848, -0.0001426193499425, 0.000039508844799, -0.000000131010010

+ CCG_AS_OFF RY

-0.03611111111111111

+ CCG_AS_OFF RZ

0

+ + KKG TX

-1.5

+ KKG TY

29.556666666666498, 0.263472663139432, -0.018206701940039, 0.000072373113855

+ KKG TZ

-15.6669651675, 1.9293068324, -0.0628990613, 0.0007771141, -0.0000032940

+ KKG RX

-0.0055555555555569409, 0.00014822163433269445, 0.000027586713698, -0.000000077732053

+ KKG RY

-0.036111111111111108

+ KKG RZ

0

+ + KKG_AS_OFF TX

-1.5

+ KKG_AS_OFF TY

28.256852219272844, -0.002707044952, -0.009870218853, 0.000031617958

+ KKG_AS_OFF TZ

9.530113849340003, -0.169826241752, 0.000419997047, 0.000003985237

+ KKG_AS_OFF RX

-0.011392527142374848, -0.0001426193499425, 0.000039508844799, -0.000000131010010

+ KKG_AS_OFF RY

-0.03611111111111111

+ KKG_AS_OFF RZ

0

+ + WWG TX

0

+ WWG TY

0

+ WWG TZ

0

+ WWG RX

0

+ WWG RY

0

+ WWG RZ

0

+ + QQG TX

0

+ QQG TY

0

+ QQG TZ

0

+ QQG RX

0

+ QQG RY

0

+ QQG RZ

0

+ + CTR TX

0

+ CTR TY

0

+ CTR TZ

0

+ CTR RX

0

+ CTR RY

0

+ CTR RZ

0

+ + MISTRAL TX

-1.5

+ MISTRAL TY

-90.4571677, 2.06486636, -0.066594993, 0.00679193157, -0.000204050966, 0.00000233354544, -0.00000000926776063

+ MISTRAL TZ

185.005164, -11.1663042, 0.212522011, -0.00131754377

+ MISTRAL RX

-0.0055555555555569409, 0.00014822163433269445, 0.000027586713698, -0.000000077732053

+ MISTRAL RY

-0.036111111111111108

+ MISTRAL RZ

0

+ + MISTRAL_OLDTX

-1.5

+ MISTRAL_OLDTY

29.556666666666498, 0.263472663139432, -0.018206701940039, 0.000072373113855

+ MISTRAL_OLDTZ

-15.6669651675, 1.9293068324, -0.0628990613, 0.0007771141, -0.0000032940

+ MISTRAL_OLDRX

-0.0055555555555569409, 0.00014822163433269445, 0.000027586713698, -0.000000077732053

+ MISTRAL_OLDRY

-0.036111111111111108

+ MISTRAL_OLDRZ

0

+ + CCB TX

-1.5

+ CCB TY

29.556666666666498, 0.263472663139432, -0.018206701940039, 0.000072373113855

+ CCB TZ

91.5590595452, -16.4202062811, 1.16941963489, -0.040640240455, 0.000733782714288, -6.62393455442e-06, 2.36410838911e-08

+ CCB RX

-0.0055555555555569409, 0.00014822163433269445, 0.000027586713698, -0.000000077732053

+ CCB RY

-0.036111111111111108

+ CCB RZ

0

+ + CCB_AS_OFF TX

-1.5

+ CCB_AS_OFF TY

28.256852219272844,-0.002707044952,-0.009870218853,0.000031617958

+ CCB_AS_OFF TZ

9.530113849340003,-0.169826241752,0.000419997047,0.000003985237

+ CCB_AS_OFF RX

-0.011392527142374848,-0.0001426193499425,0.000039508844799,-0.000000131010010

+ CCB_AS_OFF RY

-0.03611111111111111

+ CCB_AS_OFF RZ

0

+ + XB TX

-1.5

+ XB TY

29.556666666666498, 0.263472663139432, -0.018206701940039, 0.000072373113855

+ XB TZ

-38.3143893309, 4.30888128547, -0.18265795755, 0.00350049382452, -3.17057523513e-05, 1.11006707448e-07

+ XB RX

-0.0055555555555569409, 0.00014822163433269445, 0.000027586713698, -0.000000077732053

+ XB RY

-0.036111111111111108

+ XB RZ

0

+ + XB_AS_OFF TX

-1.5

+ XB_AS_OFF TY

28.256852219272844,-0.002707044952,-0.009870218853,0.000031617958

+ XB_AS_OFF TZ

7.92754535681,-1.73279985542,0.147346047014,-0.00516934108597,7.69094654954e-05,-4.0697957632e-07

+ XB_AS_OFF RX

-0.011392527142374848,-0.0001426193499425,0.000039508844799,-0.000000131010010

+ XB_AS_OFF RY

-0.03611111111111111

+ XB_AS_OFF RZ

0

+ +
diff --git a/SRT/Configuration/CDB/alma/DataBlock/MinorServo/SRP/LookupTables/LookupTables.xml b/SRT/Configuration/CDB/alma/DataBlock/MinorServo/SRP/LookupTables/LookupTables.xml deleted file mode 100644 index ff8c421a152468211be26a3228c558cb9543c6fd..0000000000000000000000000000000000000000 --- a/SRT/Configuration/CDB/alma/DataBlock/MinorServo/SRP/LookupTables/LookupTables.xml +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - TX-1.5 - TY28.256852219272844,-0.002707044952,-0.009870218853,0.000031617958 - TZ9.530113849340003,-0.169826241752,0.000419997047,0.000003985237 - RX-0.011392527142374848,-0.0001426193499425,0.000039508844799,-0.000000131010010 - RY-0.03611111111111111 - RZ0 - - TX-1.5 - TY29.556666666666498,0.263472663139432,-0.018206701940039,0.000072373113855 - TZ-15.6669651675,1.9293068324,-0.0628990613,0.0007771141,-0.0000032940 - RX-0.0055555555555569409,0.00014822163433269445,0.000027586713698,-0.000000077732053 - RY-0.036111111111111108 - RZ0 - - TX-1.5 - TY28.256852219272844,-0.002707044952,-0.009870218853,0.000031617958 - TZ9.530113849340003,-0.169826241752,0.000419997047,0.000003985237 - RX-0.011392527142374848,-0.0001426193499425,0.000039508844799,-0.000000131010010 - RY-0.03611111111111111 - RZ0 - - TX-1.5 - TY29.556666666666498,0.263472663139432,-0.018206701940039,0.000072373113855 - TZ-15.6669651675,1.9293068324,-0.0628990613,0.0007771141,-0.0000032940 - RX-0.0055555555555569409,0.00014822163433269445,0.000027586713698,-0.000000077732053 - RY-0.036111111111111108 - RZ0 - - TX-1.5 - TY-90.4571677,2.06486636,-0.066594993,0.00679193157,-0.000204050966,0.00000233354544,-0.00000000926776063 - TZ-15.6669651675,1.9293068324,-0.0628990613,0.0007771141,-0.0000032940 - RX-0.0055555555555569409,0.00014822163433269445,0.000027586713698,-0.000000077732053 - RY-0.036111111111111108 - RZ0 - - TX0 - TY0 - TZ0 - RX0 - RY0 - RZ0 - - TX0 - TY0 - TZ0 - RX0 - RY0 - RZ0 - - TX0 - TY0 - TZ0 - RX0 - RY0 - RZ0 - - TX0 - TY0 - TZ0 - RX0 - RY0 - RZ0 - - TX0 - TY0 - TZ0 - RX0 - RY0 - RZ0 - - TX0 - TY0 - TZ0 - RX0 - RY0 - RZ0 - - TX-1.5 - TY28.256852219272844,-0.002707044952,-0.009870218853,0.000031617958 - TZ9.530113849340003,-0.169826241752,0.000419997047,0.000003985237 - RX-0.011392527142374848,-0.0001426193499425,0.000039508844799,-0.000000131010010 - RY-0.03611111111111111 - RZ0 - - TX-1.5 - TY-90.4571677,2.06486636,-0.066594993,0.00679193157,-0.000204050966,0.00000233354544,-0.00000000926776063 - TZ185.005164,-11.1663042,0.212522011,-0.00131754377 - RX-0.0055555555555569409,0.00014822163433269445,0.000027586713698,-0.000000077732053 - RY-0.036111111111111108 - RZ0 - - TX-1.5 - TY28.256852219272844,-0.002707044952,-0.009870218853,0.000031617958 - TZ9.530113849340003,-0.169826241752,0.000419997047,0.000003985237 - RX-0.011392527142374848,-0.0001426193499425,0.000039508844799,-0.000000131010010 - RY-0.03611111111111111 - RZ0 - - TX-1.5 - TY29.556666666666498,0.263472663139432,-0.018206701940039,0.000072373113855 - TZ-15.6669651675,1.9293068324,-0.0628990613,0.0007771141,-0.0000032940 - RX-0.0055555555555569409,0.00014822163433269445,0.000027586713698,-0.000000077732053 - RY-0.036111111111111108 - RZ0 - - TX-1.5 - TY28.256852219272844,-0.002707044952,-0.009870218853,0.000031617958 - TZ9.530113849340003,-0.169826241752,0.000419997047,0.000003985237 - RX-0.011392527142374848,-0.0001426193499425,0.000039508844799,-0.000000131010010 - RY-0.03611111111111111 - RZ0 - - TX-1.5 - TY29.556666666666498,0.263472663139432,-0.018206701940039,0.000072373113855 - TZ91.5590595452,-16.4202062811,1.16941963489,-0.040640240455,0.000733782714288,-6.62393455442e-06,2.36410838911e-08 - RX-0.0055555555555569409,0.00014822163433269445,0.000027586713698,-0.000000077732053 - RY-0.036111111111111108 - RZ0 - - TX-1.5 - TY28.256852219272844,-0.002707044952,-0.009870218853,0.000031617958 - TZ7.92754535681,-1.73279985542,0.147346047014,-0.00516934108597,7.69094654954e-05,-4.0697957632e-07 - RX-0.011392527142374848,-0.0001426193499425,0.000039508844799,-0.000000131010010 - RY-0.03611111111111111 - RZ0 - - TX-1.5 - TY29.556666666666498,0.263472663139432,-0.018206701940039,0.000072373113855 - TZ-38.3143893309,4.30888128547,-0.18265795755,0.00350049382452,-3.17057523513e-05,1.11006707448e-07 - RX-0.0055555555555569409,0.00014822163433269445,0.000027586713698,-0.000000077732053 - RY-0.036111111111111108 - RZ0 - - diff --git a/SRT/Interfaces/SRTMinorServoInterface/idl/SRTMinorServo.idl b/SRT/Interfaces/SRTMinorServoInterface/idl/SRTMinorServo.idl index 293610d47f930eb15215b3ee2fd770418e66302c..b88d589425cfde7d01be5cb95193f67df5f9960b 100644 --- a/SRT/Interfaces/SRTMinorServoInterface/idl/SRTMinorServo.idl +++ b/SRT/Interfaces/SRTMinorServoInterface/idl/SRTMinorServo.idl @@ -135,10 +135,11 @@ module MinorServo /** * This method loads from the CDB the positioning coefficients related to the given configuration * @param configuration the string representing the name of the table from which the coefficients will be loaded + * @param as_off a boolean indicating whether the servo requires a _AS_OFF configuration * @throw ComponentErrors::ComponentErrorsEx when there is an error while trying to load the table for the given configuration * @return true if the servo is in use with the current configuration, false otherwise */ - boolean setup(in string configuration) raises (ComponentErrors::ComponentErrorsEx); + boolean setup(in string configuration, in boolean as_off) raises (ComponentErrors::ComponentErrorsEx); /** * This method calculates the servo coordinates for a given elevation diff --git a/SRT/Libraries/SRTMinorServoLibrary/include/SRTMinorServoContainers.h b/SRT/Libraries/SRTMinorServoLibrary/include/SRTMinorServoContainers.h index 2c679b4df7904f4b077f53100bedcba47ed70e6c..e966f532dec770beeac0b78a168a79f29a287d71 100644 --- a/SRT/Libraries/SRTMinorServoLibrary/include/SRTMinorServoContainers.h +++ b/SRT/Libraries/SRTMinorServoLibrary/include/SRTMinorServoContainers.h @@ -70,33 +70,6 @@ namespace MinorServo double starting_elevation = 0; }; - /** - * This dictionary contains information regarding the possibile focal configurations. - * The key indicates the configuration as known by DISCOS. - * The value is a pair, the first element of the pair is the DISCOS enumeration for the relative Leonardo configuration, - * the second element of the pair indicates whether the configuration has a ASACTIVE twin configuraiton. - */ - using DiscosConfigurationNameTableType = std::map>; - const DiscosConfigurationNameTableType DiscosConfigurationNameTable = - { - //{"LLP", std::make_pair(CONFIGURATION_PRIMARY, false)}, - //{"PPP", std::make_pair(CONFIGURATION_PRIMARY, false)}, - //{"PLP", std::make_pair(CONFIGURATION_PRIMARY, false)}, - //{"HHP", std::make_pair(CONFIGURATION_PRIMARY, false)}, - //{"XKP", std::make_pair(CONFIGURATION_PRIMARY, false)}, - {"CCG", std::make_pair(CONFIGURATION_GREGORIAN1, true )}, - {"KKG", std::make_pair(CONFIGURATION_GREGORIAN2, true )}, - {"KBAND_TEST", std::make_pair(CONFIGURATION_GREGORIAN2, false)}, - {"WWG", std::make_pair(CONFIGURATION_GREGORIAN3, true )}, - {"QQG", std::make_pair(CONFIGURATION_GREGORIAN4, true )}, - {"TRI", std::make_pair(CONFIGURATION_GREGORIAN5, true )}, - {"MISTRAL", std::make_pair(CONFIGURATION_GREGORIAN6, true )}, - {"MISTRAL_OLD", std::make_pair(CONFIGURATION_GREGORIAN6, true )}, - {"CCB", std::make_pair(CONFIGURATION_BWG1, true )}, - {"XB", std::make_pair(CONFIGURATION_BWG3, true )}, - {"CABINET", std::make_pair(CONFIGURATION_GREGORIAN7, false)}, - }; - /** * This dictionary contains the Leonardo focal configurations DISCOS enumerations, alongside their name inside the Leonardo minor servo system. */ @@ -136,7 +109,7 @@ namespace MinorServo (CONFIGURATION_BWG3, 23) (CONFIGURATION_BWG4, 24); - using SRTMinorServoLookupTable = std::map>; + using SRTMinorServoCoefficientsTable = std::map>; /** * This class implements a queue of time tagged positions. it extends a simple std::map with some specific methods. diff --git a/SRT/Outdated/CDB/alma/DataBlock/MinorServo/PFP/Coefficients/Coefficients.xml b/SRT/Outdated/CDB/alma/DataBlock/MinorServo/PFP/Coefficients/Coefficients.xml new file mode 100644 index 0000000000000000000000000000000000000000..b553b2235d73efb25dadc42a0adf2536ee7ea531 --- /dev/null +++ b/SRT/Outdated/CDB/alma/DataBlock/MinorServo/PFP/Coefficients/Coefficients.xml @@ -0,0 +1,35 @@ + + + + + + + + LLPTX

0

+ LLPTZ

0

+ LLPRTHETA

0

+ + PPPTX

0

+ PPPTZ

0

+ PPPRTHETA

0

+ + PLPTX

0

+ PLPTZ

0

+ PLPRTHETA

0

+ + HHPTX

0

+ HHPTZ

0

+ HHPRTHETA

0

+ + XKPTX

0

+ XKPTZ

0

+ XKPRTHETA

0

+ +
diff --git a/SRT/Outdated/CDB/alma/DataBlock/MinorServo/PFP/LookupTables/LookupTables.xml b/SRT/Outdated/CDB/alma/DataBlock/MinorServo/PFP/LookupTables/LookupTables.xml deleted file mode 100644 index 086b3785bfad3d4cf429fc8d5b6703514c07c6f6..0000000000000000000000000000000000000000 --- a/SRT/Outdated/CDB/alma/DataBlock/MinorServo/PFP/LookupTables/LookupTables.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - TX 0 - TZ 0 - RTHETA 0 - - TX 0 - TZ 0 - RTHETA 0 - - TX 0 - TZ 0 - RTHETA 0 - - TX 0 - TZ 0 - RTHETA 0 - - TX 0 - TZ 0 - RTHETA 0 - - diff --git a/SRT/Servers/SRTMinorServo/config/CDB/schemas/SRTMinorServoBoss.xsd b/SRT/Servers/SRTMinorServo/config/CDB/schemas/SRTMinorServoBoss.xsd index 153014681305e91ffdc45d26a51fb81befe48644..1456191e10b2f664060401fb11a5f7a085f2f535 100644 --- a/SRT/Servers/SRTMinorServo/config/CDB/schemas/SRTMinorServoBoss.xsd +++ b/SRT/Servers/SRTMinorServo/config/CDB/schemas/SRTMinorServoBoss.xsd @@ -18,6 +18,19 @@ + + + + + + + + + + + + + @@ -53,5 +66,6 @@ + diff --git a/SRT/Servers/SRTMinorServo/config/CDB/schemas/SRTMinorServoCoefficients.xsd b/SRT/Servers/SRTMinorServo/config/CDB/schemas/SRTMinorServoCoefficients.xsd new file mode 100644 index 0000000000000000000000000000000000000000..e51c87367cf7c9b8c305ebb7f05b6710e984eb11 --- /dev/null +++ b/SRT/Servers/SRTMinorServo/config/CDB/schemas/SRTMinorServoCoefficients.xsd @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SRT/Servers/SRTMinorServo/include/SRTMinorServoBossCore.h b/SRT/Servers/SRTMinorServo/include/SRTMinorServoBossCore.h index b315443a8e4494e314afab5f6a2bf7eb86cdf7f2..240e5c831e29a1c4b40d12c966b72244232fba7b 100644 --- a/SRT/Servers/SRTMinorServo/include/SRTMinorServoBossCore.h +++ b/SRT/Servers/SRTMinorServo/include/SRTMinorServoBossCore.h @@ -286,6 +286,11 @@ private: */ void reset(bool force=false); + /** + * Method that loads the focal configurations names when the boss is started + */ + std::map loadConfigurations(); + /** * Method used to retrieve a configuration value from the CDB. * @param configuration the name of the value to be read from the CDB. @@ -443,6 +448,11 @@ private: */ std::map m_current_tracking_servos; + /** + * Map that contains the possible focal configurations + */ + const std::map m_DISCOS_2_LDO_configurations; + /** * Current scan parameters. */ diff --git a/SRT/Servers/SRTMinorServo/include/SRTMinorServoBossImpl.h b/SRT/Servers/SRTMinorServo/include/SRTMinorServoBossImpl.h index a22cceb6b1497b5646911dbb0f1c7e4aa41b3508..5321bf57dd13defec5f44b7bd97a4feb2f81c898 100644 --- a/SRT/Servers/SRTMinorServo/include/SRTMinorServoBossImpl.h +++ b/SRT/Servers/SRTMinorServo/include/SRTMinorServoBossImpl.h @@ -106,8 +106,8 @@ public: virtual CORBA::Boolean isStarting(); /** - * Method that tells if the system is using ASACTIVE lookup tables or not. - * @return a CORBA::Boolean indicating if the system is configured to use ASACTIVE lookup tables or not. + * Method that tells if the system is using AS coefficients or not. + * @return a CORBA::Boolean indicating if the system is configured to use AS coefficients or not. */ virtual CORBA::Boolean isASConfiguration(); diff --git a/SRT/Servers/SRTMinorServo/include/SRTMinorServoImpl.h b/SRT/Servers/SRTMinorServo/include/SRTMinorServoImpl.h index a8254f7dd9ab1c695e448040681205cb3a5b6aa5..a664462c010fc810284a98ebaf5cbe5ea8f0a8fc 100644 --- a/SRT/Servers/SRTMinorServo/include/SRTMinorServoImpl.h +++ b/SRT/Servers/SRTMinorServo/include/SRTMinorServoImpl.h @@ -105,10 +105,11 @@ public: /** * Asks the servo system to load the commanded configuration table. * @param configuration_name the configuration the servo system should assume. + * @param as_off a boolean indicating whether the servo should use a _AS_OFF configuration * @throw ComponentErrors::ComponentErrorsEx when there is an error while trying to load the table for the given configuration. * @return true if the servo is in use with the current configuration, false otherwise */ - bool setup(const char* configuration_name = ""); + bool setup(const char* configuration_name = "", CORBA::Boolean as_off = false); /** * Asks the component to calculate the servo system position starting from the given elevation. @@ -524,7 +525,7 @@ private: /** * Table containing the coefficients for the positions calculations. */ - SRTMinorServoLookupTable m_current_lookup_table; + SRTMinorServoCoefficientsTable m_current_coefficients_table; /** * Configuration of the socket object. @@ -616,7 +617,7 @@ public: /** * Setup method definition. It simply calls the SRTBaseMinorServoImpl method. */ - bool setup(const char* configuration_name = "") { return SRTBaseMinorServoImpl::setup(configuration_name); } + bool setup(const char* configuration_name = "", CORBA::Boolean as_off = false) { return SRTBaseMinorServoImpl::setup(configuration_name, as_off); } /** * Declaration of all the other inherited methods. @@ -667,7 +668,7 @@ public: * @param configuration_name the configuration the servo system should assume. * @throw ComponentErrors::ComponentErrorsEx when there is an error while trying to load the table for the given configuration. */ - bool setup(const char* configuration_name = ""); + bool setup(const char* configuration_name = "", CORBA::Boolean as_off = false); /** * Declaration of all the other inherited methods. diff --git a/SRT/Servers/SRTMinorServo/src/Makefile b/SRT/Servers/SRTMinorServo/src/Makefile index a61ed3645ec6b06685e47ed1c313dc53d575ed67..141c676de6656bd3bba8aef79cacd265160390f9 100644 --- a/SRT/Servers/SRTMinorServo/src/Makefile +++ b/SRT/Servers/SRTMinorServo/src/Makefile @@ -13,7 +13,7 @@ PY_SCRIPTS = _cover _airBlade _servoReset # On-Line Database Files # ---------------------- -CDB_SCHEMAS = SRTMinorServoCommon SRTMinorServoBoss SRTMinorServo SRTMinorServoSocketConfiguration SRTMinorServoVBrainConfiguration SRTMinorServoProperties SRTMinorServoLookupTable +CDB_SCHEMAS = SRTMinorServoCommon SRTMinorServoBoss SRTMinorServo SRTMinorServoSocketConfiguration SRTMinorServoVBrainConfiguration SRTMinorServoProperties SRTMinorServoCoefficients # ---------------------------- # Libraries (public and local) diff --git a/SRT/Servers/SRTMinorServo/src/SRTBaseMinorServoImpl.cpp b/SRT/Servers/SRTMinorServo/src/SRTBaseMinorServoImpl.cpp index 8371127f0e03e6722fa62ea3332d7eca5a7d10f4..ce3eca5c2ced82f96efe2bb6eb92b2d84b9689c7 100644 --- a/SRT/Servers/SRTMinorServo/src/SRTBaseMinorServoImpl.cpp +++ b/SRT/Servers/SRTMinorServo/src/SRTBaseMinorServoImpl.cpp @@ -47,7 +47,7 @@ SRTBaseMinorServoImpl::SRTBaseMinorServoImpl(const ACE_CString& component_name, m_in_use_ptr(this), m_current_setup_ptr(this), m_error_code_ptr(this), - m_current_lookup_table(), + m_current_coefficients_table(), m_socket_configuration(SRTMinorServoSocketConfiguration::getInstance(container_services)), m_socket(SRTMinorServoSocket::getInstance(m_socket_configuration.m_ip_address, m_socket_configuration.m_port, m_socket_configuration.m_timeout)) { @@ -254,11 +254,11 @@ void SRTBaseMinorServoImpl::preset(const ACS::doubleSeq& virtual_coords) std::copy(coordinates.begin(), coordinates.end(), m_commanded_virtual_positions.begin()); } -bool SRTBaseMinorServoImpl::setup(const char* configuration_name) +bool SRTBaseMinorServoImpl::setup(const char* configuration_name, CORBA::Boolean as_off) { AUTO_TRACE(m_servo_name + "::setup()"); m_in_use.store(Management::MNG_FALSE); - m_current_lookup_table.clear(); + m_current_coefficients_table.clear(); m_current_setup = ""; std::string setup_name(configuration_name); @@ -269,17 +269,21 @@ bool SRTBaseMinorServoImpl::setup(const char* configuration_name) return false; } - IRA::CDBTable table(getContainerServices(), setup_name.c_str(), std::string("DataBlock/MinorServo/" + m_servo_name).c_str()); + IRA::CDBTable table(getContainerServices(), "configuration", std::string("DataBlock/MinorServo/" + m_servo_name).c_str()); IRA::CError error; error.Reset(); - if(!table.addField(error, "axis", IRA::CDataField::STRING)) + if(!table.addField(error, "n", IRA::CDataField::STRING)) + { + error.setExtra("Error adding field name", 0); + } + if(!table.addField(error, "a", IRA::CDataField::STRING)) { error.setExtra("Error adding field axis", 0); } - if(!table.addField(error, "coefficients", IRA::CDataField::STRING)) + if(!table.addField(error, "p", IRA::CDataField::STRING)) { - error.setExtra("Error adding field coefficients", 0); + error.setExtra("Error adding field polynomial", 0); } if(!error.isNoError()) { @@ -296,27 +300,52 @@ bool SRTBaseMinorServoImpl::setup(const char* configuration_name) throw ex.getComponentErrorsEx(); } - table.First(); - for(unsigned int i = 0; i < table.recordCount(); i++, table.Next()) + // We should try to retrieve the _AS_OFF configuration if requested. If is not found, fallback to the normal one + std::string config_name = setup_name; + if(as_off) + config_name += "_AS_OFF"; + + for(size_t j = 0; j < (as_off ? 2 : 1); j++) { - std::string axis = std::string(table["axis"]->asString()); + table.First(); + for(unsigned int i = 0; i < table.recordCount(); i++, table.Next()) + { + std::string name = std::string(table["n"]->asString()); + if(name != config_name) + continue; - std::vector coefficients; + std::string axis = std::string(table["a"]->asString()); - std::string coefficient_str; - std::stringstream stream(std::string(table["coefficients"]->asString())); + std::vector coefficients; - while(std::getline(stream, coefficient_str, ',')) - { - coefficients.push_back(std::stod(std::regex_replace(coefficient_str, std::regex("\\s+"), ""))); + std::string coefficient_str; + std::stringstream stream(std::string(table["p"]->asString())); + + while(std::getline(stream, coefficient_str, ',')) + { + coefficients.push_back(std::stod(std::regex_replace(coefficient_str, std::regex("\\s+"), ""))); + } + + m_current_coefficients_table[axis] = coefficients; } - m_current_lookup_table[axis] = coefficients; + if(m_current_coefficients_table.size() > 0) + { + // Configuration found, exit the loop + break; + } + else + { + // Reset the configuration name to the default one + config_name = setup_name; + } } table.closeTable(); - if(m_current_lookup_table.size() > 0) + if(m_current_coefficients_table.size() > 0) { + if(as_off) + setup_name += "_AS_OFF"; m_current_setup = setup_name; clearUserOffsets(); clearSystemOffsets(); @@ -344,7 +373,7 @@ ACS::doubleSeq* SRTBaseMinorServoImpl::calcCoordinates(double elevation) for(size_t axis = 0; axis < m_virtual_axes; axis++) { - std::vector coefficients = m_current_lookup_table.at(m_virtual_axes_names[axis]); + std::vector coefficients = m_current_coefficients_table.at(m_virtual_axes_names[axis]); double coordinate = 0; diff --git a/SRT/Servers/SRTMinorServo/src/SRTMinorServoBossCore.cpp b/SRT/Servers/SRTMinorServo/src/SRTMinorServoBossCore.cpp index 5e3aaeb2d5373743101b979e3a7d6e466ba5207e..a5c499f7496be690eaf251213e2ed7694ce6e44f 100644 --- a/SRT/Servers/SRTMinorServo/src/SRTMinorServoBossCore.cpp +++ b/SRT/Servers/SRTMinorServo/src/SRTMinorServoBossCore.cpp @@ -38,7 +38,8 @@ SRTMinorServoBossCore::SRTMinorServoBossCore(SRTMinorServoBossImpl& component) : m_tracking_servos{ //{ "PFP", m_component.getContainerServices()->getComponent("MINORSERVO/PFP") }, { "SRP", m_component.getContainerServices()->getComponent("MINORSERVO/SRP") } - } + }, + m_DISCOS_2_LDO_configurations(loadConfigurations()) { AUTO_TRACE("SRTMinorServoBossCore::SRTMinorServoBossCore()"); @@ -196,17 +197,16 @@ void SRTMinorServoBossCore::setup(std::string commanded_setup) std::transform(commanded_setup.begin(), commanded_setup.end(), commanded_setup.begin(), ::toupper); - std::pair cmd_configuration; SRTMinorServoFocalConfiguration commanded_configuration; try { - cmd_configuration = DiscosConfigurationNameTable.at(commanded_setup); - commanded_configuration = cmd_configuration.first; + std::string LDO_configuration = m_DISCOS_2_LDO_configurations.at(commanded_setup); + commanded_configuration = LDOConfigurationNameTable.right.at(LDO_configuration); - if(m_as_configuration.load() == Management::MNG_TRUE && cmd_configuration.second) + if(m_as_configuration.load() == Management::MNG_FALSE) { - commanded_setup += "_ASACTIVE"; + commanded_setup += "_AS_OFF"; } } catch(std::out_of_range& oor) @@ -235,8 +235,6 @@ void SRTMinorServoBossCore::setup(std::string commanded_setup) } } - ACS_LOG(LM_FULL_INFO, "servoSetup", (LM_NOTICE, ("SETTING UP '" + commanded_setup + "' CONFIGURATION").c_str())); - m_commanded_configuration.store(commanded_configuration); m_commanded_setup = commanded_setup; @@ -336,8 +334,6 @@ void SRTMinorServoBossCore::park() return; } - ACS_LOG(LM_FULL_INFO, "servoPark", (LM_NOTICE, "PARKING")); - m_commanded_configuration.store(CONFIGURATION_PARK); m_commanded_setup = "Park"; @@ -504,7 +500,7 @@ void SRTMinorServoBossCore::setASConfiguration(std::string configuration) } // Should reload the correct setup if the system was already configured or was about to be - if(!m_commanded_setup.empty()) + if(!m_commanded_setup.empty() && m_motion_status.load() != MOTION_STATUS_PARKED) { configuration = m_commanded_setup.substr(0, m_commanded_setup.find("_")); try @@ -1460,6 +1456,49 @@ void SRTMinorServoBossCore::reset(bool force) m_error_code.store(ERROR_NO_ERROR); } +std::map SRTMinorServoBossCore::loadConfigurations() +{ + AUTO_TRACE("SRTMinorServoBossCore::loadConfigurations()"); + + IRA::CDBTable table(m_component.getContainerServices(), "configuration", std::string("DataBlock/MinorServo/Boss").c_str()); + IRA::CError error; + error.Reset(); + + if(!table.addField(error, "DISCOS", IRA::CDataField::STRING)) + { + error.setExtra("Error adding field DISCOS", 0); + } + if(!table.addField(error, "LDO", IRA::CDataField::STRING)) + { + error.setExtra("Error adding field LDO", 0); + } + if(!error.isNoError()) + { + _EXCPT_FROM_ERROR(ComponentErrors::IRALibraryResourceExImpl, ex, error); + ex.setCode(error.getErrorCode()); + ex.setDescription((const char *)error.getDescription()); + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + if(!table.openTable(error)) + { + _EXCPT_FROM_ERROR(ComponentErrors::CDBAccessExImpl, ex, error); + ex.log(LM_DEBUG); + throw ex.getComponentErrorsEx(); + } + + std::map map; + + table.First(); + for(unsigned int i = 0; i < table.recordCount(); i++, table.Next()) + { + map[std::string(table["DISCOS"]->asString())] = std::string(table["LDO"]->asString()); + } + table.closeTable(); + + return map; +} + Management::TBoolean SRTMinorServoBossCore::getCDBConfiguration(std::string which_configuration) { AUTO_TRACE("SRTMinorServoBossCore::getCDBConfiguration()"); diff --git a/SRT/Servers/SRTMinorServo/src/SRTMinorServoParkThread.cpp b/SRT/Servers/SRTMinorServo/src/SRTMinorServoParkThread.cpp index 2e6dff7e242e9ca38e1622340a2a7fccdba8edf8..27bf305cccf4131a247b80f3ac4cb4c0f396e225 100644 --- a/SRT/Servers/SRTMinorServo/src/SRTMinorServoParkThread.cpp +++ b/SRT/Servers/SRTMinorServo/src/SRTMinorServoParkThread.cpp @@ -22,14 +22,14 @@ void SRTMinorServoParkThread::onStart() m_status = 0; - ACS_LOG(LM_FULL_INFO, "SRTMinorServoParkThread::onStart()", (LM_NOTICE, "PARK THREAD STARTED")); + ACS_LOG(LM_FULL_INFO, "SRTMinorServoParkThread::onStart()", (LM_NOTICE, "Parking MinorServos...")); } void SRTMinorServoParkThread::onStop() { AUTO_TRACE("SRTMinorServoParkThread::onStop()"); - ACS_LOG(LM_FULL_INFO, "SRTMinorServoParkThread::onStop()", (LM_NOTICE, "PARK THREAD STOPPED")); + ACS_LOG(LM_FULL_INFO, "SRTMinorServoParkThread::onStop()", (LM_NOTICE, "MinorServos parked")); } void SRTMinorServoParkThread::runLoop() @@ -80,7 +80,7 @@ void SRTMinorServoParkThread::runLoop() { for(const auto& [name, servo] : m_core.m_servos) { - servo->setup(""); + servo->setup("", false); } m_core.m_actual_setup = m_core.m_commanded_setup; diff --git a/SRT/Servers/SRTMinorServo/src/SRTMinorServoScanThread.cpp b/SRT/Servers/SRTMinorServo/src/SRTMinorServoScanThread.cpp index d195b2bf1188f3d84834aa67cd284bc2a4047539..173981e0f423ead92baa7e0d71a1416e43924c65 100644 --- a/SRT/Servers/SRTMinorServo/src/SRTMinorServoScanThread.cpp +++ b/SRT/Servers/SRTMinorServo/src/SRTMinorServoScanThread.cpp @@ -51,7 +51,7 @@ void SRTMinorServoScanThread::onStart() auto servo = m_core.m_tracking_servos.at(m_core.m_current_scan.servo_name); m_starting_coordinates = *servo->getAxesPositions(0); - ACS_LOG(LM_FULL_INFO, "SRTMinorServoScanThread::onStart()", (LM_NOTICE, + ACS_LOG(LM_FULL_INFO, "SRTMinorServoScanThread::onStart()", (LM_DEBUG, ("SCAN THREAD STARTED, SCANNING " + std::to_string((int)m_core.m_current_scan.scan_range) + "MM IN " + std::to_string((int)(m_core.m_current_scan.scan_duration / 10000000)) + " SECONDS ALONG " + m_core.m_current_scan.servo_name + " " + m_core.m_current_scan.axis_name + " AXIS").c_str() )); } @@ -60,7 +60,7 @@ void SRTMinorServoScanThread::onStop() { AUTO_TRACE("SRTMinorServoScanThread::onStop()"); - ACS_LOG(LM_FULL_INFO, "SRTMinorServoScanThread::onStop()", (LM_NOTICE, "SCAN THREAD STOPPED")); + ACS_LOG(LM_FULL_INFO, "SRTMinorServoScanThread::onStop()", (LM_DEBUG, "SCAN THREAD STOPPED")); m_core.m_scanning.store(Management::MNG_FALSE); diff --git a/SRT/Servers/SRTMinorServo/src/SRTMinorServoSetupThread.cpp b/SRT/Servers/SRTMinorServo/src/SRTMinorServoSetupThread.cpp index d782a86cb6cf867155dcd06a096caeb157af1c85..cd6c05ca4c70a1deba59c0b4bf86cbf5012adc8e 100644 --- a/SRT/Servers/SRTMinorServo/src/SRTMinorServoSetupThread.cpp +++ b/SRT/Servers/SRTMinorServo/src/SRTMinorServoSetupThread.cpp @@ -27,15 +27,13 @@ void SRTMinorServoSetupThread::onStart() m_LDO_configuration = LDOConfigurationNameTable.left.at(commanded_configuration); m_gregorian_cover_position = commanded_configuration == CONFIGURATION_PRIMARY ? COVER_STATUS_CLOSED : COVER_STATUS_OPEN; - ACS_LOG(LM_FULL_INFO, "SRTMinorServoSetupThread::onStart()", (LM_NOTICE, ("SETUP THREAD STARTED WITH '" + m_core.m_commanded_setup + "' CONFIGURATION").c_str())); + ACS_LOG(LM_FULL_INFO, "SRTMinorServoSetupThread::onStart()", (LM_NOTICE, ("Setting up MinorServos with '" + m_core.m_commanded_setup + "' configuration").c_str())); } void SRTMinorServoSetupThread::onStop() { AUTO_TRACE("SRTMinorServoSetupThread::onStop()"); - ACS_LOG(LM_FULL_INFO, "SRTMinorServoSetupThread::onStop()", (LM_NOTICE, "SETUP THREAD STOPPED")); - if(m_core.m_motion_status.load() == MOTION_STATUS_TRACKING) { try @@ -47,6 +45,8 @@ void SRTMinorServoSetupThread::onStop() ACS_SHORT_LOG((LM_ERROR, ex.errorTrace.routine)); } } + + ACS_LOG(LM_FULL_INFO, "SRTMinorServoSetupThread::onStop()", (LM_NOTICE, "MinorServos configured")); } void SRTMinorServoSetupThread::runLoop() @@ -154,7 +154,7 @@ void SRTMinorServoSetupThread::runLoop() { try { - if(servo->setup(m_core.m_commanded_setup.c_str())) + if(servo->setup(m_core.m_commanded_setup.c_str(), m_core.m_as_configuration.load())) { m_core.m_current_servos[servo_name] = servo; try @@ -176,7 +176,7 @@ void SRTMinorServoSetupThread::runLoop() } } - if(m_core.m_commanded_setup.find("_ASACTIVE") == std::string::npos) + if(!m_core.m_as_configuration.load()) { // We commanded a configuration which does not use the active surface, therefore we need to send some slightly different coordinates with a preset command @@ -198,7 +198,7 @@ void SRTMinorServoSetupThread::runLoop() } else { - // _ASACTIVE configuration, jump directly to state 7 + // AS configuration, jump directly to state 7 m_status = 7; } diff --git a/SRT/Servers/SRTMinorServo/src/SRTMinorServoTrackingThread.cpp b/SRT/Servers/SRTMinorServo/src/SRTMinorServoTrackingThread.cpp index b45fb40e5dc34225da8fd5518ab8cfa5c212abdf..e59c1375093fe84417bea27942a03195b3ed4cb3 100644 --- a/SRT/Servers/SRTMinorServo/src/SRTMinorServoTrackingThread.cpp +++ b/SRT/Servers/SRTMinorServo/src/SRTMinorServoTrackingThread.cpp @@ -22,16 +22,16 @@ void SRTMinorServoTrackingThread::onStart() m_point_id = 0; m_point_time = 0; - ACS_LOG(LM_FULL_INFO, "SRTMinorServoTrackingThread::onStart()", (LM_NOTICE, "TRACKING THREAD STARTED")); + ACS_LOG(LM_FULL_INFO, "SRTMinorServoTrackingThread::onStart()", (LM_DEBUG, "TRACKING THREAD STARTED")); } void SRTMinorServoTrackingThread::onStop() { AUTO_TRACE("SRTMinorServoTrackingThread::onStop()"); - ACS_LOG(LM_FULL_INFO, "SRTMinorServoTrackingThread::onStop()", (LM_NOTICE, "TRACKING THREAD STOPPED")); - m_core.m_elevation_tracking.store(Management::MNG_FALSE); + + ACS_LOG(LM_FULL_INFO, "SRTMinorServoTrackingThread::onStop()", (LM_DEBUG, "TRACKING THREAD STOPPED")); } void SRTMinorServoTrackingThread::runLoop() diff --git a/SRT/Servers/SRTMinorServo/src/SRTProgramTrackMinorServoImpl.cpp b/SRT/Servers/SRTMinorServo/src/SRTProgramTrackMinorServoImpl.cpp index ddad515e18b9f9179e73f77487d7b25b0612c2e5..925881a89c035f9acab68fbd919400d9492af788 100644 --- a/SRT/Servers/SRTMinorServo/src/SRTProgramTrackMinorServoImpl.cpp +++ b/SRT/Servers/SRTMinorServo/src/SRTProgramTrackMinorServoImpl.cpp @@ -122,9 +122,9 @@ bool SRTProgramTrackMinorServoImpl::status() return status; } -bool SRTProgramTrackMinorServoImpl::setup(const char* configuration_name) +bool SRTProgramTrackMinorServoImpl::setup(const char* configuration_name, CORBA::Boolean as_off) { - bool return_value = SRTBaseMinorServoImpl::setup(configuration_name); + bool return_value = SRTBaseMinorServoImpl::setup(configuration_name, as_off); m_tracking_queue.clear(); m_total_trajectory_points.store(0);