Loading Common/Simulators/Components/PyPositioner/config/CDB/schemas/Positioner.xsd 0 → 100644 +33 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="ISO-8859-1"?> <!-- Marco Buttu, marco.buttu@inaf.it --> <xs:schema targetNamespace="urn:schemas-cosylab-com:Positioner:1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="urn:schemas-cosylab-com:Positioner:1.0" xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:import namespace="urn:schemas-cosylab-com:CDB:1.0" schemaLocation="CDB.xsd" /> <xs:import namespace="urn:schemas-cosylab-com:BACI:1.0" schemaLocation="BACI.xsd" /> <xs:complexType name="PositionerType"> <xs:complexContent> <xs:extension base="baci:CharacteristicComponent"> <xs:sequence> <xs:element name="status" type="baci:ROpattern" /> <xs:element name="position" type="baci:ROdouble" /> <xs:element name="current" type="baci:ROdouble" /> <xs:element name="seq" type="baci:ROdoubleSeq" /> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> <xs:element name="Positioner" type="PositionerType"/> </xs:schema> Common/Simulators/Components/PyPositioner/idl/ComponentErrors.xml 0 → 100755 +19 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="ISO-8859-1"?> <Type xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="Alma/ACSError" xsi:schemaLocation="Alma/ACSError ACSError.xsd" name="ComponentErrors" type="2001" _prefix="alma"> <Code name="NoError" shortDescription="No error" description="No error condition found"/> <ErrorCode name="NotAllowed" shortDescription="Operation not allowed" description="Operation not allowed in this configuration"> <Member name="Reason" type="string" description="Reason" /> </ErrorCode> </Type> Common/Simulators/Components/PyPositioner/idl/TestNamespaceInterface.idl 0 → 100755 +58 −0 Original line number Diff line number Diff line /*************************************************\ * Author: Marco Buttu <marco.buttu@inaf.it> \*************************************************/ #ifndef __TESTNAMESPACE_INTERFACE__IDL__ #define __TESTNAMESPACE_INTERFACE__IDL__ #include <baci.idl> #include <ComponentErrors.idl> #pragma prefix "alma" module TestNamespaceInterface { struct PositionerDataBlock { boolean ready; }; const string POSITIONER_DATA_CHANNEL = "PositionerData"; interface Positioner: ACS::CharacteristicComponent { /** Set the position */ void setPosition(in double position) raises (ComponentErrors::ComponentErrorsEx); /** Return the actual position */ double getPosition(); /** Set a dummy sequence */ void setSequence(in ACS::doubleSeq seq); /** Return a dummy sequence */ ACS::doubleSeq getSequence(); /** This property reports the status (4 bits pattern) of the Positioner. */ readonly attribute ACS::ROpattern status; /** This property reports the position of the Positioner. */ readonly attribute ACS::ROdouble position; /** This property reports the current of the Positioner engine. */ readonly attribute ACS::ROdouble current; /** A dummy sequence */ readonly attribute ACS::ROdoubleSeq seq; }; }; #endif Common/Simulators/Components/PyPositioner/src/Makefile 0 → 100755 +86 −0 Original line number Diff line number Diff line #***************************************************************** # Positioner Makefile # =================== # A Component to be used for testing purpose # Marco Buttu <marco.buttu@inaf.it> #***************************************************************** ACSERRDEF= ComponentErrors ERRXMLFILE= ../idl/ComponentErrors.xml # Interface # ---------------------------- CDB_SCHEMAS = Positioner IDL_FILES = TestNamespaceInterface TestNamespaceInterfaceStubs_LIBS = baciStubs acscomponentStubs ACSErrTypeCommon \ ComponentErrors # Python directives PY_PACKAGES = Positioner # Documentation MAKE_PDF = ON # List of all possible C-sources (used to create automatic dependencies) CSOURCENAMES = \ $(foreach exe, $(EXECUTABLES) $(EXECUTABLES_L), $($(exe)_OBJECTS)) \ $(foreach rtos, $(RTAI_MODULES) , $($(rtos)_OBJECTS)) \ $(foreach lib, $(LIBRARIES) $(LIBRARIES_L), $($(lib)_OBJECTS)) TMP := $(shell searchFile /tmp/tmp.txt) ifeq ($(TMP),\#error\#) PERM:=$(shell stat --format=%a $(ERRXMLFILE)) else PERM=$(shell cat /tmp/tmp.txt) endif # Include standards MAKEDIRTMP := $(shell searchFile include/acsMakefile) ifneq ($(MAKEDIRTMP),\#error\#) MAKEDIR := $(MAKEDIRTMP)/include include $(MAKEDIR)/acsMakefile endif # TARGETS all: do_all @echo " . . . 'all' done" clean : clean_all # Clear INTROOT interface $(RM) $(INTROOT)/lib/python/site-packages/TestNamespace* # Clear INTROOT Impl $(RM) $(INTROOT)/lib/python/site-packages/Positioner* $(RM) $(INTROOT)/lib/python/site-packages/libPositionerStubs.* # Clear local lib $(RM) *~ *Impl/*~ Positioner/*.pyc $(RM) ../bin/ $(RM) ../include/ $(RM) ../lib/ $(RM) ../object/ $(RM) ../rtai/ @echo " . . . clean done" clean_dist : clean_all clean_dist_all @echo " . . . clean_dist done" man : do_man @echo " . . . man page(s) done" install : xmlpatch_pre install_all @chmod $(PERM) $(ERRXMLFILE) @echo "Patch applied" @rm -rf /tmp/tmp.txt @echo " . . . installation done" @echo " . . . installation done" xmlpatch_pre : @echo "File permissions: " $(PERM) @chmod a+w $(ERRXMLFILE) @echo $(PERM) > /tmp/tmp.txt Common/Simulators/Components/PyPositioner/src/Positioner/PositionerImpl.py 0 → 100755 +46 −0 Original line number Diff line number Diff line from __future__ import print_function import time from Acspy.Servants.CharacteristicComponent import CharacteristicComponent as cc from Acspy.Servants.ContainerServices import ContainerServices as services from Acspy.Servants.ComponentLifecycle import ComponentLifecycle as lcycle from Acspy.Util.BaciHelper import addProperty from Acspy.Common.Log import getLogger from TestNamespaceInterface__POA import Positioner as POA from Positioner.devios import GenericDevIO, PositionDevIO, SequenceDevIO __copyright__ = "Marco Buttu <marco.buttu@inaf.it>" logger = getLogger() class PositionerImpl(POA, cc, services, lcycle): def __init__(self): cc.__init__(self) services.__init__(self) self.position = 0 self.sequence = (1.1, 2.2, 3.3) def initialize(self): addProperty(self, 'status', devio_ref=GenericDevIO()) addProperty(self, 'position', devio_ref=PositionDevIO(self)) addProperty(self, 'current', devio_ref=GenericDevIO()) addProperty(self, 'seq', devio_ref=SequenceDevIO(self)) print('Component initialized') def setPosition(self, position): print('Setting the position to ', position) self.position = position def getPosition(self): return self.position def setSequence(self, sequence): self.sequence = sequence def getSequence(self): return self.sequence Loading
Common/Simulators/Components/PyPositioner/config/CDB/schemas/Positioner.xsd 0 → 100644 +33 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="ISO-8859-1"?> <!-- Marco Buttu, marco.buttu@inaf.it --> <xs:schema targetNamespace="urn:schemas-cosylab-com:Positioner:1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="urn:schemas-cosylab-com:Positioner:1.0" xmlns:cdb="urn:schemas-cosylab-com:CDB:1.0" xmlns:baci="urn:schemas-cosylab-com:BACI:1.0" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:import namespace="urn:schemas-cosylab-com:CDB:1.0" schemaLocation="CDB.xsd" /> <xs:import namespace="urn:schemas-cosylab-com:BACI:1.0" schemaLocation="BACI.xsd" /> <xs:complexType name="PositionerType"> <xs:complexContent> <xs:extension base="baci:CharacteristicComponent"> <xs:sequence> <xs:element name="status" type="baci:ROpattern" /> <xs:element name="position" type="baci:ROdouble" /> <xs:element name="current" type="baci:ROdouble" /> <xs:element name="seq" type="baci:ROdoubleSeq" /> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> <xs:element name="Positioner" type="PositionerType"/> </xs:schema>
Common/Simulators/Components/PyPositioner/idl/ComponentErrors.xml 0 → 100755 +19 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="ISO-8859-1"?> <Type xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="Alma/ACSError" xsi:schemaLocation="Alma/ACSError ACSError.xsd" name="ComponentErrors" type="2001" _prefix="alma"> <Code name="NoError" shortDescription="No error" description="No error condition found"/> <ErrorCode name="NotAllowed" shortDescription="Operation not allowed" description="Operation not allowed in this configuration"> <Member name="Reason" type="string" description="Reason" /> </ErrorCode> </Type>
Common/Simulators/Components/PyPositioner/idl/TestNamespaceInterface.idl 0 → 100755 +58 −0 Original line number Diff line number Diff line /*************************************************\ * Author: Marco Buttu <marco.buttu@inaf.it> \*************************************************/ #ifndef __TESTNAMESPACE_INTERFACE__IDL__ #define __TESTNAMESPACE_INTERFACE__IDL__ #include <baci.idl> #include <ComponentErrors.idl> #pragma prefix "alma" module TestNamespaceInterface { struct PositionerDataBlock { boolean ready; }; const string POSITIONER_DATA_CHANNEL = "PositionerData"; interface Positioner: ACS::CharacteristicComponent { /** Set the position */ void setPosition(in double position) raises (ComponentErrors::ComponentErrorsEx); /** Return the actual position */ double getPosition(); /** Set a dummy sequence */ void setSequence(in ACS::doubleSeq seq); /** Return a dummy sequence */ ACS::doubleSeq getSequence(); /** This property reports the status (4 bits pattern) of the Positioner. */ readonly attribute ACS::ROpattern status; /** This property reports the position of the Positioner. */ readonly attribute ACS::ROdouble position; /** This property reports the current of the Positioner engine. */ readonly attribute ACS::ROdouble current; /** A dummy sequence */ readonly attribute ACS::ROdoubleSeq seq; }; }; #endif
Common/Simulators/Components/PyPositioner/src/Makefile 0 → 100755 +86 −0 Original line number Diff line number Diff line #***************************************************************** # Positioner Makefile # =================== # A Component to be used for testing purpose # Marco Buttu <marco.buttu@inaf.it> #***************************************************************** ACSERRDEF= ComponentErrors ERRXMLFILE= ../idl/ComponentErrors.xml # Interface # ---------------------------- CDB_SCHEMAS = Positioner IDL_FILES = TestNamespaceInterface TestNamespaceInterfaceStubs_LIBS = baciStubs acscomponentStubs ACSErrTypeCommon \ ComponentErrors # Python directives PY_PACKAGES = Positioner # Documentation MAKE_PDF = ON # List of all possible C-sources (used to create automatic dependencies) CSOURCENAMES = \ $(foreach exe, $(EXECUTABLES) $(EXECUTABLES_L), $($(exe)_OBJECTS)) \ $(foreach rtos, $(RTAI_MODULES) , $($(rtos)_OBJECTS)) \ $(foreach lib, $(LIBRARIES) $(LIBRARIES_L), $($(lib)_OBJECTS)) TMP := $(shell searchFile /tmp/tmp.txt) ifeq ($(TMP),\#error\#) PERM:=$(shell stat --format=%a $(ERRXMLFILE)) else PERM=$(shell cat /tmp/tmp.txt) endif # Include standards MAKEDIRTMP := $(shell searchFile include/acsMakefile) ifneq ($(MAKEDIRTMP),\#error\#) MAKEDIR := $(MAKEDIRTMP)/include include $(MAKEDIR)/acsMakefile endif # TARGETS all: do_all @echo " . . . 'all' done" clean : clean_all # Clear INTROOT interface $(RM) $(INTROOT)/lib/python/site-packages/TestNamespace* # Clear INTROOT Impl $(RM) $(INTROOT)/lib/python/site-packages/Positioner* $(RM) $(INTROOT)/lib/python/site-packages/libPositionerStubs.* # Clear local lib $(RM) *~ *Impl/*~ Positioner/*.pyc $(RM) ../bin/ $(RM) ../include/ $(RM) ../lib/ $(RM) ../object/ $(RM) ../rtai/ @echo " . . . clean done" clean_dist : clean_all clean_dist_all @echo " . . . clean_dist done" man : do_man @echo " . . . man page(s) done" install : xmlpatch_pre install_all @chmod $(PERM) $(ERRXMLFILE) @echo "Patch applied" @rm -rf /tmp/tmp.txt @echo " . . . installation done" @echo " . . . installation done" xmlpatch_pre : @echo "File permissions: " $(PERM) @chmod a+w $(ERRXMLFILE) @echo $(PERM) > /tmp/tmp.txt
Common/Simulators/Components/PyPositioner/src/Positioner/PositionerImpl.py 0 → 100755 +46 −0 Original line number Diff line number Diff line from __future__ import print_function import time from Acspy.Servants.CharacteristicComponent import CharacteristicComponent as cc from Acspy.Servants.ContainerServices import ContainerServices as services from Acspy.Servants.ComponentLifecycle import ComponentLifecycle as lcycle from Acspy.Util.BaciHelper import addProperty from Acspy.Common.Log import getLogger from TestNamespaceInterface__POA import Positioner as POA from Positioner.devios import GenericDevIO, PositionDevIO, SequenceDevIO __copyright__ = "Marco Buttu <marco.buttu@inaf.it>" logger = getLogger() class PositionerImpl(POA, cc, services, lcycle): def __init__(self): cc.__init__(self) services.__init__(self) self.position = 0 self.sequence = (1.1, 2.2, 3.3) def initialize(self): addProperty(self, 'status', devio_ref=GenericDevIO()) addProperty(self, 'position', devio_ref=PositionDevIO(self)) addProperty(self, 'current', devio_ref=GenericDevIO()) addProperty(self, 'seq', devio_ref=SequenceDevIO(self)) print('Component initialized') def setPosition(self, position): print('Setting the position to ', position) self.position = position def getPosition(self): return self.position def setSequence(self, sequence): self.sequence = sequence def getSequence(self): return self.sequence