Commit a20c84b1 authored by Marco Buttu's avatar Marco Buttu
Browse files

PFP encoder power off and on.

The MinorServoBoss configuration takes a new action, power_off_encoder.
In that case, a the end of the setup the servo will be disabled and its
encoder powered off. The encoder will be enabled right before the setup.
parent 2be27a42
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -449,6 +449,17 @@ module MinorServo {
         boolean isInEmergencyStop();
 
       
       /** Power on the servo encoder */
         void powerOnEncoder();


       /** Power off the servo encoder (to cut RFIs) */
         void powerOffEncoder();


       /** Is the encoder power on */
        // boolean isPowerOnEncoder();
 

        /**
         * Accomplish a WPServo setup at some time.
+18 −1
Original line number Diff line number Diff line
@@ -19,23 +19,40 @@ __author__ = "Marco Buttu <mbuttu@oa-cagliari.inaf.it>"
class TestServoSetupCmd(unittest2.TestCase):
    """Test the servoSetup command"""

    telescope = os.getenv('TARGETSYS')

    def setUp(self):
        self.telescope = os.getenv('TARGETSYS')
        self.client = PySimpleClient()
        self.boss = self.client.getComponent('MINORSERVO/Boss')
        self.setup_code = "CCB" if self.telescope == "SRT" else "CCC"

    def tearDown(self):
        self.boss.park()
        time.sleep(0.2)
        self.wait_parked()
        self.client.releaseComponent('MINORSERVO/Boss')

    def test_wrong_code(self):
        success, answer = self.boss.command('servoSetup=FOO')
        self.assertFalse(success)
        time.sleep(0.2)
        if self.boss.isStarting():
            self.wait_ready()

    def test_right_code(self):
        success, answer = self.boss.command('servoSetup=' + self.setup_code)
        self.assertTrue(success)
        time.sleep(0.2)
        if self.boss.isStarting():
            self.wait_ready()

    def wait_ready(self):
        while not self.boss.isReady():
            time.sleep(0.1)

    def wait_parked(self):
        while self.boss.isParking():
            time.sleep(0.1)

if __name__ == '__main__':
    if 'Configuration' in os.getenv('ACS_CDB'):
+7 −3
Original line number Diff line number Diff line
@@ -20,9 +20,14 @@ __author__ = "Marco Buttu <mbuttu@oa-cagliari.inaf.it>"
class TestSetServoASConfigurationCmd(unittest2.TestCase):
    """Test the setServoASConfiguration command"""

    telescope = os.getenv('TARGETSYS')

    def setUp(self):
        client = PySimpleClient()
        self.boss = client.getComponent('MINORSERVO/Boss')
        self.client = PySimpleClient()
        self.boss = self.client.getComponent('MINORSERVO/Boss')

    def tearDown(self):
        self.client.releaseComponent('MINORSERVO/Boss')

    def test_wrong_axis_code(self):
        success, answer = self.boss.command('setServoASConfiguration=FOO')
@@ -32,7 +37,6 @@ class TestSetServoASConfigurationCmd(unittest2.TestCase):
        success, answer = self.boss.command('setServoASConfiguration=on')
        self.assertTrue(success)


if __name__ == '__main__':
    if 'Configuration' in os.getenv('ACS_CDB'):
        unittest2.main() # Real test using the antenna CDB
+7 −2
Original line number Diff line number Diff line
@@ -19,9 +19,14 @@ __author__ = "Marco Buttu <mbuttu@oa-cagliari.inaf.it>"
class TestSetServoElevationTrackingCmd(unittest2.TestCase):
    """Test the setServoElevationTracking command"""

    telescope = os.getenv('TARGETSYS')

    def setUp(self):
        client = PySimpleClient()
        self.boss = client.getComponent('MINORSERVO/Boss')
        self.client = PySimpleClient()
        self.boss = self.client.getComponent('MINORSERVO/Boss')

    def tearDown(self):
        self.client.releaseComponent('MINORSERVO/Boss')

    def test_wrong_flag(self):
        success, answer = self.boss.command('setServoElevationTracking=FOO')
+9 −2
Original line number Diff line number Diff line
from __future__ import with_statement

import os
import math
import time
import unittest2
@@ -18,9 +19,15 @@ __author__ = "Marco Buttu <mbuttu@oa-cagliari.inaf.it>"
class TestSetServoOffsetCmd(unittest2.TestCase):
    """Test the setServoOffset command"""

    telescope = os.getenv('TARGETSYS')

    def setUp(self):
        client = PySimpleClient()
        self.boss = client.getComponent('MINORSERVO/Boss')
        self.client = PySimpleClient()
        self.boss = self.client.getComponent('MINORSERVO/Boss')

    def tearDown(self):
        self.boss.park()
        self.client.releaseComponent('MINORSERVO/Boss')

    def test_wrong_axis_code(self):
        success, answer = self.boss.command('setServoOffset=FOO_TX,0')
Loading