[openrtm-commit:02987] r3121 - in trunk/OpenRTM-aist: . etc examples examples/StaticFsm src/ext/sdo/fsm4rtc_observer src/lib/rtm

openrtm @ openrtm.org openrtm @ openrtm.org
2017年 12月 11日 (月) 09:45:25 JST


Author: n-ando
Date: 2017-12-11 09:45:25 +0900 (Mon, 11 Dec 2017)
New Revision: 3121

Added:
   trunk/OpenRTM-aist/examples/StaticFsm/idl/
   trunk/OpenRTM-aist/examples/StaticFsm/observer.py
Modified:
   trunk/OpenRTM-aist/configure.ac
   trunk/OpenRTM-aist/etc/component.conf
   trunk/OpenRTM-aist/examples/Makefile.am
   trunk/OpenRTM-aist/examples/StaticFsm/rtc.conf
   trunk/OpenRTM-aist/examples/StaticFsm/run.sh
   trunk/OpenRTM-aist/src/ext/sdo/fsm4rtc_observer/ComponentObserverConsumer.cpp
   trunk/OpenRTM-aist/src/lib/rtm/StaticFSM.h
Log:
merged changes from branches/FSM4RTC/OpenRTM-aist r2915-2975:
[compat,sample,->RELENG_2_0] component.conf has been modified.
[compat,build,->RELENG_2_0] Unused build subdir has been removed.
[FSM4RTC,bugfix,->RELENG_2_0] Wrong listener type is specified, fixed.
[FSM4RTC,bugfix,->RELENG_2_0] Obtaining RTC instance in ctor does not work. Strategy has been changed.
[FSM4RTC,conf,->RELENG_2_0] rtc.conf has been modified to load dobserver, extendedfsmservice, and file_nameservice.
[FSM4RTC,sample,->RELENG_2_0] run.sh updated.
[FSM4RTC,sample,->RELENG_2_0] Component observer added.


Modified: trunk/OpenRTM-aist/configure.ac
===================================================================
--- trunk/OpenRTM-aist/configure.ac	2017-12-11 00:42:03 UTC (rev 3120)
+++ trunk/OpenRTM-aist/configure.ac	2017-12-11 00:45:25 UTC (rev 3121)
@@ -1695,7 +1695,6 @@
 	examples/SeqIO/Makefile
 	examples/SimpleService/Makefile
 	examples/ExtTrigger/Makefile
-	examples/MultiInPort/Makefile
 	examples/Templates/Makefile
 	examples/Throughput/Makefile
 	examples/tests/Makefile

Modified: trunk/OpenRTM-aist/etc/component.conf
===================================================================
--- trunk/OpenRTM-aist/etc/component.conf	2017-12-11 00:42:03 UTC (rev 3120)
+++ trunk/OpenRTM-aist/etc/component.conf	2017-12-11 00:45:25 UTC (rev 3121)
@@ -190,6 +190,7 @@
 # port.[inport|outport].[port_name].buffer.write.timeout: 1.0
 # port.[inport|outport].[port_name].buffer.read.empty_policy: [readback, do_nothing, block]
 # port.[inport|outport].[port_name].buffer.read.timeout: 1.0
+# port.inport.[port_name].shared_buffer: YES/NO
 #------------------------------------------------------------
 #
 #

Modified: trunk/OpenRTM-aist/examples/Makefile.am
===================================================================
--- trunk/OpenRTM-aist/examples/Makefile.am	2017-12-11 00:42:03 UTC (rev 3120)
+++ trunk/OpenRTM-aist/examples/Makefile.am	2017-12-11 00:45:25 UTC (rev 3121)
@@ -8,9 +8,9 @@
 
 AUTOMAKE_OPTIONS = 1.4
 
-SUBDIRS = Analyzer Composite ConfigSample SimpleIO SeqIO SimpleService ExtTrigger Fsm StaticFsm Templates Throughput @UNITTEST@
+SUBDIRS = Composite ConfigSample SimpleIO SeqIO SimpleService ExtTrigger Fsm StaticFsm Templates Throughput @UNITTEST@
 EXTRA_DIST =               \
 	rtc.vcproj.yaml    \
 	rtcdll.vcproj.yaml
 
-DIST_SUBDIRS = Analyzer Composite ConfigSample SimpleIO SeqIO SimpleService ExtTrigger Fsm StaticFsm AutoTest Templates Throughput tests
\ No newline at end of file
+DIST_SUBDIRS = Composite ConfigSample SimpleIO SeqIO SimpleService ExtTrigger Fsm StaticFsm AutoTest Templates Throughput tests
\ No newline at end of file

Copied: trunk/OpenRTM-aist/examples/StaticFsm/observer.py (from rev 2975, branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/observer.py)
===================================================================
--- trunk/OpenRTM-aist/examples/StaticFsm/observer.py	                        (rev 0)
+++ trunk/OpenRTM-aist/examples/StaticFsm/observer.py	2017-12-11 00:45:25 UTC (rev 3121)
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+# -*- Python -*-
+# -*- coding: utf-8 -*-
+
+#import sys
+#sys.path = sys.path
+
+from omniORB import CORBA, PortableServer, any
+import omniORB
+import sys
+import uuid
+
+print omniORB.importIDL("idl/SDOPackage.idl", ["-Iidl"])
+print omniORB.importIDL("idl/ComponentObserver.idl", ["-Iidl"])
+import SDOPackage
+import RTC__POA
+
+def dict_to_nvlist(dict):
+    '''Convert a dictionary into a CORBA namevalue list.'''
+    result = []
+    for item in list(dict.keys()):
+        result.append(SDOPackage.NameValue(item, omniORB.any.to_any(dict[item])))
+    return result
+
+class RTCObserver(RTC__POA.ComponentObserver):
+    def __init__(self):
+        pass
+        
+    def update_status(self, kind, hint):
+        kind = str(kind)
+        print "kind: " + kind + " hint: " + hint
+
+
+orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
+poa = orb.resolve_initial_references("RootPOA")
+poa._get_the_POAManager().activate()
+
+fd = open("Microwave0.rtc", "r")
+ior = fd.readline()
+fd.close()
+
+print ior
+
+obj = orb.string_to_object(ior)
+sdo = obj._narrow(SDOPackage.SDO)
+conf = sdo.get_configuration()
+
+obs = RTCObserver()
+uuid_val = uuid.uuid4().get_bytes()
+intf_type = obs._this()._NP_RepositoryId
+props = dict_to_nvlist({'heartbeat.enable': 'YES',
+                        'heartbeat.interval': '1.0',
+                        'observed_status': 'ALL'})
+
+sprof = SDOPackage.ServiceProfile(id=uuid_val,
+                                  interface_type=intf_type,
+                                  service=obs._this(),
+                                  properties=props)
+res = conf.add_service_profile(sprof)
+orb.run()
+print res

Modified: trunk/OpenRTM-aist/examples/StaticFsm/rtc.conf
===================================================================
--- trunk/OpenRTM-aist/examples/StaticFsm/rtc.conf	2017-12-11 00:42:03 UTC (rev 3120)
+++ trunk/OpenRTM-aist/examples/StaticFsm/rtc.conf	2017-12-11 00:45:25 UTC (rev 3121)
@@ -1,12 +1,22 @@
 corba.nameservers: localhost
-naming.formats: %h.host_cxt/%n.rtc
+naming.formats: %n.rtc
 logger.enable: YES
-#logger.log_level: PARANOID
+logger.log_level: PARANOID
 #example.Inputbutton.config_file: inputbutton.conf
 #example.Microwave.config_file: microwave.conf
 #example.Display.config_file: display.conf
 
-manager.modules.load_path: ./.libs/
+
+manager.local_service.org.openrtm.local_service.nameservice.file_nameservice.base_path: ./
+manager.local_service.org.openrtm.local_service.nameservice.file_nameservice.file_structure: flat
+manager.local_service.org.openrtm.local_service.nameservice.file_nameservice.context_delimiter: .
+
+manager.local_service.modules: \
+    ../../src/ext/sdo/fsm4rtc_observer/.libs/ComponentObserverConsumer.so(ComponentObserverConsumerInit), \
+    ../../src/ext/sdo/extended_fsm/.libs/ExtendedFsmServiceProvider.so(ExtendedFsmServiceProviderInit), \
+    ../../src/ext/local_service/nameservice_file/.libs/FileNameservice.so(FileNameserviceInit)
+
+manager.modules.load_path: ./, ./.libs/
 manager.modules.preload: Microwave.so
 manager.components.precreate: Microwave
 manager.components.preactivation: Inputbutton0, Microwave0

Modified: trunk/OpenRTM-aist/examples/StaticFsm/run.sh
===================================================================
--- trunk/OpenRTM-aist/examples/StaticFsm/run.sh	2017-12-11 00:42:03 UTC (rev 3120)
+++ trunk/OpenRTM-aist/examples/StaticFsm/run.sh	2017-12-11 00:45:25 UTC (rev 3121)
@@ -1,3 +1,5 @@
-#!/bin/sh
+#!/bin/bash
 
+rm -f Microwave0.rtc
 ./InputbuttonComp -f rtc.conf
+

Modified: trunk/OpenRTM-aist/src/ext/sdo/fsm4rtc_observer/ComponentObserverConsumer.cpp
===================================================================
--- trunk/OpenRTM-aist/src/ext/sdo/fsm4rtc_observer/ComponentObserverConsumer.cpp	2017-12-11 00:42:03 UTC (rev 3120)
+++ trunk/OpenRTM-aist/src/ext/sdo/fsm4rtc_observer/ComponentObserverConsumer.cpp	2017-12-11 00:45:25 UTC (rev 3121)
@@ -801,7 +801,7 @@
                                         m_fsmaction,
                                         &FSMAction::postExit);
     m_fsmaction.postOnFsmStateChangeListener =
-      m_rtobj->addPostFsmActionListener(POST_ON_EXIT,
+      m_rtobj->addPostFsmActionListener(POST_ON_STATE_CHANGE,
                                         m_fsmaction,
                                         &FSMAction::postStateChange);
   }

Modified: trunk/OpenRTM-aist/src/lib/rtm/StaticFSM.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/StaticFSM.h	2017-12-11 00:42:03 UTC (rev 3120)
+++ trunk/OpenRTM-aist/src/lib/rtm/StaticFSM.h	2017-12-11 00:45:25 UTC (rev 3121)
@@ -108,7 +108,8 @@
    *
    */
   template<class TOP>
-  class Machine : public Macho::Machine<TOP>
+  class Machine
+    : public Macho::Machine<TOP>
   {
   public:
     Machine(RTC::RTObject_impl* comp)
@@ -151,45 +152,61 @@
     Link(_StateInstance & instance)
       : Macho::Link<C, P>(instance), rtComponent(NULL)
     {
-      const RTC::Machine<C>* machine;
-      machine = dynamic_cast<const RTC::Machine<C>*>(&P::machine());
-      if (machine != NULL)
-        {
-          rtComponent = machine->rtComponent;
-        }
     }
+    virtual ~Link()
+    {
+    }
+
+    void setrtc()
+    {
+      if (rtComponent != NULL) { return; }
+      const RTC::Machine<typename P::TOP>* machine =
+        dynamic_cast<const RTC::Machine<typename P::TOP>*>(&P::machine());
+      if (machine != NULL) { rtComponent = machine->rtComponent; }
+    }
   public:
     typedef Link<C, P> LINK;
     
     virtual void entry()
     {
+      setrtc();
       if (rtComponent == NULL)
         {
           onEntry();
-          return;
         }
-      rtComponent->preOnFsmEntry(C::_state_name());
-      rtComponent->postOnFsmEntry(C::_state_name(), onEntry());
+      else
+        {
+          rtComponent->postOnFsmStateChange(C::_state_name(), RTC::RTC_OK);
+          rtComponent->preOnFsmEntry(C::_state_name());
+          rtComponent->postOnFsmEntry(C::_state_name(), onEntry());
+        }
     }
     virtual void init()
     {
+      setrtc();
       if (rtComponent == NULL)
         {
           onInit();
-          return;
         }
-      rtComponent->preOnFsmInit(C::_state_name());
-      rtComponent->postOnFsmInit(C::_state_name(), onInit());
+      else
+        {
+          rtComponent->preOnFsmInit(C::_state_name());
+          rtComponent->postOnFsmInit(C::_state_name(), onInit());
+        }
     }
     virtual void exit()
     {
+      setrtc();
       if (rtComponent == NULL)
         {
           onExit();
-          return;
         }
-      rtComponent->preOnFsmExit(C::_state_name());
-      rtComponent->postOnFsmExit(C::_state_name(), onExit());
+      else
+        {
+          rtComponent->preOnFsmExit(C::_state_name());
+          rtComponent->postOnFsmExit(C::_state_name(), onExit());
+          rtComponent->preOnFsmStateChange(C::_state_name());
+        }
     }
 
     virtual ReturnCode_t onEntry() { return RTC::RTC_OK; }
@@ -196,7 +213,6 @@
     virtual ReturnCode_t onInit()  { return RTC::RTC_OK; }
     virtual ReturnCode_t onExit()  { return RTC::RTC_OK; }
 
-  private:
     RTObject_impl* rtComponent;
   };
 };



More information about the openrtm-commit mailing list