diff --git a/pom.xml b/pom.xml index 3a4ed4ee623df9e91fa847da5a17725da1e86ab9..82cf9b76a90a8c34e85d716d2dbaf857cb83c483 100755 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ <properties> <PROJECT.name>PIController</PROJECT.name> - <PROJECT.version>1.0.0</PROJECT.version> + <PROJECT.version>1.1.0</PROJECT.version> <PROJECT.description>PIController motion PI controllers device controller</PROJECT.description> </properties> diff --git a/src/piaxis/AxisController.cpp b/src/piaxis/AxisController.cpp index 068ad925ea45f01e5e6a5ebfcb455eda58c63a51..dfa7818eb1b2a373c6fca098ae28959206770669 100755 --- a/src/piaxis/AxisController.cpp +++ b/src/piaxis/AxisController.cpp @@ -65,7 +65,7 @@ void AxisController::compute_state_status() Serializer::pull_from_server(&m_on, m_axis_id); if (m_on.get_value() == 1) { - set_state(Tango::ON); + set_state(Tango::STANDBY); set_status("Motor on"); Serializer::pull_from_server(&m_is_moving, m_axis_id); if (m_is_moving.get_value() == 1) @@ -410,7 +410,7 @@ void AxisController::process_message(yat::Message& msg) case CTRL_ON_MSG: { //DEBUG_STREAM << "-> AxisController::TASK_CTRL_ON_MSG" << std::endl; - set_state(Tango::ON); + set_state(Tango::STANDBY); Serializer::push_to_server(&m_on, m_axis_id); } break; @@ -451,7 +451,7 @@ void AxisController::process_message(yat::Message& msg) case CTRL_SETVELOCITY_MSG: { DEBUG_STREAM << "-> AxisController::TASK_CTRL_SETVELOCITY_MSG" << std::endl; - set_state(Tango::ON); + set_state(Tango::STANDBY); Serializer::push_to_server(&m_velocity, m_axis_id); } break; @@ -467,7 +467,7 @@ void AxisController::process_message(yat::Message& msg) case CTRL_SETACCELERATION_MSG: { DEBUG_STREAM << "-> AxisController::TASK_CTRL_SETACCELERATION_MSG" << std::endl; - set_state(Tango::ON); + set_state(Tango::STANDBY); Serializer::push_to_server(&m_acceleration, m_axis_id); } break; @@ -483,7 +483,7 @@ void AxisController::process_message(yat::Message& msg) case CTRL_SETDECELERATION_MSG: { DEBUG_STREAM << "-> AxisController::TASK_CTRL_SETDECELERATION_MSG" << std::endl; - set_state(Tango::ON); + set_state(Tango::STANDBY); Serializer::push_to_server(&m_deceleration, m_axis_id); } break; @@ -513,7 +513,7 @@ void AxisController::process_message(yat::Message& msg) case CTRL_STOP_MSG: { DEBUG_STREAM << "-> AxisController::TASK_CTRL_STOP_MSG" << std::endl; - set_state(Tango::ON); + set_state(Tango::STANDBY); Serializer::push_to_server(&m_stop, m_axis_id); } break; diff --git a/src/piaxis/PIAxis.cpp b/src/piaxis/PIAxis.cpp index eb9a29d737e5a8f1ba0eab8552268c2ca13990da..46c88478542c4c88b7b5b00f6fdfc2d960d881d7 100755 --- a/src/piaxis/PIAxis.cpp +++ b/src/piaxis/PIAxis.cpp @@ -122,7 +122,6 @@ PIAxis::PIAxis(Tango::DeviceClass *cl, const char *s, const char *d) //-------------------------------------------------------- void PIAxis::delete_device() { - DEBUG_STREAM << "PIAxis::delete_device() " << device_name << endl; /*----- PROTECTED REGION ID(PIAxis::delete_device) ENABLED START -----*/ INFO_STREAM << "PIAxis::delete_device() " << device_name << std::endl; @@ -147,7 +146,6 @@ void PIAxis::delete_device() //-------------------------------------------------------- void PIAxis::init_device() { - DEBUG_STREAM << "PIAxis::init_device() create device " << device_name << endl; /*----- PROTECTED REGION ID(PIAxis::init_device_before) ENABLED START -----*/ INFO_STREAM << "PIAxis::init_device() create device " << device_name << std::endl; @@ -329,7 +327,6 @@ void PIAxis::get_device_property() //-------------------------------------------------------- void PIAxis::always_executed_hook() { - DEBUG_STREAM << "PIAxis::always_executed_hook() " << device_name << endl; /*----- PROTECTED REGION ID(PIAxis::always_executed_hook) ENABLED START -----*/ // code always executed before all requests @@ -360,8 +357,7 @@ void PIAxis::always_executed_hook() */ //-------------------------------------------------------- void PIAxis::read_attr_hardware(TANGO_UNUSED(vector<long> &attr_list)) -{ - DEBUG_STREAM << "PIAxis::read_attr_hardware(vector<long> &attr_list) entering... " << endl; +{ /*----- PROTECTED REGION ID(PIAxis::read_attr_hardware) ENABLED START -----*/ // Add your own code @@ -375,8 +371,7 @@ void PIAxis::read_attr_hardware(TANGO_UNUSED(vector<long> &attr_list)) */ //-------------------------------------------------------- void PIAxis::write_attr_hardware(TANGO_UNUSED(vector<long> &attr_list)) -{ - DEBUG_STREAM << "PIAxis::write_attr_hardware(vector<long> &attr_list) entering... " << endl; +{ /*----- PROTECTED REGION ID(PIAxis::write_attr_hardware) ENABLED START -----*/ // Add your own code diff --git a/src/piaxis/PIAxis.xmi b/src/piaxis/PIAxis.xmi index 024c5580bc257ee77dfea34bafdc53505d252e40..5e31e1bee109a0df3dd37fbe4aeb49fc4156f593 100755 --- a/src/piaxis/PIAxis.xmi +++ b/src/piaxis/PIAxis.xmi @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="ASCII"?> <pogoDsl:PogoSystem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pogoDsl="http://www.esrf.fr/tango/pogo/PogoDsl"> <classes name="PIAxis" pogoRevision="9.6"> - <description description="" title="" sourcePath="/home/informatique/ica/desgrangesm/workspace/picontroller/src/piaxis" language="Cpp" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" copyright="" hasMandatoryProperty="false" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false"> + <description description="" title="" sourcePath="/home/informatique/ica/noureddine/DeviceSources/PIController/src/piaxis" language="Cpp" filestogenerate="XMI file,Code files,Protected Regions" license="GPL" copyright="" hasMandatoryProperty="false" hasConcreteProperty="true" hasAbstractCommand="false" hasAbstractAttribute="false"> <inheritances classname="Device_Impl" sourcePath=""/> <identification contact="at synchrotron-soleil.fr - marc.desgranges" author="marc.desgranges" emailDomain="synchrotron-soleil.fr" classFamily="Motion" siteSpecific="" platform="All Platforms" bus="TCP/UDP" manufacturer="none" reference=""/> </description> @@ -55,6 +55,7 @@ <excludedStates>MOVING</excludedStates> <excludedStates>FAULT</excludedStates> <excludedStates>INIT</excludedStates> + <excludedStates>STANDBY</excludedStates> </commands> <commands name="Off" description="Turn motor off" execMethod="off" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false"> <argin description=""> @@ -81,6 +82,7 @@ <excludedStates>OFF</excludedStates> <excludedStates>FAULT</excludedStates> <excludedStates>INIT</excludedStates> + <excludedStates>STANDBY</excludedStates> </commands> <commands name="Backward" description="Move To Negative Limit" execMethod="backward" displayLevel="OPERATOR" polledPeriod="0" isDynamic="false"> <argin description=""> @@ -188,9 +190,6 @@ <properties description="Is positive limit switch reached" label="" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/> <readExcludedStates>FAULT</readExcludedStates> </attributes> - <states name="ON" description="Motor on"> - <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> - </states> <states name="OFF" description="Motor Off"> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </states> @@ -203,6 +202,9 @@ <states name="INIT" description="Waiting for InitialiseReferencePosition to be done"> <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> </states> + <states name="STANDBY" description=""> + <status abstract="false" inherited="false" concrete="true" concreteHere="true"/> + </states> <preferences docHome="../doc/doc_html" makefileHome="$(TANGO_HOME)"/> </classes> </pogoDsl:PogoSystem> diff --git a/src/piaxis/PIAxisStateMachine.cpp b/src/piaxis/PIAxisStateMachine.cpp index 355858001d4eeb57ab0ec2357bb8a67fdd7522db..6249c9fe59dac96f951379af8029d75e03335b3d 100755 --- a/src/piaxis/PIAxisStateMachine.cpp +++ b/src/piaxis/PIAxisStateMachine.cpp @@ -34,13 +34,13 @@ /*----- PROTECTED REGION END -----*/ // PIAxis::PIAxisStateMachine.cpp //================================================================ -// States | Description +// States | Description //================================================================ -// ON | Motor on -// OFF | Motor Off -// MOVING | Motor is moving -// FAULT | Motor is in fault -// INIT | Waiting for InitialiseReferencePosition to be done +// OFF | Motor Off +// MOVING | Motor is moving +// FAULT | Motor is in fault +// INIT | Waiting for InitialiseReferencePosition to be done +// STANDBY | namespace PIAxis_ns @@ -311,10 +311,10 @@ bool PIAxis::is_forwardLimitSwitch_allowed(TANGO_UNUSED(Tango::AttReqType type)) bool PIAxis::is_On_allowed(TANGO_UNUSED(const CORBA::Any &any)) { // Compare device state with not allowed states. - if (get_state()==Tango::ON || - get_state()==Tango::MOVING || + if (get_state()==Tango::MOVING || get_state()==Tango::FAULT || - get_state()==Tango::INIT) + get_state()==Tango::INIT || + get_state()==Tango::STANDBY) { /*----- PROTECTED REGION ID(PIAxis::OnStateAllowed) ENABLED START -----*/ if (get_state()==Tango::FAULT && is_device_initialized()) @@ -361,10 +361,10 @@ bool PIAxis::is_Off_allowed(TANGO_UNUSED(const CORBA::Any &any)) bool PIAxis::is_Stop_allowed(TANGO_UNUSED(const CORBA::Any &any)) { // Compare device state with not allowed states. - if (get_state()==Tango::ON || - get_state()==Tango::OFF || + if (get_state()==Tango::OFF || get_state()==Tango::FAULT || - get_state()==Tango::INIT) + get_state()==Tango::INIT || + get_state()==Tango::STANDBY) { /*----- PROTECTED REGION ID(PIAxis::StopStateAllowed) ENABLED START -----*/ if (get_state()==Tango::FAULT && is_device_initialized()) diff --git a/test/config_PIController.txt b/test/config_PIController.txt index 425486f165b1442412f65684d51d81a84264190f..71809ad15f25e521841f00c9708ec2c391f7194e 100755 --- a/test/config_PIController.txt +++ b/test/config_PIController.txt @@ -23,14 +23,14 @@ #this i a special section to declare user variables, the syntaxe is xxx=yyy model=(c)MOCK, SIMULATOR, 111111111, 1.0.0.0 servo=1 -pos=7.000000 -vel=3.000000 -accel=5.000000 -decel=2.000000 +pos=10.000000 +vel=5.000000 +accel=2.000000 +decel=1.000000 moving=0 ron=1 err=0 -limit_switch=0x9000 +limit_switch=0x9004 is_initialized=1 [END]