Commit e38a2eba authored by Marco Bartolini's avatar Marco Bartolini
Browse files

fixed bugs in scans and offset management of MedicinaMinorServo

parent d94c52b1
Loading
Loading
Loading
Loading
+17 −7
Original line number Diff line number Diff line
@@ -11,7 +11,10 @@ class DevIOTracking: public virtual DevIO<Management::TBoolean>
{
public:
	
	DevIOTracking(MedMinorServoControl_sp control): m_control(control) {
	DevIOTracking(MedMinorServoStatus * status,
                  MedMinorServoControl_sp control): 
                  m_status(status),
                  m_control(control) {
		AUTO_TRACE("DevIOTracking::DevIOTracking()");
	}
	
@@ -26,6 +29,12 @@ public:
	Management::TBoolean read(ACS::Time& timestamp) throw (ACSErr::ACSbaseExImpl) {
		AUTO_TRACE("DevIOTracking::read()");
		timestamp=getTimeStamp();
        if(m_status->scan_active)
            if(m_status->scanning)
                m_val=Management::MNG_TRUE;
            else
                m_val=Management::MNG_FALSE;
        else
            if(m_control)
                if (m_control->is_tracking()) {
                    m_val=Management::MNG_TRUE;
@@ -43,6 +52,7 @@ public:
	}
    
private:
    MedMinorServoStatus * m_status;
	MedMinorServoControl_sp m_control;
	Management::TBoolean m_val;
};
+4 −0
Original line number Diff line number Diff line
@@ -17,11 +17,13 @@
#include <string>
#include <ManagmentDefinitionsS.h>
#include <AntennaBossC.h>
#include <MinorServoErrors.h>

#include "slamac.h" //for DR2D

#include <AntennaProxy.h>

#include "macros.def"
#include "MedMinorServoStatus.hpp"
#include "MedMinorServoControl.hpp"
#include "MedMinorServoOffset.hpp"
@@ -30,6 +32,8 @@
// Sleep Time in 100ns
#define TRACKER_SLEEP_TIME 1000000 // 100 mseconds

using namespace std;

class TrackerThreadParameters
{
    public:
+2 −0
Original line number Diff line number Diff line
@@ -74,6 +74,8 @@ void MSBossTracker::runLoop()
                m_control->set_position(correct_position + offset_position);
                //CUSTOM_LOG(LM_FULL_INFO, "MinorServo::MSBossTracker::runLoop",
                //          (LM_DEBUG, "Correcting position"));
            }catch(const ServoPositionError& spe){
                THROW_MINORSERVO_EX(PositioningErrorEx, spe.what(), true);
            }catch(...){
                CUSTOM_LOG(LM_FULL_INFO, "MinorServo::MSBossTracker::runLoop",
                          (LM_WARNING, "Cannot command offset position"));
+2 −2
Original line number Diff line number Diff line
@@ -21,10 +21,10 @@ MedMinorServoStatus::getStatusString()
{
    if(starting)
        return "STARTING";
    if(scan_active)
        return "SCAN_ACTIVE";
    if(scanning)
        return "SCANNING";
    if(scan_active)
        return "SCAN_ACTIVE";
    if(parking)
        return "PARKING";
    if(parked)
+5 −3
Original line number Diff line number Diff line
@@ -198,7 +198,7 @@ throw (ComponentErrors::MemoryAllocationExImpl)
                getComponent(), new DevIOMotionInfo(&m_servo_status, m_control), true);
        m_tracking = new ROEnumImpl<ACS_ENUM_T(Management::TBoolean), POA_Management::ROTBoolean>\
                  (getContainerServices()->getName()+":tracking",getComponent(), \
                   new DevIOTracking(m_control), true);
                   new DevIOTracking(&m_servo_status, m_control), true);
        m_starting = new ROEnumImpl<ACS_ENUM_T(Management::TBoolean), POA_Management::ROTBoolean>\
                  (getContainerServices()->getName()+":starting",getComponent(), \
                   new DevIOStarting(&m_servo_status), true);
@@ -716,6 +716,7 @@ MinorServoBossImpl::startScanImpl(
    boost::recursive_mutex::scoped_lock lock(_scan_guard);
    m_servo_status.scan_active = true;
    m_servo_status.scanning = false;
    bool was_elevation_tracking = isElevationTracking();
    turnTrackingOff();
    MedMinorServoPosition central_position = 
        m_actual_config->get_position(antenna_parameters.elevation);
@@ -724,7 +725,7 @@ MinorServoBossImpl::startScanImpl(
                           scan_parameters.range,
                           scan_parameters.total_time,
                           std::string(scan_parameters.axis_code), 
                           isElevationTracking());
                           was_elevation_tracking);
    if(!(scan.check()))
    {
        m_servo_status.scan_active = false;
@@ -974,6 +975,8 @@ MinorServoBossImpl::setCorrectPosition()
        THROW_MINORSERVO_EX(CommunicationErrorEx, ste.what(), true);
    }catch(const ServoConnectionError& sce){
        THROW_MINORSERVO_EX(CommunicationErrorEx, sce.what(), true);
    }catch(const ServoPositionError& spe){
        THROW_MINORSERVO_EX(PositioningErrorEx, spe.what(), true);
    }
}

@@ -1133,7 +1136,6 @@ throw (MinorServoErrors::CommunicationErrorExImpl)
        if(m_control)
            m_control->connect();
        else
            //m_control = get_servo_control(m_server_ip);
            m_control.reset(new MedMinorServoControl(m_server_ip));
    }catch(ServoTimeoutError& ste){
        THROW_EX(MinorServoErrors,CommunicationErrorEx, ste.what(), false);