Commit 4c89b9be authored by Andrea Orlat's avatar Andrea Orlat
Browse files

Noto Active Surface Boss

parent 7d15e26b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -269,6 +269,8 @@ private:
	
	bool m_ASup;

	double m_elevation;

	/**
	 * Check if the connection is still up and ready. If a previuos call timed out it will check the status of the connection.
	 * Insted if the connection is off it will try a reconnect. In both case the return value is false.
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@
#include <SP_parser.h>

#define LOOPSTATUSTIME 10000000 // 1.0 second
#define LOOPWORKINGTIME 5000000 // 0.5 seconds
#define LOOPWORKINGTIME 10000000 // 1.0 seconds

#define _SET_CDB(PROP,LVAL,ROUTINE) {	\
	maci::ContainerServices* cs=getContainerServices();\
+2 −2
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ void CConfiguration::init(maci::ContainerServices *Services) throw (ComponentErr
{
	_GET_STRING_ATTRIBUTE("IPAddress","TCP/IP address is: ",m_sAddress);
	_GET_DWORD_ATTRIBUTE("Port","Port is: ",m_wPort);
	_GET_DWORD_ATTRIBUTE("CommandLineTimeout","Time out of the command line is (uSec): ",m_dwCommandLineTimeout);
	/*_GET_DWORD_ATTRIBUTE("CommandLineTimeout","Time out of the command line is (uSec): ",m_dwCommandLineTimeout);
	_GET_DWORD_ATTRIBUTE("ConnectTimeout","Time out of the command line connection  is (uSec): ",m_dwConnectTimeout);
	_GET_DWORD_ATTRIBUTE("PropertyRefreshTime","The property refresh time is (microseconds): ",m_dwPropertyRefreshTime);
	_GET_STRING_ATTRIBUTE("Configuration","Backend configuration is: ",m_sConfig);
@@ -55,6 +55,6 @@ void CConfiguration::init(maci::ContainerServices *Services) throw (ComponentErr
	_GET_DWORD_ATTRIBUTE("ControlSleepTime","The control thread sleep time is (uSec)",m_dwControlSleepTime);
	_GET_DWORD_ATTRIBUTE("ControlResponseTime","The control thread response time is (uSec)",m_dwControlResponseTime);
	_GET_DWORD_ATTRIBUTE("BoardsNumber","The number of installed boards is ",m_dwBoardsNumber);
	_GET_DWORD_ATTRIBUTE("DataBufferSize","Size of data packet is (bytes)",m_dwDataBufferSize);
	_GET_DWORD_ATTRIBUTE("DataBufferSize","Size of data packet is (bytes)",m_dwDataBufferSize);*/
}
+45 −25
Original line number Diff line number Diff line
@@ -5,7 +5,8 @@

int actuatorsInCircle[] = {0,24,24,48,48,48,48,96,96,96,96,96,96,96,96,96,8,4};

CNotoActiveSurfaceBossCore::CNotoActiveSurfaceBossCore(ContainerServices *service) : CSocket()
CNotoActiveSurfaceBossCore::CNotoActiveSurfaceBossCore(ContainerServices *service) : CSocket(),
m_services(service)
{
}

@@ -33,6 +34,7 @@ void CNotoActiveSurfaceBossCore::initialize()
	m_sector8 = false;
	m_profileSetted = false;
	m_ASup = false;
	m_elevation = 0.0;
}

void CNotoActiveSurfaceBossCore::execute(CConfiguration *config) throw (ComponentErrors::CouldntGetComponentExImpl,ComponentErrors::SocketErrorExImpl,
@@ -95,6 +97,7 @@ void CNotoActiveSurfaceBossCore::cleanUp()
			Impl.setComponentName((const char *)m_antennaBoss->name());
			Impl.log(LM_DEBUG);
		}
		Close (m_Error);
}

void CNotoActiveSurfaceBossCore::reset (int circle, int actuator, int radius) throw (ComponentErrors::UnexpectedExImpl, ComponentErrors::CouldntCallOperationExImpl, ComponentErrors::CORBAProblemExImpl, ComponentErrors::ComponentNotActiveExImpl)
@@ -1285,10 +1288,14 @@ void CNotoActiveSurfaceBossCore::sector8ActiveSurface() throw (ComponentErrors::

void CNotoActiveSurfaceBossCore::workingActiveSurface() throw (ComponentErrors::CORBAProblemExImpl, ComponentErrors::ComponentErrorsEx)
{
		char buff[SENDBUFFERSIZE];
		int res;

    	if (AutoUpdate) {
		TIMEVALUE now;
		double azimuth=0.0;
     	double elevation=0.0;
		double diff=0.0;

		IRA::CIRATools::getTime(now);

@@ -1305,8 +1312,17 @@ void CNotoActiveSurfaceBossCore::workingActiveSurface() throw (ComponentErrors::
            			throw impl;
	    		}
        		azimuth = 0.0;
				diff = fabs(m_elevation - elevation*DR2D);
				m_elevation=elevation*DR2D;
        		try {
            			//onewayAction(ActiveSurface::AS_UPDATE, 0, 0, 0, elevation*DR2D, 0, 0, m_profile);
							if ((elevation*DR2D > 5.0) && (elevation*DR2D < 90.0) && (diff > 0.5)) {
								sprintf(buff,"@-%02.0lf\n", elevation*DR2D);
								res = sendBuffer(buff,strlen(buff));
								printf("diff = %f, elevation = %s", diff, buff);
							}
							else
								printf("bad elevation = %lf\n", elevation*DR2D);
        		}
        		catch (ComponentErrors::ComponentErrorsExImpl& ex) {
            			ex.log(LM_DEBUG);
@@ -1401,7 +1417,7 @@ void CNotoActiveSurfaceBossCore::asOn()
{
	//if (m_profileSetted == true ) {
	//	if ((m_profile != ActiveSurface::AS_PARABOLIC_FIXED) && (m_profile != ActiveSurface::AS_SHAPED_FIXED)) {
			enableAutoUpdate();
			enableAutoUpdate(); // as=enable nel FS di Noto
			m_tracking = true;
	//	}
	//	else {
@@ -1422,17 +1438,21 @@ void CNotoActiveSurfaceBossCore::asOn()

void CNotoActiveSurfaceBossCore::asPark() throw (ComponentErrors::ComponentErrorsEx)
{
	char buff[SENDBUFFERSIZE];
	int res;

	//if (m_profileSetted == true ) {
		asOff();
	//	setProfile (ActiveSurface::AS_SHAPED_FIXED);
	//	try {
	//		onewayAction(ActiveSurface::AS_UPDATE, 0, 0, 0, 45.0, 0, 0, m_profile);
	//	}
	//	catch (ComponentErrors::ComponentErrorsExImpl& ex) {
	//		ex.log(LM_DEBUG);
	//		throw ex.getComponentErrorsEx();
	//	}
		m_tracking = false;
		try {
	//		onewayAction(ActiveSurface::AS_STOP, 0, 0, 0, 0, 0, 0, m_profile);
			//send @-45 string to the server
			sprintf(buff,"@-1\n"); // as=stow nel FS di Noto
			res = sendBuffer(buff,4);
		}
		catch (ComponentErrors::ComponentErrorsExImpl& ex) {
			ex.log(LM_DEBUG);
			throw ex.getComponentErrorsEx();
		}
		disableAutoUpdate();
	//}
	//else {
	//	printf("you must set the profile first\n");
@@ -1448,7 +1468,7 @@ void CNotoActiveSurfaceBossCore::asOff() throw (ComponentErrors::ComponentErrors
		try {
	//		onewayAction(ActiveSurface::AS_STOP, 0, 0, 0, 0, 0, 0, m_profile);
			//send @-45 string to the server
			sprintf(buff,"@-45\n");
			sprintf(buff,"@-45\n"); // as=disable nel FS di Noto
			res = sendBuffer(buff,5);
		}
		catch (ComponentErrors::ComponentErrorsExImpl& ex) {
+5 −5

File changed.

Contains only whitespace changes.