Skip to content
Snippets Groups Projects
Unverified Commit 97f713ab authored by Giuseppe Carboni's avatar Giuseppe Carboni Committed by GitHub
Browse files

Integration of new SRT LDO derotators into centos_7_compatibility branch (#925)

* Moved some method from GenericDerotator to SRTKBandDerotator

The methods were not generic, they were specific methods of the old SRTKBandDerotator decommissioned interface.
These methods are not even called by the DewarPositioner component, therefore it was safe to remove them from the GenericDerotator interface.

* Moved another unused method

* Updated GenericDerotator interface

* Fix #865, fix #869, updated SRTMinorServo component

The component now handles correctly a SETUP command.
The component is also capable of commanding the gregorian air blade with the 'setGregorianAirBladeStatus' command.
A few bugs were fixed here and there.
This branch MUST be tested with the real hardware before merging it onto the centos_7_compatibility branch.

* Fixed small bug

* Removed redundant script

* Uploading files in order to test a clean repository

* Updated PyDewarPositioner for Python 3

* First LDO Derotators working implementation

This commit also brings some clean up inside the SRT test CDB.
All the stuff that is not used in the production environment has been moved out of the production and test environment and into the Outdated CDB.

* KBand derotator updates

* Moved SRTDerotators out of SRTMinorServoBossCore

Each derotator now has its thread for updating its status
parent e311ab51
No related branches found
No related tags found
No related merge requests found
<?xml version='1.0' encoding='ISO-8859-1'?>
<!--
Authors: Giuseppe Carboni giuseppe.carboni@inaf.it
-->
<SRTDerotator
xmlns="urn:schemas-cosylab-com:SRTMinorServo:1.0"
xmlns:baci="urn:schemas-cosylab-com:BACI:1.0"
xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
physical_axes="1"
virtual_axes="1"
max_speed="3.276"
acceleration="2.67"
min_range="-127"
max_range="127"
step="60"
tracking_delta="0.1"
zero_offset="12.5">
<enabled description="All physical axes enabled" />
<drive_cabinet_status description="Drive cabinet status" />
<block description="Minor servo in block status" />
<operative_mode description="Minor servo operating mode" />
<physical_axes description="Number of physical axes" />
<physical_axes_enabled description="Sequence, physical axes enabled" />
<physical_positions description="Sequence, physical axes positions" />
<virtual_axes description="Number of virtual axes" />
<plain_virtual_positions description="Sequence, plain virtual axes positions, with offsets" />
<virtual_positions description="Sequence, virtual axes positions, without offsets" />
<virtual_offsets description="Sequence, sum of user and system virtual axis offsets" />
<tracking description="Boolean indicating whether the servo is tracking the given coordinates" />
<trajectory_id description="Unsigned int, the UNIX Epoch * 1000 indicating the start time of the current trajectory" />
<total_trajectory_points description="Number of points sent for the current trajectory" />
<remaining_trajectory_points description="Remaining points of the current trajectory" />
<actPosition description="Current position, with sign inverted in respect to the LDO one"/>
<cmdPosition description="Latest commanded position, with sign inverted in respect to the LDO one" />
<positionDiff description="Difference between the commanded and the current position" />
<status description="Bit pattern indicating the status of the derotator" />
</SRTDerotator>
<?xml version='1.0' encoding='ISO-8859-1'?>
<!--
Authors: Giuseppe Carboni giuseppe.carboni@inaf.it
-->
<SRTDerotator
xmlns="urn:schemas-cosylab-com:SRTMinorServo:1.0"
xmlns:baci="urn:schemas-cosylab-com:BACI:1.0"
xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
physical_axes="1"
virtual_axes="1"
max_speed="3.276"
acceleration="2.67"
min_range="-130"
max_range="130"
step="60"
tracking_delta="0.1"
zero_offset="12.5">
<enabled description="All physical axes enabled" />
<drive_cabinet_status description="Drive cabinet status" />
<block description="Minor servo in block status" />
<operative_mode description="Minor servo operating mode" />
<physical_axes description="Number of physical axes" />
<physical_axes_enabled description="Sequence, physical axes enabled" />
<physical_positions description="Sequence, physical axes positions" />
<virtual_axes description="Number of virtual axes" />
<plain_virtual_positions description="Sequence, plain virtual axes positions, with offsets" />
<virtual_positions description="Sequence, virtual axes positions, without offsets" />
<virtual_offsets description="Sequence, sum of user and system virtual axis offsets" />
<tracking description="Boolean indicating whether the servo is tracking the given coordinates" />
<trajectory_id description="Unsigned int, the UNIX Epoch * 1000 indicating the start time of the current trajectory" />
<total_trajectory_points description="Number of points sent for the current trajectory" />
<remaining_trajectory_points description="Remaining points of the current trajectory" />
<actPosition description="Current position, with sign inverted in respect to the LDO one"/>
<cmdPosition description="Latest commanded position, with sign inverted in respect to the LDO one" />
<positionDiff description="Difference between the commanded and the current position" />
<status description="Bit pattern indicating the status of the derotator" />
</SRTDerotator>
......@@ -19,7 +19,7 @@
<xs:import namespace="urn:schemas-cosylab-com:Managment:1.0" schemaLocation="Managment.xsd"/>
<xs:import namespace="urn:schemas-cosylab-com:SRTMinorServoCommon:1.0" schemaLocation="SRTMinorServoCommon.xsd"/>
<xs:complexType name="SRTBaseMinorServoType">
<xs:complexType name="SRTLDOBasePropertiesType">
<xs:complexContent>
<xs:extension base="baci:CharacteristicComponent">
<xs:sequence>
......@@ -34,12 +34,6 @@
<xs:element name="plain_virtual_positions" type="baci:ROdoubleSeq" />
<xs:element name="virtual_positions" type="baci:ROdoubleSeq" />
<xs:element name="virtual_offsets" type="baci:ROdoubleSeq" />
<xs:element name="virtual_user_offsets" type="baci:ROdoubleSeq" />
<xs:element name="virtual_system_offsets" type="baci:ROdoubleSeq" />
<xs:element name="commanded_virtual_positions" type="baci:ROdoubleSeq" />
<xs:element name="in_use" type="mng:BooleanType" />
<xs:element name="current_setup" type="baci:ROstring" />
<xs:element name="error_code" type="ms:SRTMinorServoErrorType" />
</xs:sequence>
<xs:attribute name="physical_axes" type="xs:unsignedShort" use="required" />
<xs:attribute name="virtual_axes" type="xs:unsignedShort" use="required" />
......@@ -51,6 +45,21 @@
</xs:complexContent>
</xs:complexType>
<xs:complexType name="SRTBaseMinorServoType">
<xs:complexContent>
<xs:extension base="SRTLDOBasePropertiesType">
<xs:sequence>
<xs:element name="virtual_user_offsets" type="baci:ROdoubleSeq" />
<xs:element name="virtual_system_offsets" type="baci:ROdoubleSeq" />
<xs:element name="commanded_virtual_positions" type="baci:ROdoubleSeq" />
<xs:element name="in_use" type="mng:BooleanType" />
<xs:element name="current_setup" type="baci:ROstring" />
<xs:element name="error_code" type="ms:SRTMinorServoErrorType" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="SRTProgramTrackMinorServoType">
<xs:complexContent>
<xs:extension base="SRTBaseMinorServoType">
......@@ -66,7 +75,29 @@
</xs:complexContent>
</xs:complexType>
<xs:complexType name="SRTDerotatorType">
<xs:complexContent>
<xs:extension base="SRTLDOBasePropertiesType">
<xs:sequence>
<xs:element name="tracking" type="mng:BooleanType" />
<xs:element name="trajectory_id" type="baci:ROlong" />
<xs:element name="total_trajectory_points" type="baci:ROlong" />
<xs:element name="remaining_trajectory_points" type="baci:ROlong" />
<xs:element name="actPosition" type="baci:ROdouble" />
<xs:element name="cmdPosition" type="baci:RWdouble" />
<xs:element name="positionDiff" type="baci:ROdouble" />
<xs:element name="status" type="baci:ROpattern" />
</xs:sequence>
<xs:attribute name="status_thread_period" type="xs:double" use="optional" default="0.05" />
<xs:attribute name="step" type="xs:string" use="required" />
<xs:attribute name="tracking_delta" type="xs:string" use="required" />
<xs:attribute name="zero_offset" type="xs:string" use="optional" default="0.0" />
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="SRTGenericMinorServo" type="SRTBaseMinorServoType" />
<xs:element name="SRTProgramTrackMinorServo" type="SRTProgramTrackMinorServoType" />
<xs:element name="SRTDerotator" type="SRTDerotatorType" />
</xs:schema>
......@@ -47,6 +47,8 @@ namespace MinorServo
/**
* It writes values into controller. Unused because all the properties are read-only.
* Derotator update, the cmdPosition is actually a RW property, but the position is never set anywhere by using the DevIO.
* I will keep this implementation that does nothing and the position will be set by the setPosition or programTrack methods.
*/
void write(const T& value, ACS::Time& timestamp)
{
......@@ -237,7 +239,7 @@ namespace MinorServo
* The templates is specialized for the types listed right below and compilation will fail if the developer attempts to use it for an unknown MSDevIO type.
*/
template <typename X, typename Y, typename = std::enable_if<
is_any_v<Y, SRTMinorServoGeneralStatus, SRTMinorServoStatus>
is_any_v<Y, SRTMinorServoGeneralStatus, SRTMinorServoStatus, SRTDerotatorStatus>
&& is_any_v<X,
Management::TBoolean,
CORBA::Double,
......@@ -306,7 +308,7 @@ namespace MinorServo
const std::string m_property_name;
/**
* The reference to the SRTMinorServoAnswerMap in which the readings from the PLC appear. This could be either a SRTMinorServoGeneralStatus or a SRTMinorServoStatus.
* The reference to the SRTMinorServoAnswerMap in which the readings from the PLC appear. This could be either a SRTMinorServoGeneralStatus, a SRTMinorServoStatus or a SRTDerotatorStatus.
*/
const Y& m_map;
......@@ -322,7 +324,14 @@ namespace MinorServo
* The templates is specialized for the combinations of types listed right below and the compilation will fail if the developer attempts to use it with any other types combination.
*/
template <typename C, typename A, typename = std::enable_if_t<
is_any_v<C, Management::TSystemStatus, Management::TBoolean, ACE_CString, CORBA::Long, SRTMinorServoError> || (std::is_same_v<C, ACS::doubleSeq> && std::is_same_v<A, std::vector<double>>)
is_any_v<C,
Management::TSystemStatus,
Management::TBoolean,
ACE_CString,
CORBA::Long,
SRTMinorServoError,
double,
ACS::pattern> || (std::is_same_v<C, ACS::doubleSeq> && std::is_same_v<A, std::vector<double>>)
>>
class MSGenericDevIO : public MSBaseDevIO<C>
{
......
This diff is collapsed.
#ifndef _SRTDEROTATORSTATUSTHREAD_H_
#define _SRTDEROTATORSTATUSTHREAD_H_
/**
* SRTDerotatorStatusThread.h
* Giuseppe Carboni (giuseppe.carboni@inaf.it)
*/
#include "SuppressWarnings.h"
#include <acsThread.h>
#include <ComponentErrors.h>
#include "SRTMinorServoSocket.h"
#include "SRTDerotatorImpl.h"
class SRTDerotatorImpl;
/**
* This class implements a status thread. This thread is in charge of updating the status of the relative derotator component.
*/
class SRTDerotatorStatusThread : public ACS::Thread
{
public:
/**
* Constructor.
* @param name thread name
* @param response_time thread's heartbeat response time in 100ns unit. Default value is 1s.
* @param sleep_time thread's sleep time in 100ns unit. Default value is 100ms.
*/
SRTDerotatorStatusThread(const ACE_CString& name, SRTDerotatorImpl& component, const ACS::TimeInterval& response_time=ThreadBase::defaultResponseTime, const ACS::TimeInterval& sleep_time=ThreadBase::defaultSleepTime);
/**
* Destructor.
*/
~SRTDerotatorStatusThread();
/**
* This method is executed once when the thread starts.
*/
virtual void onStart();
/**
* This method is executed once when the thread stops.
*/
virtual void onStop();
/**
* This method overrides the thread implementation class.
* The thread can be exited by calling ACS::ThreadBase::stop or ACS::ThreadBase::exit command.
*/
virtual void runLoop();
private:
SRTDerotatorImpl& m_component;
/**
* The sleeping time of the thread.
* The thread should be cycling at a constant rate, therefore the inner sleeping time is always updated taking into account this and the thread execution time.
*/
ACS::TimeInterval m_sleep_time;
};
#endif /*_SRTDEROTATORSTATUSTHREAD_H_*/
......@@ -18,12 +18,12 @@ CDB_SCHEMAS = SRTMinorServoCommon SRTMinorServoBoss SRTMinorServo SRTMinorServoS
# ----------------------------
# Libraries (public and local)
# ----------------------------
LIBRARIES = SRTGenericMinorServoImpl SRTProgramTrackMinorServoImpl SRTMinorServoBossImpl
LIBRARIES = SRTGenericMinorServoImpl SRTProgramTrackMinorServoImpl SRTMinorServoBossImpl SRTDerotatorImpl
USER_CFLAGS =
SRTMinorServoBossImpl_OBJECTS = SRTMinorServoBossCore SRTMinorServoSetupThread SRTMinorServoParkThread SRTMinorServoTrackingThread SRTMinorServoScanThread SRTMinorServoBossImpl SRTMinorServoStatusThread
SRTMinorServoBossImpl_LIBS = IRALibrary SRTMinorServoBossStubs SRTMinorServoStubs ComponentErrors MinorServoErrors ManagementErrors MinorServoDefinitionsStubs SRTMinorServoCommandLibrary AntennaBossStubs SRTMinorServoSocketLibrary ParserErrors DiscosVersion acsnc
SRTMinorServoBossImpl_LIBS = IRALibrary SRTMinorServoBossStubs SRTMinorServoStubs SRTDerotatorStubs ComponentErrors MinorServoErrors ManagementErrors MinorServoDefinitionsStubs SRTMinorServoCommandLibrary AntennaBossStubs SRTMinorServoSocketLibrary ParserErrors DiscosVersion acsnc
SRTMinorServoBossImpl_CFLAGS = -std=c++17 -fconcepts
SRTMinorServoBossCore_CFLAGS = -std=c++17 -fconcepts
SRTMinorServoStatusThread_CFLAGS = -std=c++17 -fconcepts
......@@ -39,6 +39,10 @@ SRTGenericMinorServoImpl_CFLAGS = -std=c++17 -fconcepts
SRTProgramTrackMinorServoImpl_OBJECTS = SRTProgramTrackMinorServoImpl SRTBaseMinorServoImpl
SRTProgramTrackMinorServoImpl_LIBS = IRALibrary SRTMinorServoStubs MinorServoErrors MinorServoDefinitionsStubs SRTMinorServoCommandLibrary SRTMinorServoSocketLibrary DiscosVersion
SRTProgramTrackMinorServoImpl_CFLAGS = -std=c++17 -fconcepts
SRTDerotatorImpl_OBJECTS = SRTDerotatorImpl SRTDerotatorStatusThread
SRTDerotatorImpl_LIBS = IRALibrary SRTMinorServoStubs MinorServoDefinitionsStubs SRTMinorServoCommandLibrary SRTMinorServoSocketLibrary GenericDerotatorStubs SRTDerotatorStubs DerotatorErrors DiscosVersion
SRTDerotatorImpl_CFLAGS = -std=c++17 -fconcepts
SRTDerotatorStatusThread_CFLAGS = -std=c++17 -fconcepts
# ----------------------------------------------------------------------
......
This diff is collapsed.
#include "SRTDerotatorStatusThread.h"
using namespace MinorServo;
SRTDerotatorStatusThread::SRTDerotatorStatusThread(const ACE_CString& name, SRTDerotatorImpl& component, const ACS::TimeInterval& response_time, const ACS::TimeInterval& sleep_time) :
ACS::Thread(name, response_time, sleep_time),
m_component(component),
m_sleep_time(this->getSleepTime())
{
AUTO_TRACE("SRTDerotatorStatusThread::SRTDerotatorStatusThread()");
}
SRTDerotatorStatusThread::~SRTDerotatorStatusThread()
{
AUTO_TRACE("SRTDerotatorStatusThread::~SRTDerotatorStatusThread()");
}
void SRTDerotatorStatusThread::onStart()
{
AUTO_TRACE("SRTDerotatorStatusThread::onStart()");
ACS_LOG(LM_FULL_INFO, "SRTDerotatorStatusThread::onStart()", (LM_DEBUG, "STATUS THREAD STARTED"));
}
void SRTDerotatorStatusThread::onStop()
{
AUTO_TRACE("SRTDerotatorStatusThread::onStop()");
ACS_LOG(LM_FULL_INFO, "SRTDerotatorStatusThread::onStop()", (LM_DEBUG, "STATUS THREAD STOPPED"));
}
void SRTDerotatorStatusThread::runLoop()
{
AUTO_TRACE("SRTDerotatorStatusThread::runLoop()");
ACS::Time t0 = getTimeStamp();
unsigned long sleep_time = 10000000;
if(m_component.updateStatus())
{
// Update the sleep time in order to not drift away by adding latency
sleep_time = std::max(m_sleep_time - (getTimeStamp() - t0), (long unsigned int)0);
}
this->setSleepTime(sleep_time);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment