Commit b032153d authored by Andrea Orlat's avatar Andrea Orlat
Browse files

AntennaBoss offset handling modified

parent 1cedf1ef
Loading
Loading
Loading
Loading
+49 −14
Original line number Diff line number Diff line
@@ -208,31 +208,58 @@ module Antenna {
		 * This attribute reports which is the definition of radial velocity of the target
		 */
		 readonly attribute Antenna::ROTVradDefinition vradDefinition;
		/**
		 * This attribute stores the frame of the current offset for the ongoing sub scan
		 */  
		 readonly attribute Antenna::ROTCoordinateFrame subScanOffsetFrame;
		/**
		 * This attribute stores the offset (along then longitude) for the ongoing sub scan. It can be changed by an explicit call to 
		 * <i>setSubScanOffsets()</i> or under the control of the schedule. Both methods override the previous commanded value.  
		 */  		 
		 readonly attribute ACS::ROdouble subScanLonOffset;
		/**
		 * This attribute stores the offset (along then latitude) for the ongoing sub scan. It can be changed by an explicit call to 
		 * <i>setSubScanOffsets()</i> or under the control of the schedule. Both methods override the previous commanded value.  
		 */  		 
		 readonly attribute ACS::ROdouble subScanLatOffset;
		 
		/**
		 * This attribute stores the azimuth system offset.This value is controlled by the method <i>setSystemOffset()</i>
		 */  		 
		 readonly attribute ACS::ROdouble systemAzimuthOffset;

		/**
		 * This attribute stores the elevation system offset.This value is controlled by the method <i>setSystemOffset()</i>
		 */  		 
		 readonly attribute ACS::ROdouble systemElevationOffset; 
			 
		/**
		 * This attribute reports the present user sky offset(radians) commanded for the azimuth. Offset can be reset by calling <i>setup</i> or esplicitly by calling the
		 * <i>setHorizontalOffsets()</i> method. The offset can be laso changed by the <i>startScan()</i> method.
		 */
		readonly attribute ACS::ROdouble azimuthOffset;
		//readonly attribute ACS::ROdouble azimuthOffset;
		/**
		 * This attribute reports the present user offset(radians) commanded for the elevation.
		 */		
		readonly attribute ACS::ROdouble elevationOffset;
		//readonly attribute ACS::ROdouble elevationOffset;
		/**
		 * This attribute reports the present user sky offset(radians) commanded for the rightAscension.
		 */		
		readonly attribute ACS::ROdouble rightAscensionOffset;
		//readonly attribute ACS::ROdouble rightAscensionOffset;
		/**
		 * This attribute reports the present user offset(radians) commanded for the declination.
		 */		
		readonly attribute ACS::ROdouble declinationOffset;
		//readonly attribute ACS::ROdouble declinationOffset;
		/**
		 * This attribute reports the present user sky offset(radians) commanded for the galactic longitude.
		 */		
		readonly attribute ACS::ROdouble longitudeOffset;
		//readonly attribute ACS::ROdouble longitudeOffset;
		/**
		 * This attribute reports the present user offset(radians) commanded for the galactic latitude.
		 */
		readonly attribute ACS::ROdouble latitudeOffset;
		//readonly attribute ACS::ROdouble latitudeOffset;
		
		
		/**
		 * This attribute reports the raw azimuth in radians. Raw coordinates are coordinates with all the correction required as
		 * the pointing model or refraction. The coordinate reported here refers to the current time.
@@ -554,23 +581,31 @@ module Antenna {
		
		/**
		 * This method is used to add user offset to the current pointing of the antenna. The offset will be added in the given frame. 
		 * A call to <i>startScan</i> could overwrite the offset given by this command. In case a new tracking is started (either changing the generator or not) the offsets are not reset.
		 * An offset given for a frame will also cause the offsets relatve to other frames to be cleared.
		 * Depending on the particular generator the offsets could be ignored. In taht case ar error is thrown. The longitude is sky offset so it will be corrected for the cosine of latitude.
		 * The values can be read back from the <i>azimuthOffset</i> , <i>elevationOffset</i>, <i>rightAscensionOffset</i>, <i>declinationOffset</i>, <i>longitudeOffset</i> and <i>latitudeOffset</i> 
		 * attributes accordingly.
		 * A call to <i>startScan</i> could override the offset given by this command (under the control of the schedule). 
		 * In case a new tracking is started (either changing the generator or not) the offsets are not reset.
		 * The longitude is sky offset so it will be corrected for the cosine of latitude.
		 * @throw CORBA::SystemException
		 * @throw AntennaErrors::AntennaErrorsEx 
		 * @throw ComponentErrors::ComponentErrorsEx  
	     *    @arg \c ComponentErrors::UnexpectedEx
	     *    @arg \c ComponentErrors::CORBAProblemEx 
		 * @param lonOff new offset to be added to the azimuth (radians)
		 * @param latOff new offset to be added to the elevation (radians)
		 * @param lonOff new offset to be added to the longitude (radians)
		 * @param latOff new offset to be added to the latitude (radians)
		 * @param frame frame the offesets refer to
		 */
		void setOffsets(in double lonOff,in double latOff,in TCoordinateFrame frame) raises (ComponentErrors::ComponentErrorsEx,
		void setSubScanOffsets(in TCoordinateFrame frame,in double lonOff,in double latOff) raises (ComponentErrors::ComponentErrorsEx,
				AntennaErrors::AntennaErrorsEx);
				
		/**
		 * This method allows to set the "fine-tuning" pointing offsets.
		 * @throw CORBA::SystemException
		 * @throw AntennaErrors::AntennaErrorsEx 
		 * @throw ComponentErrors::ComponentErrorsEx  
		 * @param azimuth azimuth correction (radians)
		 * @param elevation elevation correction (radians)
		*/		
		void setSystemOffsets(in double azimuth,in double elevation) raises (ComponentErrors::ComponentErrorsEx,AntennaErrors::AntennaErrorsEx);		
		
		/**
		 * This method can be used by clients in order to get a reference to the generator currently in use within the boss.
		 * @throw CORBA::SystemException 
+6 −7
Original line number Diff line number Diff line
@@ -31,12 +31,11 @@
			<xs:element name="vradReferenceFrame" type="ant:ReferenceFrameType"/>
			<xs:element name="vradDefinition" type="ant:VradDefinitionType"/>
			<xs:element name="targetFlux" type="baci:ROdouble"/>	
			<xs:element name="azimuthOffset" type="baci:ROdouble"/>
			<xs:element name="elevationOffset" type="baci:ROdouble"/>
			<xs:element name="rightAscensionOffset" type="baci:ROdouble"/>
			<xs:element name="declinationOffset" type="baci:ROdouble"/>
			<xs:element name="longitudeOffset" type="baci:ROdouble"/>
			<xs:element name="latitudeOffset" type="baci:ROdouble"/>
			<xs:element name="subScanLonOffset" type="baci:ROdouble"/>
			<xs:element name="subScanLatOffset" type="baci:ROdouble"/>	
			<xs:element name="subScanOffsetFrame" type="ant:CoordinateFrameType"/>
			<xs:element name="systemAzimuthOffset" type="baci:ROdouble"/>	
			<xs:element name="systemElevationOffset" type="baci:ROdouble"/>	
			<xs:element name="rawAzimuth" type="baci:ROdouble"/>
			<xs:element name="rawElevation" type="baci:ROdouble"/>
			<xs:element name="observedAzimuth" type="baci:ROdouble"/>
+56 −17
Original line number Diff line number Diff line
@@ -282,40 +282,58 @@ public:
	virtual ACS::ROdouble_ptr refractionCorrection() throw (CORBA::SystemException);
	
	/**
     * Returns a reference to the azimuthOffset property implementation of IDL interface.
	 * @return pointer to read-only double property azimuthOffset
     * Returns a reference to the subScanOffsetFrame property implementation of IDL interface.
	 * @return pointer to read-only TCoordinateFrame property subScanOffsetFrame
	*/	
	virtual ACS::ROdouble_ptr azimuthOffset() throw (CORBA::SystemException);
	virtual Antenna::ROTCoordinateFrame_ptr subScanOffsetFrame() throw (CORBA::SystemException);

	/**
     * Returns a reference to the elevationOffset property implementation of IDL interface.
	 * @return pointer to read-only double property elevationOffset
     * Returns a reference to the systemAzimuthOffset property implementation of IDL interface.
	 * @return pointer to read-only double property systemAzimuthOffset
	*/	
	virtual ACS::ROdouble_ptr elevationOffset() throw (CORBA::SystemException);
	virtual ACS::ROdouble_ptr systemAzimuthOffset() throw (CORBA::SystemException);
	
	/**
     * Returns a reference to the systemElevationOffset property implementation of IDL interface.
	 * @return pointer to read-only double property systemElevationOffset
	*/	
	virtual ACS::ROdouble_ptr systemElevationOffset() throw (CORBA::SystemException);
	
	/**
     * Returns a reference to the subScanLonOffset property implementation of IDL interface.
	 * @return pointer to read-only double property subScanLonOffset
	*/	
	virtual ACS::ROdouble_ptr subScanLonOffset() throw (CORBA::SystemException);
	
	/**
     * Returns a reference to the subScanLatOffset property implementation of IDL interface.
	 * @return pointer to read-only double property subScanLatOffset
	*/	
	virtual ACS::ROdouble_ptr subScanLatOffset() throw (CORBA::SystemException);
	
	/**
     * Returns a reference to the rightAscensionOffset property implementation of IDL interface.
	 * @return pointer to read-only double property rightAscensionOffset
	*/	
	virtual ACS::ROdouble_ptr rightAscensionOffset() throw (CORBA::SystemException);
	//virtual ACS::ROdouble_ptr rightAscensionOffset() throw (CORBA::SystemException);

	/**
     * Returns a reference to the declinationOffset property implementation of IDL interface.
	 * @return pointer to read-only double property declinationOffset
	*/	
	virtual ACS::ROdouble_ptr declinationOffset() throw (CORBA::SystemException);
	//virtual ACS::ROdouble_ptr declinationOffset() throw (CORBA::SystemException);

	/**
     * Returns a reference to the longitudeOffset property implementation of IDL interface.
	 * @return pointer to read-only double property longitudeOffset
	*/	
	virtual ACS::ROdouble_ptr longitudeOffset() throw (CORBA::SystemException);
	//virtual ACS::ROdouble_ptr longitudeOffset() throw (CORBA::SystemException);

	/**
     * Returns a reference to the latitudeOffset property implementation of IDL interface.
	 * @return pointer to read-only double property latitudeOffset
	*/	
	virtual ACS::ROdouble_ptr latitudeOffset() throw (CORBA::SystemException);
	//virtual ACS::ROdouble_ptr latitudeOffset() throw (CORBA::SystemException);

	/**
     * Returns a reference to the FWHM property implementation of IDL interface.
@@ -543,7 +561,7 @@ public:
	//virtual char * command(const char *cmd) throw (CORBA::SystemException,ManagementErrors::CommandLineErrorEx);
	
	/**
	 * This method allows the user to set the offsets for the given frame. The offset are considered only if a tracking has already
	 * This method allows the user to set the sub scan offsets for the given frame. The offset are considered only if a tracking has already
	 * been started, otherwise they are stored for next scan.  
	 * The longitude offset will be corrected for the cosine of latitude.
	 * @param lonOff new offsets for azimuth (radians)
@@ -555,7 +573,21 @@ public:
	 *    @arg  \c ComponentErrors::UnexpectedExImp
	 *    @arg  \c ComponentErrors::CORBAProblemExImpl 
	*/
	virtual void setOffsets(CORBA::Double lonOff,CORBA::Double latOff,Antenna::TCoordinateFrame frame) throw (CORBA::SystemException,ComponentErrors::ComponentErrorsEx,AntennaErrors::AntennaErrorsEx);
	virtual void setSubScanOffsets(Antenna::TCoordinateFrame frame,CORBA::Double lonOff,CORBA::Double latOff) throw (CORBA::SystemException,ComponentErrors::ComponentErrorsEx,AntennaErrors::AntennaErrorsEx);
	
	/**
	 * This method allows to set system offsets for the horizontal frame. 
	 * The azimuth offset will be corrected for the cosine of latitude.
	 * @param lonOff new offsets for azimuth (radians)
	 * @param latOff new offsets for elevation (radians)
	 * @param frame reference frame
	 * @throw CORBA::SystemException
	 * @throw AntennaErrors::AntennaErrorsEx 
     * @throw ComponentErrors::ComponentErrorsEx
	 *    @arg  \c ComponentErrors::UnexpectedExImp
	 *    @arg  \c ComponentErrors::CORBAProblemExImpl 
	*/
	virtual void setSystemOffsets(CORBA::Double az, CORBA::Double el) throw (CORBA::SystemException,ComponentErrors::ComponentErrorsEx,AntennaErrors::AntennaErrorsEx);
	
	/**
	 * This function is used internally. It permits to access the generator currently used by the boss in order to produce new coordinates.
@@ -667,12 +699,19 @@ private:
	SmartPropertyPointer<ROdouble> m_ptargetVrad;
	SmartPropertyPointer< ROEnumImpl<ACS_ENUM_T(Antenna::TReferenceFrame), POA_Antenna::ROTReferenceFrame> > m_pvradReferenceFrame;
	SmartPropertyPointer< ROEnumImpl<ACS_ENUM_T(Antenna::TVradDefinition), POA_Antenna::ROTVradDefinition> > m_pvradDefinition;
	SmartPropertyPointer<ROdouble> m_pazimuthOffset;
	/*SmartPropertyPointer<ROdouble> m_pazimuthOffset;
	SmartPropertyPointer<ROdouble> m_pelevationOffset;
	SmartPropertyPointer<ROdouble> m_prightAscensionOffset;
	SmartPropertyPointer<ROdouble> m_pdeclinationOffset;
	SmartPropertyPointer<ROdouble> m_plongitudeOffset;
	SmartPropertyPointer<ROdouble> m_platitudeOffset;
	SmartPropertyPointer<ROdouble> m_platitudeOffset;*/

	SmartPropertyPointer< ROEnumImpl<ACS_ENUM_T(Antenna::TCoordinateFrame), POA_Antenna::ROTCoordinateFrame> > m_psubScanOffsetFrame;
	SmartPropertyPointer<ROdouble> m_psubScanLonOffset;
	SmartPropertyPointer<ROdouble> m_psubScanLatOffset;	
	SmartPropertyPointer<ROdouble> m_psystemAzimuthOffset;
	SmartPropertyPointer<ROdouble> m_psystemElevationOffset;
	
	IRA::CSecureArea<CBossCore> *m_core;
	CWorkingThread *m_workingThread;
	CWatchingThread *m_watchingThread;
+52 −16
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
#include "Callback.h"
#include "SlewCheck.h"
#include <FrequencyTracking.h>
#include "Offset.h"

using namespace IRA;
using namespace maci;
@@ -474,41 +475,71 @@ public:
	*/ 
	inline double getRefractionOffset() const { return m_refractionOffset; }
	
	/**
	 * This function returns the value of the current lon offset for next sub scan 
	 * @return the requested offset in radians
	*/ 
	inline double getSubScanLonOff() const { return (m_offsets.isScanSet())?m_offsets.getScanOffset().lon:0.0; }

	/**
	 * This function returns the value of the current lat offset for next sub scan 
	 * @return the requested offset in radians
	*/ 
	inline double getSubScanLatOff() const { return (m_offsets.isScanSet())?m_offsets.getScanOffset().lat:0.0; }
	
	/**
	 * This function returns the value of the current sub scan offset frame 
	 * @return the requested offset in radians
	*/ 
	inline Antenna::TCoordinateFrame getSubScanOffFrame() const { return (m_offsets.isScanSet())?m_offsets.getScanOffset().frame:Antenna::ANT_HORIZONTAL; }
	
	/**
	 * This function returns the value of the current system azimuth offset. 
	 * @return the requested offset in radians
	*/ 
	inline double getSystemAzOff() const { return (m_offsets.isSystemSet())?m_offsets.getSystemAzimuth():0.0; }
	
	/**
	 * This function returns the value of the current system elevation offset.
	 * @return the requested offset in radians
	*/ 
	inline double getSystemElOff() const { return (m_offsets.isScanSet())?m_offsets.getSystemElevation():0.0; }
		
	/**
	 * This function returns the value of the current azimuth offset, 
	 * @return the azimuth offset in radians
	*/ 
	inline double getAzimuthOffset() const { return (m_offsetFrame==Antenna::ANT_HORIZONTAL)?m_longitudeOffset:0.0; }
	//inline double getAzimuthOffset() const { return (m_offsetFrame==Antenna::ANT_HORIZONTAL)?m_longitudeOffset:0.0; }

	/**
	 * This function returns the value of the current elevation offset, 
	 * @return the elevation offset in radians
	*/ 
	inline double getElevationOffset() const { return (m_offsetFrame==Antenna::ANT_HORIZONTAL)?m_latitudeOffset:0.0; }
	//inline double getElevationOffset() const { return (m_offsetFrame==Antenna::ANT_HORIZONTAL)?m_latitudeOffset:0.0; }
	
	/**
	 * This function returns the value of the current rightAscension offset, 
	 * @return the rightAscension offset in radians
	*/ 
	inline double getRightAscensionOffset() const { return (m_offsetFrame==Antenna::ANT_EQUATORIAL)?m_longitudeOffset:0.0; }
	//inline double getRightAscensionOffset() const { return (m_offsetFrame==Antenna::ANT_EQUATORIAL)?m_longitudeOffset:0.0; }
	
	/**
	 * This function returns the value of the current declination offset, 
	 * @return the declination offset in radians
	*/ 
	inline double getDeclinationOffset() const { return (m_offsetFrame==Antenna::ANT_EQUATORIAL)?m_latitudeOffset:0.0; }
	//inline double getDeclinationOffset() const { return (m_offsetFrame==Antenna::ANT_EQUATORIAL)?m_latitudeOffset:0.0; }
	
	/**
	 * This function returns the value of the current longitude offset, 
	 * @return the longitude offset in radians
	*/ 
	inline double getLongitudeOffset() const { return (m_offsetFrame==Antenna::ANT_GALACTIC)?m_longitudeOffset:0.0; }
	//inline double getLongitudeOffset() const { return (m_offsetFrame==Antenna::ANT_GALACTIC)?m_longitudeOffset:0.0; }

	/**
	 * This function returns the value of the current latitude offset, 
	 * @return the latitude offset in radians
	*/ 
	inline double getLatitudeOffset() const { return (m_offsetFrame==Antenna::ANT_GALACTIC)?m_latitudeOffset:0.0; }
	//inline double getLatitudeOffset() const { return (m_offsetFrame==Antenna::ANT_GALACTIC)?m_latitudeOffset:0.0; }
	
	/**
	 * This functions returns the name of the current target, if it exists.
@@ -580,7 +611,7 @@ public:


private:
	class TOffset {
	/*class TOffset {
	public:
		TOffset() : lon(0.0), lat(0.0), frame(Antenna::ANT_HORIZONTAL) { };
		TOffset(const double& ln,const double& lt,const Antenna::TCoordinateFrame& fr): lon(ln), lat(lt), frame(fr) { };
@@ -589,7 +620,7 @@ private:
		double lon;
		double lat;
		Antenna::TCoordinateFrame frame;
	} ;
	};*/
	
	/**
	 * Stores the sequence of observed horizontal,equatorial and galactic coorddintes, sorted by the time of observation
@@ -660,13 +691,17 @@ private:
	double m_refractionOffset;
	
	/** The resulting offset*/
	double m_longitudeOffset;
	double m_latitudeOffset;
	Antenna::TCoordinateFrame m_offsetFrame;
	//double m_longitudeOffset;
	//double m_latitudeOffset;
	//Antenna::TCoordinateFrame m_offsetFrame;
	/** The offset coming from the current scan */
	TOffset m_scanOffset;
	//TOffset m_scanOffset;
	/** The offset coming from the user input */
	TOffset m_userOffset;
	//TOffset m_userOffset;
	
	/**
	 * This object stores and manage all the offset supported by the component */
	COffset m_offsets;
	
	/**
	 * This field  reports the type of the current generator
@@ -1023,6 +1058,7 @@ private:
	 * @param lon output parameter galactic longitude,radians 
	 * @param lat output parameter galactic latitude, radians
	 * @param vrad output radial velocity of the target, in Km/s
	 * @param offset handling object
	 * @param velFrame reference frame of the radial velocity
	 * @param velDef definition of the radial velocity
	 * @param timeToStop expected time the scan is expected to be completed, zero means no need to wait
@@ -1033,8 +1069,8 @@ private:
	 * @return the reference of the current generator, the caller must free it
	 */
	Antenna::EphemGenerator_ptr prepareScan(bool useInternals,ACS::Time& startUT,const Antenna::TTrackingParameters& _prim,const Antenna::TTrackingParameters& _sec,
			const TOffset& userOffset,Antenna::TGeneratorType& generatorType,Antenna::TTrackingParameters& lastPar,Antenna::TSections& section,double& ra,double& dec,double& lon,
			double& lat,double& vrad,Antenna::TReferenceFrame& velFrame,Antenna::TVradDefinition& velDef,ACS::Time& timeToStop,IRA::CString& sourceName,TOffset& scanOffset,
			/*const TOffset& userOffset,*/Antenna::TGeneratorType& generatorType,Antenna::TTrackingParameters& lastPar,Antenna::TSections& section,double& ra,double& dec,double& lon,
			double& lat,double& vrad,COffset& offset,Antenna::TReferenceFrame& velFrame,Antenna::TVradDefinition& velDef,ACS::Time& timeToStop,IRA::CString& sourceName,/*TOffset& scanOffset,*/
			Management::TScanAxis& axis,Antenna::EphemGenerator_out generatorFlux) throw (ComponentErrors::CouldntCallOperationExImpl,ComponentErrors::UnexpectedExImpl,
					ComponentErrors::CORBAProblemExImpl,AntennaErrors::ScanErrorExImpl,AntennaErrors::SecondaryScanErrorExImpl,AntennaErrors::MissingTargetExImpl,AntennaErrors::LoadGeneratorErrorExImpl);
	
@@ -1062,7 +1098,7 @@ private:
	 */
	void computeFlux();

	void addOffsets(double &lon,double& lat,Antenna::TCoordinateFrame& frame,const TOffset& userOffset,const TOffset& scanOffset) const;
	/*void addOffsets(double &lon,double& lat,Antenna::TCoordinateFrame& frame,const TOffset& userOffset,const TOffset& scanOffset) const;*/
	
	void copyTrack(Antenna::TTrackingParameters& dest,const Antenna::TTrackingParameters& source,bool copyOffs=true) const;

+54 −0
Original line number Diff line number Diff line
#ifndef DEVIOOFFFRAME_H_
#define DEVIOOFFFRAME_H_


/* ************************************************************************************************************* */
/* IRA Istituto di Radioastronomia                                                                               */
/*                                                                                                               */
/* This code is under GNU General Public Licence (GPL).                                                          */
/*                                                                                                               */
/* Who                                                  When                       What                                                       */
/* Andrea Orlati(aorlati@ira.inaf.it)  14/04/2014      Creation                                                  */

#include <baciDevIO.h>

/**
 * This  class is derived from the template DevIO. It is used by the VradReferenceFrame property.
 * @author <a href=mailto:a.orlati@ira.inaf.it>Andrea Orlati</a>,
 * Istituto di Radioastronomia, Italia<br>
 */
class DevIOOffFrame: public virtual DevIO<Antenna::TCoordinateFrame>
{

public:

	DevIOOffFrame(IRA::CSecureArea<CBossCore>* core): m_core(core) {
		AUTO_TRACE("DevIOOffFrame::DevIOOffFrame()");
	}

	~DevIOOffFrame() {
		AUTO_TRACE("DevIOOffFrame::~DevIOOffFrame()");
	}

	bool initializeValue(){
		return false;
	}

	Antenna::TCoordinateFrame read(ACS::Time& timestamp) throw (ACSErr::ACSbaseExImpl) {
		CSecAreaResourceWrapper<CBossCore> resource=m_core->Get();
		AUTO_TRACE("DevIOOffFrame::read()");
		timestamp=getTimeStamp();
		return resource->getSubScanOffFrame();
    }

    void write(const CORBA::Long& value, ACS::Time& timestamp) throw (ACSErr::ACSbaseExImpl) {
    	AUTO_TRACE("DevIOOffFrame::write()");
	}

private:
	IRA::CSecureArea<CBossCore> *m_core;

};


#endif /*DEVIOOFFFRAME_H_*/
Loading