[openrtm-commit:02401] r936 - trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm

openrtm @ openrtm.org openrtm @ openrtm.org
2017年 2月 7日 (火) 15:39:01 JST


Author: win-ei
Date: 2017-02-07 15:39:01 +0900 (Tue, 07 Feb 2017)
New Revision: 936

Added:
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Cooking.java
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Disabled.java
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Microwave.java
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/MicrowaveComp.java
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/MicrowaveImpl.java
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/MicrowaveProtocol.java
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Operational.java
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Programmed.java
Removed:
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/CameraProtocol.java
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Configuring.java
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/NotShooting.java
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Off.java
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/ShootingCamera.java
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/ShootingCamera_Focused.java
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/ShootingCamera_Focusing.java
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/ShootingCamera_Shooting.java
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/ShootingCamera_Storing.java
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/StaticFsm.java
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/StaticFsmComp.java
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/StaticFsmImpl.java
Modified:
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Idle.java
   trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Top.java
Log:
[FSM4RTC,example] StaticFsm sample which is for new Static FSM framework has been added. refs #3775

Deleted: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/CameraProtocol.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/CameraProtocol.java	2017-02-07 06:31:32 UTC (rev 935)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/CameraProtocol.java	2017-02-07 06:39:01 UTC (rev 936)
@@ -1,22 +0,0 @@
-package RTMExamples.StaticFsm;
-
-import RTC.TimedLong;
-/**
- * 
- */
-public interface CameraProtocol {
-
-    void on_do();
-
-    void EvOn(TimedLong param);
-    void EvOff(TimedLong param);
-    void EvConfig(TimedLong param);
-    void EvInFocus(TimedLong param);
-    void EvShutterHalf(TimedLong param);
-    void EvShutterFull(TimedLong param);
-    void EvShutterReleased(TimedLong param);
-
-    public boolean isOutputData(); 
-    public int getOutputData(); 
-}
-

Deleted: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Configuring.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Configuring.java	2017-02-07 06:31:32 UTC (rev 935)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Configuring.java	2017-02-07 06:39:01 UTC (rev 936)
@@ -1,36 +0,0 @@
-package RTMExamples.StaticFsm;
-
-import jp.go.aist.rtm.RTC.jfsm.DeepHistory;
-import jp.go.aist.rtm.RTC.jfsm.State;
-
-import RTC.TimedLong;
-/**
- * 
- */
- at DeepHistory
-public class Configuring extends NotShooting {
-
-    @Override
-    public void onEntry() {
-        System.out.println("Configuring::onEntry");
-        setOutputData(4);
-    }
-
-    @Override
-    public void onExit() {
-        System.out.println("Configuring::onExit");
-    }
-
-    @Override
-    public void on_do() {
-        System.out.println("Configuring::on_do");
-    }
-
-    @Override
-    public void EvConfig(TimedLong param){
-        System.out.println("Configuring::EvConfig");
-        setState(new State(Idle.class));
-    }
-
-}
-

Copied: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Cooking.java (from rev 935, trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/ShootingCamera.java)
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Cooking.java	                        (rev 0)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Cooking.java	2017-02-07 06:39:01 UTC (rev 936)
@@ -0,0 +1,37 @@
+package RTMExamples.StaticFsm;
+
+import jp.go.aist.rtm.RTC.jfsm.DeepHistory;
+import jp.go.aist.rtm.RTC.jfsm.State;
+
+import RTC.TimedLong;
+/**
+ * 
+ */
+public class Cooking extends Programmed {
+
+
+    @Override
+    public void onEntry() {
+        System.out.println("[Microwave] Cooking::onEntry()");
+        System.out.println("[Microwave] >>> Heating on <<<");
+    }
+
+    @Override
+    public void onExit() {
+        System.out.println("[Microwave] Cooking::onExit()");
+        System.out.println("[Microwave] >>> Heating off <<<");
+    }
+
+    @Override
+    public void tick() {
+        System.out.println("[Microwave] >>> Clock tick <<<");
+        Top.Data data = data(Top.class);
+        data.decrementTimer();
+        if (data.getRemainingTime() == 0) {
+            System.out.println("[Microwave] >>> Finished <<<");
+            setState(new State(Idle.class));
+        } else {
+            data.printTimer();
+        }
+    }
+}

Copied: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Disabled.java (from rev 935, trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Configuring.java)
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Disabled.java	                        (rev 0)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Disabled.java	2017-02-07 06:39:01 UTC (rev 936)
@@ -0,0 +1,29 @@
+package RTMExamples.StaticFsm;
+
+import jp.go.aist.rtm.RTC.jfsm.DeepHistory;
+import jp.go.aist.rtm.RTC.jfsm.State;
+
+import RTC.TimedLong;
+/**
+ * 
+ */
+ at DeepHistory
+public class Disabled extends Top {
+
+    @Override
+    public void close() {
+        System.out.println("[Microwave] >>> Door closed <<<");
+        setState(new State(Operational.class));
+    }
+
+    @Override
+    public void onEntry() {
+        System.out.println("[Microwave] Disabled::onEntry()");
+    }
+
+    @Override
+    public void onExit() {
+        System.out.println("[Microwave] Disabled::onExit()");
+    }
+}
+

Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Idle.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Idle.java	2017-02-07 06:31:32 UTC (rev 935)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Idle.java	2017-02-07 06:39:01 UTC (rev 936)
@@ -1,37 +1,30 @@
 package RTMExamples.StaticFsm;
 
 import jp.go.aist.rtm.RTC.jfsm.DeepHistory;
+import jp.go.aist.rtm.RTC.jfsm.Event;
 import jp.go.aist.rtm.RTC.jfsm.State;
 
 import RTC.TimedLong;
 /**
  * 
  */
- at DeepHistory
-public class Idle extends NotShooting {
+public class Idle extends Operational {
 
     @Override
     public void onEntry() {
-        System.out.println("Idle::onEntry");
-        setOutputData(3);
+        ((Top.Data) data()).resetTimer();
+        System.out.println("[Microwave] Idle::onEntry()");
+        System.out.println("[Microwave] >>> Microwave ready <<<");
     }
 
     @Override
-    public void onExit() {
-        System.out.println("Idle::onExit");
+    public void minute() {
+        System.out.println("[Microwave] >>> Timer incremented <<<");
+        setState(new State(Programmed.class));
+        dispatch(new Event("minute"));
     }
 
-    @Override
-    public void on_do() {
-        System.out.println("Idle::on_do");
-    }
 
-    @Override
-    public void EvConfig(TimedLong param){
-        System.out.println("Idle::EvConfig");
-        setState(new State(Configuring.class));
-    }
-
 }
 
 

Copied: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Microwave.java (from rev 935, trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/StaticFsm.java)
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Microwave.java	                        (rev 0)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Microwave.java	2017-02-07 06:39:01 UTC (rev 936)
@@ -0,0 +1,53 @@
+package RTMExamples.StaticFsm;
+/**
+ * {@.ja StaticFsm}
+ * {@.en StaticFsm}
+ *
+ */
+
+import jp.go.aist.rtm.RTC.Manager;
+import jp.go.aist.rtm.RTC.RTObject_impl;
+import jp.go.aist.rtm.RTC.RtcDeleteFunc;
+import jp.go.aist.rtm.RTC.RtcNewFunc;
+import jp.go.aist.rtm.RTC.RegisterModuleFunc;
+import jp.go.aist.rtm.RTC.util.Properties;
+
+/**
+ * {@.ja Definition class}
+ * {@.en Definition class}
+ * <p>
+ * {@.ja The class where ComponentProfile(etc) was defined.}
+ * {@.en The class where ComponentProfile(etc) was defined.}
+ */
+public class Microwave implements RtcNewFunc, RtcDeleteFunc, RegisterModuleFunc {
+
+//  Module specification
+//  <rtc-template block="module_spec">
+    public static String component_conf[] = {
+        "implementation_id", "Microwave",
+        "type_name",         "Microwave",
+        "description",       "Microwave",
+        "version",           "1.0.0",
+        "vendor",            "Noriaki Ando, AIST",
+        "category",          "example",
+        "activity_type",     "DataFlowComponent",
+        "max_instance",      "10",
+        "language",          "Java",
+        "lang_type",         "compile",
+        ""
+            };
+//  </rtc-template>
+
+    public RTObject_impl createRtc(Manager mgr) {
+        return new MicrowaveImpl(mgr);
+    }
+
+    public void deleteRtc(RTObject_impl rtcBase) {
+        rtcBase = null;
+    }
+    public void registerModule() {
+        Properties prop = new Properties(component_conf);
+        final Manager manager = Manager.instance();
+        manager.registerFactory(prop, new Microwave(), new Microwave());
+    }
+}

Copied: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/MicrowaveComp.java (from rev 935, trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/StaticFsmComp.java)
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/MicrowaveComp.java	                        (rev 0)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/MicrowaveComp.java	2017-02-07 06:39:01 UTC (rev 936)
@@ -0,0 +1,122 @@
+package RTMExamples.StaticFsm;
+/**
+ * 
+ * {@.ja Standalone component}
+ * {@.en Standalone component}
+ *
+ */
+
+import jp.go.aist.rtm.RTC.Manager;
+import jp.go.aist.rtm.RTC.ModuleInitProc;
+import jp.go.aist.rtm.RTC.RTObject_impl;
+import jp.go.aist.rtm.RTC.util.NVUtil;
+import jp.go.aist.rtm.RTC.util.Properties;
+
+import RTC.ComponentProfile;
+import RTC.PortService;
+import RTC.PortServiceListHolder;
+import RTC.PortInterfacePolarity;
+import RTC.PortInterfaceProfileListHolder;
+import RTC.RTObject;
+import RTC.RTObjectHelper;
+
+import _SDOPackage.NVListHolder;
+/**
+ * {@.ja Sample component of static FSM}
+ * {@.en Sample component of static FSM}
+ *
+ */
+public class MicrowaveComp implements ModuleInitProc {
+
+    public void myModuleInit(Manager mgr) {
+        Properties prop = new Properties(Microwave.component_conf);
+        mgr.registerFactory(prop, new Microwave(), new Microwave());
+
+        // Create a component
+        System.out.println("Creating a component: \"Microwave\"....");
+        RTObject_impl comp = mgr.createComponent("Microwave");
+        if( comp==null ) {
+    	    System.err.println("Component create failed.");
+    	    System.exit(0);
+        }
+        System.out.println("succeed.");
+      
+        ComponentProfile prof = comp.get_component_profile();
+        System.out.println( "=================================================" );
+        System.out.println( " Component Profile" );
+        System.out.println( "-------------------------------------------------" );
+        System.out.println( "InstanceID:     " + prof.instance_name );
+        System.out.println( "Implementation: " + prof.type_name );
+        System.out.println( "Description:    " + prof.description );
+        System.out.println( "Version:        " + prof.version );
+        System.out.println( "Maker:          " + prof.vendor );
+        System.out.println( "Category:       " + prof.category );
+        System.out.println( "  Other properties   " );
+        NVUtil.dump(new NVListHolder(prof.properties));
+        System.out.println( "=================================================" );
+        // Example
+        // The following procedure is examples how handle RT-Components.
+        // These should not be in this function.
+
+        // Get the component's object reference
+        Manager manager = Manager.instance();
+        RTObject rtobj = null;
+        try {
+            rtobj = RTObjectHelper.narrow(manager.getPOA().servant_to_reference(comp));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        // Get the port list of the component
+        PortServiceListHolder ports = new PortServiceListHolder();
+        ports.value = rtobj.get_ports();
+
+        // getting port profiles
+        System.out.println( "Number of Ports: " );
+        System.out.println( ports.value.length );
+        for( int intIdx=0;intIdx<ports.value.length;++intIdx ) {
+            PortService port = ports.value[intIdx];
+            System.out.println( "Port" + intIdx + " (name): ");
+            System.out.println( port.get_port_profile().name );
+        
+            PortInterfaceProfileListHolder iflist = new PortInterfaceProfileListHolder();
+            iflist.value = port.get_port_profile().interfaces;
+            System.out.println( "---interfaces---" );
+            for( int intIdx2=0;intIdx2<iflist.value.length;++intIdx2 ) {
+                System.out.println( "I/F name: " );
+                System.out.println( iflist.value[intIdx2].instance_name  );
+                System.out.println( "I/F type: " );
+                System.out.println( iflist.value[intIdx2].type_name );
+                if( iflist.value[intIdx2].polarity==PortInterfacePolarity.PROVIDED ) {
+                    System.out.println( "Polarity: PROVIDED" );
+                } else {
+                    System.out.println( "Polarity: REQUIRED" );
+                }
+            }
+            System.out.println( "---properties---" );
+            NVUtil.dump( new NVListHolder(port.get_port_profile().properties) );
+            System.out.println( "----------------" );
+        }  
+    }
+
+    public static void main(String[] args) {
+        // Initialize manager
+        final Manager manager = Manager.init(args);
+
+        // Set module initialization proceduer
+        // This procedure will be invoked in activateManager() function.
+        MicrowaveComp init = new MicrowaveComp();
+        manager.setModuleInitProc(init);
+
+        // Activate manager and register to naming service
+        manager.activateManager();
+
+        // run the manager in blocking mode
+        // runManager(false) is the default.
+        manager.runManager();
+
+        // If you want to run the manager in non-blocking mode, do like this
+        // manager.runManager(true);
+    }
+
+}

Copied: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/MicrowaveImpl.java (from rev 935, trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/StaticFsmImpl.java)
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/MicrowaveImpl.java	                        (rev 0)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/MicrowaveImpl.java	2017-02-07 06:39:01 UTC (rev 936)
@@ -0,0 +1,372 @@
+package RTMExamples.StaticFsm;
+/**
+ * {@.ja MicrowaveImpl}
+ * {@.en MicrowaveImpl}
+ */
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import java.util.ArrayDeque;
+import java.util.Queue;
+
+import jp.go.aist.rtm.RTC.DataFlowComponentBase;
+import jp.go.aist.rtm.RTC.Manager;
+import jp.go.aist.rtm.RTC.connectorListener.ReturnCode;
+import jp.go.aist.rtm.RTC.jfsm.Event;
+import jp.go.aist.rtm.RTC.jfsm.Machine;
+import jp.go.aist.rtm.RTC.jfsm.machine.EventBase;
+import jp.go.aist.rtm.RTC.port.ConnectorBase;
+import jp.go.aist.rtm.RTC.port.EventInPort;
+import jp.go.aist.rtm.RTC.port.InPort;
+import jp.go.aist.rtm.RTC.port.OutPort;
+import jp.go.aist.rtm.RTC.port.ConnectorDataListenerT;
+import jp.go.aist.rtm.RTC.port.ConnectorDataListenerType;
+import jp.go.aist.rtm.RTC.util.DataRef;
+
+import RTC.TimedLong;
+import RTC.ReturnCode_t;
+
+/**
+ * {@.ja Implemented class of a sample component of static FSM}
+ * {@.en Implemented class of a sample component of static FSM}
+ *
+ */
+public class MicrowaveImpl extends DataFlowComponentBase {
+
+  /**
+   * {@.ja  constructor}
+   * {@.en  constructor}
+   * @param manager 
+   *   {@.ja Maneger Object}
+   *   {@.en Maneger Object}
+   */
+  public MicrowaveImpl(Manager manager) {  
+      super(manager);
+      // <rtc-template block="initializer">
+      m_fsm = new Machine<>(Top.class, MicrowaveProtocol.class, null);
+      m_event = new DataRef<Machine<Top, MicrowaveProtocol>>(m_fsm);
+      m_eventIn = new EventInPort<Machine<Top, MicrowaveProtocol>>("event",m_event);
+      // </rtc-template>
+
+  }
+
+  /**
+   *
+   * The initialize action (on CREATED->ALIVE transition)
+   * formaer rtc_init_entry() 
+   *
+   * @return RTC::ReturnCode_t
+   * 
+   * 
+   */
+  @Override
+  protected ReturnCode_t onInitialize() {
+      // Registration: InPort/OutPort/Service
+      // <rtc-template block="registration">
+      // Set InPort buffers
+      addInPort("event", m_eventIn);
+
+      m_eventIn.bindEvent("open",   "open");
+      m_eventIn.bindEvent("close",  "close");
+      m_eventIn.bindEvent("minute", "minute");
+      m_eventIn.bindEvent("start",  "start");
+      m_eventIn.bindEvent("stop",   "stop");
+
+
+      // Set OutPort buffer
+      // </rtc-template>
+      
+      
+
+      return super.onInitialize();
+  }
+
+  /***
+   *
+   * The finalize action (on ALIVE->END transition)
+   * formaer rtc_exiting_entry()
+   *
+   * @return RTC::ReturnCode_t
+   * 
+   * 
+   */
+//    @Override
+//    protected ReturnCode_t onFinalize() {
+//        return super.onFinalize();
+//    }
+
+  /***
+   *
+   * The startup action when ExecutionContext startup
+   * former rtc_starting_entry()
+   *
+   * @param ec_id target ExecutionContext Id
+   *
+   * @return RTC::ReturnCode_t
+   * 
+   * 
+   */
+//    @Override
+//    protected ReturnCode_t onStartup(int ec_id) {
+//        return super.onStartup(ec_id);
+//    }
+
+  /***
+   *
+   * The shutdown action when ExecutionContext stop
+   * former rtc_stopping_entry()
+   *
+   * @param ec_id target ExecutionContext Id
+   *
+   * @return RTC::ReturnCode_t
+   * 
+   * 
+   */
+//    @Override
+//    protected ReturnCode_t onShutdown(int ec_id) {
+//        return super.onShutdown(ec_id);
+//    }
+
+  /***
+   *
+   * The activated action (Active state entry action)
+   * former rtc_active_entry()
+   *
+   * @param ec_id target ExecutionContext Id
+   *
+   * @return RTC::ReturnCode_t
+   * 
+   * 
+   */
+//    @Override
+//    protected ReturnCode_t onActivated(int ec_id) {
+//        return super.onActivated(ec_id);
+//    }
+
+  /***
+   *
+   * The deactivated action (Active state exit action)
+   * former rtc_active_exit()
+   *
+   * @param ec_id target ExecutionContext Id
+   *
+   * @return RTC::ReturnCode_t
+   * 
+   * 
+   */
+//    @Override
+//    protected ReturnCode_t onDeactivated(int ec_id) {
+//        return super.onDeactivated(ec_id);
+//    }
+
+  /**
+   *
+   * The execution action that is invoked periodically
+   * former rtc_active_do()
+   *
+   * @param ec_id target ExecutionContext Id
+   *
+   * @return RTC::ReturnCode_t
+   * 
+   * 
+   */
+  @Override
+  protected ReturnCode_t onExecute(int ec_id) {
+      return super.onExecute(ec_id);
+  }
+
+  /***
+   *
+   * The aborting action when main logic error occurred.
+   * former rtc_aborting_entry()
+   *
+   * @param ec_id target ExecutionContext Id
+   *
+   * @return RTC::ReturnCode_t
+   * 
+   * 
+   */
+//  @Override
+//  public ReturnCode_t onAborting(int ec_id) {
+//      return super.onAborting(ec_id);
+//  }
+
+  /***
+   *
+   * The error action in ERROR state
+   * former rtc_error_do()
+   *
+   * @param ec_id target ExecutionContext Id
+   *
+   * @return RTC::ReturnCode_t
+   * 
+   * 
+   */
+//    @Override
+//    public ReturnCode_t onError(int ec_id) {
+//        return super.onError(ec_id);
+//    }
+
+  /***
+   *
+   * The reset action that is invoked resetting
+   * This is same but different the former rtc_init_entry()
+   *
+   * @param ec_id target ExecutionContext Id
+   *
+   * @return RTC::ReturnCode_t
+   * 
+   * 
+   */
+//    @Override
+//    protected ReturnCode_t onReset(int ec_id) {
+//        return super.onReset(ec_id);
+//    }
+
+  /***
+   *
+   * The state update action that is invoked after onExecute() action
+   * no corresponding operation exists in OpenRTm-aist-0.2.0
+   *
+   * @param ec_id target ExecutionContext Id
+   *
+   * @return RTC::ReturnCode_t
+   * 
+   * 
+   */
+//    @Override
+//    protected ReturnCode_t onStateUpdate(int ec_id) {
+//        return super.onStateUpdate(ec_id);
+//    }
+
+  /***
+   *
+   * The action that is invoked when execution context's rate is changed
+   * no corresponding operation exists in OpenRTm-aist-0.2.0
+   *
+   * @param ec_id target ExecutionContext Id
+   *
+   * @return RTC::ReturnCode_t
+   * 
+   * 
+   */
+//    @Override
+//    protected ReturnCode_t onRateChanged(int ec_id) {
+//        return super.onRateChanged(ec_id);
+//    }
+//
+  // DataInPort declaration
+  // <rtc-template block="inport_declare">
+  protected Machine<Top, MicrowaveProtocol> m_fsm;
+  protected DataRef<Machine<Top, MicrowaveProtocol>> m_event;
+  /*!
+   */
+  protected EventInPort<Machine<Top, MicrowaveProtocol>> m_eventIn;
+
+
+    
+  // </rtc-template>
+
+  // DataOutPort declaration
+  // <rtc-template block="outport_declare">
+
+    
+  // </rtc-template>
+
+  // CORBA Port declaration
+  // <rtc-template block="corbaport_declare">
+    
+  // </rtc-template>
+
+  // Service declaration
+  // <rtc-template block="service_declare">
+    
+  // </rtc-template>
+
+  // Consumer declaration
+  // <rtc-template block="consumer_declare">
+    
+  // </rtc-template>
+
+
+  private void initializeParam(Object target) {
+      Class<?> targetClass = target.getClass();
+      ClassLoader loader = target.getClass().getClassLoader();
+      //
+      Field[] fields = targetClass.getFields();
+      for(Field field : fields) {
+          if(field.getType().isPrimitive()) continue;
+			
+          try {
+              if(field.getType().isArray()) {
+                  Object arrayValue = null;
+                  Class<?> clazz = null;
+                  if(field.getType().getComponentType().isPrimitive()) {
+                      clazz = field.getType().getComponentType();
+                  } else {
+                      clazz = loader.loadClass(field.getType().getComponentType().getName());
+                  }
+                  arrayValue = Array.newInstance(clazz, 0);
+                  field.set(target, arrayValue);
+
+              } else {
+                  Constructor<?>[] constList = field.getType().getConstructors();
+                  if(constList.length==0) {
+                      Method[] methodList = field.getType().getMethods();
+                      for(Method method : methodList) {
+                          if(method.getName().equals("from_int")==false) continue;
+                              Object objFld = method.invoke(target, new Object[]{ new Integer(0) });
+                              field.set(target, objFld);
+                              break;
+                      }
+                  } else {
+                      Class<?> classFld = Class.forName(field.getType().getName(), true, loader);
+                      Object objFld = classFld.newInstance();
+                      initializeParam(objFld);
+                      field.set(target, objFld);
+                  }
+              }
+          } catch (ClassNotFoundException e) {
+              e.printStackTrace();
+          } catch (InstantiationException e) {
+              e.printStackTrace();
+          } catch (IllegalAccessException e) {
+              e.printStackTrace();
+          } catch (IllegalArgumentException e) {
+              e.printStackTrace();
+          } catch (InvocationTargetException e) {
+              e.printStackTrace();
+          }
+      }
+  }
+
+  class DataListener extends ConnectorDataListenerT<TimedLong>{
+      public DataListener(final String name, Queue<Event> que){
+          super(TimedLong.class);
+          m_name = name;
+          m_que = que;
+      }
+
+      public ReturnCode operator(ConnectorBase.ConnectorInfo arg,
+                             TimedLong data) {
+          ConnectorBase.ConnectorInfo info =(ConnectorBase.ConnectorInfo)arg;
+          System.out.println("------------------------------");
+          System.out.println("Listener:       "+m_name);
+          System.out.println("Data:           "+data.data);
+          System.out.println("------------------------------");
+          synchronized (m_que) {
+              Class<?>[] args = new Class<?>[1];
+              args[0] = data.getClass();
+              m_que.offer(new Event(m_name,args,(Object)data));
+          }
+          return ReturnCode.NO_CHANGE;
+      }
+
+      private String m_name;
+      private Queue<Event> m_que;
+  }
+}

Copied: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/MicrowaveProtocol.java (from rev 935, trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/CameraProtocol.java)
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/MicrowaveProtocol.java	                        (rev 0)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/MicrowaveProtocol.java	2017-02-07 06:39:01 UTC (rev 936)
@@ -0,0 +1,23 @@
+package RTMExamples.StaticFsm;
+
+import RTC.TimedLong;
+/**
+ * 
+ */
+public interface MicrowaveProtocol {
+
+
+    void open();
+
+    void close();
+
+    void minute();
+
+    void start();
+
+    void stop();
+
+    void tick();
+
+}
+

Deleted: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/NotShooting.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/NotShooting.java	2017-02-07 06:31:32 UTC (rev 935)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/NotShooting.java	2017-02-07 06:39:01 UTC (rev 936)
@@ -1,48 +0,0 @@
-package RTMExamples.StaticFsm;
-
-import jp.go.aist.rtm.RTC.jfsm.DeepHistory;
-import jp.go.aist.rtm.RTC.jfsm.State;
-
-import RTC.TimedLong;
-/**
- * 
- */
- at DeepHistory
-public class NotShooting extends Top {
-
-    @Override
-    public void onEntry() {
-        System.out.println("NotShooting::onEntry");
-        setOutputData(2);
-    }
-
-    @Override
-    public void onInit() {
-        System.out.println("NotShooting::onInit");
-        setState(new State(Idle.class));
-    }
-
-    @Override
-    public void onExit() {
-        System.out.println("NotShooting::onExit");
-    }
-
-    @Override
-    public void on_do() {
-        System.out.println("NotShooting::on_do");
-    }
-
-    @Override
-    public void EvOff(TimedLong param){
-        System.out.println("NotShooting::EvOff");
-        setState(new State(Off.class));
-    }
-
-    @Override
-    public void EvShutterHalf(TimedLong param){
-        System.out.println("NotShooting::EvShutterHalf");
-        setState(new State(ShootingCamera.class));
-    }
-}
-
-

Deleted: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Off.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Off.java	2017-02-07 06:31:32 UTC (rev 935)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Off.java	2017-02-07 06:39:01 UTC (rev 936)
@@ -1,35 +0,0 @@
-package RTMExamples.StaticFsm;
-
-import jp.go.aist.rtm.RTC.jfsm.DeepHistory;
-import jp.go.aist.rtm.RTC.jfsm.State;
-
-import RTC.TimedLong;
-/**
- * 
- */
- at DeepHistory
-public class Off extends Top {
-
-    @Override
-    public void onEntry() {
-        System.out.println("Off::onEntry");
-        setOutputData(1);
-    }
-
-    @Override
-    public void onExit() {
-        System.out.println("Off::onExit");
-    }
-
-    @Override
-    public void on_do() {
-        System.out.println("Off::on_do");
-    }
-
-    @Override
-    public void EvOn(TimedLong param){
-        System.out.println("Off::EvOn");
-        setState(new State(NotShooting.class));
-    }
-}
-

Copied: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Operational.java (from rev 935, trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/NotShooting.java)
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Operational.java	                        (rev 0)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Operational.java	2017-02-07 06:39:01 UTC (rev 936)
@@ -0,0 +1,33 @@
+package RTMExamples.StaticFsm;
+
+import jp.go.aist.rtm.RTC.jfsm.DeepHistory;
+import jp.go.aist.rtm.RTC.jfsm.State;
+
+import RTC.TimedLong;
+/**
+ * 
+ */
+ at DeepHistory
+public class Operational extends Top {
+
+    @Override
+    public void onInit() {
+        System.out.println("[Microwave] Operational::onInit()");
+        setState(new State(Idle.class));
+    }
+
+    @Override
+    public void open() {
+        System.out.println("[Microwave] >>> Door opened <<<");
+        setState(new State(Disabled.class));
+    }
+
+    @Override
+    public void stop() {
+        System.out.println("[Microwave] >>> Stopped <<<");
+        setState(new State(Idle.class));
+    }
+
+}
+
+

Copied: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Programmed.java (from rev 935, trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Off.java)
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Programmed.java	                        (rev 0)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Programmed.java	2017-02-07 06:39:01 UTC (rev 936)
@@ -0,0 +1,42 @@
+package RTMExamples.StaticFsm;
+
+import jp.go.aist.rtm.RTC.jfsm.DeepHistory;
+import jp.go.aist.rtm.RTC.jfsm.State;
+
+import RTC.TimedLong;
+/**
+ * 
+ */
+ at DeepHistory
+public class Programmed extends Operational {
+
+    @Override
+    public void minute() {
+        System.out.println("[Microwave] >>> Timer incremented <<<");
+        Top.Data data = data(Top.class);
+        data.incrementTimer();
+        data.printTimer();
+    }
+
+    @Override
+    public void start() {
+        System.out.println("[Microwave] >>> Microwave started <<<");
+        setState(new State(Cooking.class));
+    }
+
+    @Override
+    public void onInit() {
+        System.out.println("[Microwave] Programmed::onInit()");
+    }
+
+    @Override
+    public void onEntry() {
+        System.out.println("[Microwave] Programmed::onEntry()");
+    }
+
+    @Override
+    public void onExit() {
+        System.out.println("[Microwave] Programmed::onExit()");
+    }
+
+}

Deleted: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/ShootingCamera.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/ShootingCamera.java	2017-02-07 06:31:32 UTC (rev 935)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/ShootingCamera.java	2017-02-07 06:39:01 UTC (rev 936)
@@ -1,43 +0,0 @@
-package RTMExamples.StaticFsm;
-
-import jp.go.aist.rtm.RTC.jfsm.DeepHistory;
-import jp.go.aist.rtm.RTC.jfsm.State;
-
-import RTC.TimedLong;
-/**
- * 
- */
- at DeepHistory
-public class ShootingCamera extends Top {
-
-    @Override
-    public void onEntry() {
-        System.out.println("ShootingCamera::onEntry");
-        setOutputData(5);
-    }
-
-    @Override
-    public void onInit() {
-        System.out.println("ShootingCamera::onInit");
-        setState(new State(ShootingCamera_Shooting.class));
-    }
-
-    @Override
-    public void onExit() {
-        System.out.println("ShootingCamera::onExit");
-    }
-
-    @Override
-    public void on_do() {
-        System.out.println("ShootingCamera::on_do");
-    }
-
-    @Override
-    public void EvShutterReleased(TimedLong param){
-        System.out.println("ShootingCamera::EvShutterReleased");
-        setState(new State(NotShooting.class));
-    }
-
-}
-
-

Deleted: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/ShootingCamera_Focused.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/ShootingCamera_Focused.java	2017-02-07 06:31:32 UTC (rev 935)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/ShootingCamera_Focused.java	2017-02-07 06:39:01 UTC (rev 936)
@@ -1,35 +0,0 @@
-package RTMExamples.StaticFsm;
-
-import jp.go.aist.rtm.RTC.jfsm.DeepHistory;
-import jp.go.aist.rtm.RTC.jfsm.State;
-
-import RTC.TimedLong;
-/**
- * 
- */
- at DeepHistory
-public class ShootingCamera_Focused extends ShootingCamera_Shooting {
-
-    @Override
-    public void onEntry() {
-        System.out.println("ShootingCamera_Focused::onEntry");
-        setOutputData(8);
-    }
-
-    @Override
-    public void onExit() {
-        System.out.println("ShootingCamera_Focused::onExit");
-    }
-
-    @Override
-    public void on_do() {
-        System.out.println("ShootingCamera_Focused::on_do");
-    }
-
-    @Override
-    public void EvShutterFull(TimedLong param){
-        System.out.println("ShootingCamera_Focused::EvShutterFull");
-        setState(new State(ShootingCamera_Storing.class));
-    }
-}
-

Deleted: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/ShootingCamera_Focusing.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/ShootingCamera_Focusing.java	2017-02-07 06:31:32 UTC (rev 935)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/ShootingCamera_Focusing.java	2017-02-07 06:39:01 UTC (rev 936)
@@ -1,47 +0,0 @@
-package RTMExamples.StaticFsm;
-
-import jp.go.aist.rtm.RTC.jfsm.DeepHistory;
-import jp.go.aist.rtm.RTC.jfsm.Event;
-import jp.go.aist.rtm.RTC.jfsm.State;
-
-import RTC.TimedLong;
-/**
- * 
- */
- at DeepHistory
-public class ShootingCamera_Focusing extends ShootingCamera_Shooting {
-
-    @Override
-    public void onEntry() {
-        System.out.println("ShootingCamera_Focusing::onEntry");
-        setOutputData(7);
-    }
-
-    @Override
-    public void onExit() {
-        System.out.println("ShootingCamera_Focusing::onExit");
-    }
-
-    @Override
-    public void on_do() {
-        System.out.println("ShootingCamera_Focusing::on_do");
-    }
-
-    @Override
-    public void EvInFocus(TimedLong param){
-        System.out.println("ShootingCamera_Focusing::EvInFocus");
-        setState(new State(ShootingCamera_Focused.class));
-    }
-
-    @Override
-    public void EvShutterFull(TimedLong param){
-        System.out.println("ShootingCamera_Focusing::EvShutterFull");
-        Class<?>[] args = new Class<?>[1];
-        args[0] = param.getClass();
-        defer(new Event("EvShutterFull",args,param));
-    }
-}
-
-
-
-

Deleted: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/ShootingCamera_Shooting.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/ShootingCamera_Shooting.java	2017-02-07 06:31:32 UTC (rev 935)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/ShootingCamera_Shooting.java	2017-02-07 06:39:01 UTC (rev 936)
@@ -1,33 +0,0 @@
-package RTMExamples.StaticFsm;
-
-import jp.go.aist.rtm.RTC.jfsm.DeepHistory;
-import jp.go.aist.rtm.RTC.jfsm.State;
-
-import RTC.TimedLong;
-/**
- * 
- */
- at DeepHistory
-public class ShootingCamera_Shooting extends ShootingCamera {
-
-    @Override
-    public void onEntry() {
-        System.out.println("ShootingCamera_Shooting::onEntry");
-        setOutputData(6);
-    }
-
-    @Override
-    public void onInit() {
-        System.out.println("ShootingCamera_Shooting::onInit");
-        setState(new State(ShootingCamera_Focusing.class));
-    }
-
-    @Override
-    public void on_do() {
-        System.out.println("ShootingCamera_Shooting::on_do");
-    }
-
-}
-
-
-

Deleted: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/ShootingCamera_Storing.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/ShootingCamera_Storing.java	2017-02-07 06:31:32 UTC (rev 935)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/ShootingCamera_Storing.java	2017-02-07 06:39:01 UTC (rev 936)
@@ -1,32 +0,0 @@
-package RTMExamples.StaticFsm;
-
-import jp.go.aist.rtm.RTC.jfsm.DeepHistory;
-import jp.go.aist.rtm.RTC.jfsm.State;
-
-import RTC.TimedLong;
-/**
- * 
- */
- at DeepHistory
-public class ShootingCamera_Storing extends ShootingCamera_Shooting {
-
-
-    @Override
-    public void onEntry() {
-        System.out.println("ShootingCamera_Storing::onEntry");
-        setOutputData(9);
-    }
-
-    @Override
-    public void onExit() {
-        System.out.println("ShootingCamera_Storing::onExit");
-    }
-
-    @Override
-    public void on_do() {
-        System.out.println("ShootingCamera_Storing::on_do");
-    }
-
-}
-
-

Deleted: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/StaticFsm.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/StaticFsm.java	2017-02-07 06:31:32 UTC (rev 935)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/StaticFsm.java	2017-02-07 06:39:01 UTC (rev 936)
@@ -1,53 +0,0 @@
-package RTMExamples.StaticFsm;
-/**
- * {@.ja StaticFsm}
- * {@.en StaticFsm}
- *
- */
-
-import jp.go.aist.rtm.RTC.Manager;
-import jp.go.aist.rtm.RTC.RTObject_impl;
-import jp.go.aist.rtm.RTC.RtcDeleteFunc;
-import jp.go.aist.rtm.RTC.RtcNewFunc;
-import jp.go.aist.rtm.RTC.RegisterModuleFunc;
-import jp.go.aist.rtm.RTC.util.Properties;
-
-/**
- * {@.ja Definition class}
- * {@.en Definition class}
- * <p>
- * {@.ja The class where ComponentProfile(etc) was defined.}
- * {@.en The class where ComponentProfile(etc) was defined.}
- */
-public class StaticFsm implements RtcNewFunc, RtcDeleteFunc, RegisterModuleFunc {
-
-//  Module specification
-//  <rtc-template block="module_spec">
-    public static String component_conf[] = {
-        "implementation_id", "StaticFsm",
-        "type_name",         "StaticFsm",
-        "description",       "StaticFsm",
-        "version",           "1.0.0",
-        "vendor",            "Noriaki Ando, AIST",
-        "category",          "example",
-        "activity_type",     "STATIC",
-        "max_instance",      "1",
-        "language",          "Java",
-        "lang_type",         "compile",
-        ""
-            };
-//  </rtc-template>
-
-    public RTObject_impl createRtc(Manager mgr) {
-        return new StaticFsmImpl(mgr);
-    }
-
-    public void deleteRtc(RTObject_impl rtcBase) {
-        rtcBase = null;
-    }
-    public void registerModule() {
-        Properties prop = new Properties(component_conf);
-        final Manager manager = Manager.instance();
-        manager.registerFactory(prop, new StaticFsm(), new StaticFsm());
-    }
-}

Deleted: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/StaticFsmComp.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/StaticFsmComp.java	2017-02-07 06:31:32 UTC (rev 935)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/StaticFsmComp.java	2017-02-07 06:39:01 UTC (rev 936)
@@ -1,122 +0,0 @@
-package RTMExamples.StaticFsm;
-/**
- * 
- * {@.ja Standalone component}
- * {@.en Standalone component}
- *
- */
-
-import jp.go.aist.rtm.RTC.Manager;
-import jp.go.aist.rtm.RTC.ModuleInitProc;
-import jp.go.aist.rtm.RTC.RTObject_impl;
-import jp.go.aist.rtm.RTC.util.NVUtil;
-import jp.go.aist.rtm.RTC.util.Properties;
-
-import RTC.ComponentProfile;
-import RTC.PortService;
-import RTC.PortServiceListHolder;
-import RTC.PortInterfacePolarity;
-import RTC.PortInterfaceProfileListHolder;
-import RTC.RTObject;
-import RTC.RTObjectHelper;
-
-import _SDOPackage.NVListHolder;
-/**
- * {@.ja Sample component of static FSM}
- * {@.en Sample component of static FSM}
- *
- */
-public class StaticFsmComp implements ModuleInitProc {
-
-    public void myModuleInit(Manager mgr) {
-        Properties prop = new Properties(StaticFsm.component_conf);
-        mgr.registerFactory(prop, new StaticFsm(), new StaticFsm());
-
-        // Create a component
-        System.out.println("Creating a component: \"StaticFsm\"....");
-        RTObject_impl comp = mgr.createComponent("StaticFsm");
-        if( comp==null ) {
-    	    System.err.println("Component create failed.");
-    	    System.exit(0);
-        }
-        System.out.println("succeed.");
-      
-        ComponentProfile prof = comp.get_component_profile();
-        System.out.println( "=================================================" );
-        System.out.println( " Component Profile" );
-        System.out.println( "-------------------------------------------------" );
-        System.out.println( "InstanceID:     " + prof.instance_name );
-        System.out.println( "Implementation: " + prof.type_name );
-        System.out.println( "Description:    " + prof.description );
-        System.out.println( "Version:        " + prof.version );
-        System.out.println( "Maker:          " + prof.vendor );
-        System.out.println( "Category:       " + prof.category );
-        System.out.println( "  Other properties   " );
-        NVUtil.dump(new NVListHolder(prof.properties));
-        System.out.println( "=================================================" );
-        // Example
-        // The following procedure is examples how handle RT-Components.
-        // These should not be in this function.
-
-        // Get the component's object reference
-        Manager manager = Manager.instance();
-        RTObject rtobj = null;
-        try {
-            rtobj = RTObjectHelper.narrow(manager.getPOA().servant_to_reference(comp));
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
-        // Get the port list of the component
-        PortServiceListHolder ports = new PortServiceListHolder();
-        ports.value = rtobj.get_ports();
-
-        // getting port profiles
-        System.out.println( "Number of Ports: " );
-        System.out.println( ports.value.length );
-        for( int intIdx=0;intIdx<ports.value.length;++intIdx ) {
-            PortService port = ports.value[intIdx];
-            System.out.println( "Port" + intIdx + " (name): ");
-            System.out.println( port.get_port_profile().name );
-        
-            PortInterfaceProfileListHolder iflist = new PortInterfaceProfileListHolder();
-            iflist.value = port.get_port_profile().interfaces;
-            System.out.println( "---interfaces---" );
-            for( int intIdx2=0;intIdx2<iflist.value.length;++intIdx2 ) {
-                System.out.println( "I/F name: " );
-                System.out.println( iflist.value[intIdx2].instance_name  );
-                System.out.println( "I/F type: " );
-                System.out.println( iflist.value[intIdx2].type_name );
-                if( iflist.value[intIdx2].polarity==PortInterfacePolarity.PROVIDED ) {
-                    System.out.println( "Polarity: PROVIDED" );
-                } else {
-                    System.out.println( "Polarity: REQUIRED" );
-                }
-            }
-            System.out.println( "---properties---" );
-            NVUtil.dump( new NVListHolder(port.get_port_profile().properties) );
-            System.out.println( "----------------" );
-        }  
-    }
-
-    public static void main(String[] args) {
-        // Initialize manager
-        final Manager manager = Manager.init(args);
-
-        // Set module initialization proceduer
-        // This procedure will be invoked in activateManager() function.
-        StaticFsmComp init = new StaticFsmComp();
-        manager.setModuleInitProc(init);
-
-        // Activate manager and register to naming service
-        manager.activateManager();
-
-        // run the manager in blocking mode
-        // runManager(false) is the default.
-        manager.runManager();
-
-        // If you want to run the manager in non-blocking mode, do like this
-        // manager.runManager(true);
-    }
-
-}

Deleted: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/StaticFsmImpl.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/StaticFsmImpl.java	2017-02-07 06:31:32 UTC (rev 935)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/StaticFsmImpl.java	2017-02-07 06:39:01 UTC (rev 936)
@@ -1,479 +0,0 @@
-package RTMExamples.StaticFsm;
-/**
- * {@.ja StaticFsmImpl}
- * {@.en StaticFsmImpl}
- */
-
-import java.lang.reflect.Array;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import java.util.ArrayDeque;
-import java.util.Queue;
-
-import jp.go.aist.rtm.RTC.DataFlowComponentBase;
-import jp.go.aist.rtm.RTC.Manager;
-import jp.go.aist.rtm.RTC.connectorListener.ReturnCode;
-import jp.go.aist.rtm.RTC.jfsm.Event;
-import jp.go.aist.rtm.RTC.jfsm.Machine;
-import jp.go.aist.rtm.RTC.jfsm.machine.EventBase;
-import jp.go.aist.rtm.RTC.port.ConnectorBase;
-import jp.go.aist.rtm.RTC.port.InPort;
-import jp.go.aist.rtm.RTC.port.OutPort;
-import jp.go.aist.rtm.RTC.port.ConnectorDataListenerT;
-import jp.go.aist.rtm.RTC.port.ConnectorDataListenerType;
-import jp.go.aist.rtm.RTC.util.DataRef;
-
-import RTC.TimedLong;
-import RTC.ReturnCode_t;
-
-/**
- * {@.ja Implemented class of a sample component of static FSM}
- * {@.en Implemented class of a sample component of static FSM}
- *
- */
-public class StaticFsmImpl extends DataFlowComponentBase {
-
-  /**
-   * {@.ja  constructor}
-   * {@.en  constructor}
-   * @param manager 
-   *   {@.ja Maneger Object}
-   *   {@.en Maneger Object}
-   */
-  public StaticFsmImpl(Manager manager) {  
-      super(manager);
-      // <rtc-template block="initializer">
-      m_EvConfig_val = new TimedLong();
-      initializeParam(m_EvConfig_val);
-      m_EvConfig = new DataRef<TimedLong>(m_EvConfig_val);
-      m_EvConfigIn = new InPort<TimedLong>("EvConfig", m_EvConfig);
-      m_EvInFocus_val = new TimedLong();
-      initializeParam(m_EvInFocus_val);
-      m_EvInFocus = new DataRef<TimedLong>(m_EvInFocus_val);
-      m_EvInFocusIn = new InPort<TimedLong>("EvInFocus", m_EvInFocus);
-      m_EvOff_val = new TimedLong();
-      initializeParam(m_EvOff_val);
-      m_EvOff = new DataRef<TimedLong>(m_EvOff_val);
-      m_EvOffIn = new InPort<TimedLong>("EvOff", m_EvOff);
-      m_EvOn_val = new TimedLong();
-      initializeParam(m_EvOn_val);
-      m_EvOn = new DataRef<TimedLong>(m_EvOn_val);
-      m_EvOnIn = new InPort<TimedLong>("EvOn", m_EvOn);
-      m_EvShutterFull_val = new TimedLong();
-      initializeParam(m_EvShutterFull_val);
-      m_EvShutterFull = new DataRef<TimedLong>(m_EvShutterFull_val);
-      m_EvShutterFullIn = new InPort<TimedLong>("EvShutterFull", m_EvShutterFull);
-      m_EvShutterHalf_val = new TimedLong();
-      initializeParam(m_EvShutterHalf_val);
-      m_EvShutterHalf = new DataRef<TimedLong>(m_EvShutterHalf_val);
-      m_EvShutterHalfIn = new InPort<TimedLong>("EvShutterHalf", m_EvShutterHalf);
-      m_EvShutterReleased_val = new TimedLong();
-      initializeParam(m_EvShutterReleased_val);
-      m_EvShutterReleased = new DataRef<TimedLong>(m_EvShutterReleased_val);
-      m_EvShutterReleasedIn = new InPort<TimedLong>("EvShutterReleased", m_EvShutterReleased);
-      m_out_val = new TimedLong();
-      m_out = new DataRef<TimedLong>(m_out_val);
-      m_outOut = new OutPort<TimedLong>("out", m_out);
-      // </rtc-template>
-
-  }
-
-  /**
-   *
-   * The initialize action (on CREATED->ALIVE transition)
-   * formaer rtc_init_entry() 
-   *
-   * @return RTC::ReturnCode_t
-   * 
-   * 
-   */
-  @Override
-  protected ReturnCode_t onInitialize() {
-      // Registration: InPort/OutPort/Service
-      // <rtc-template block="registration">
-      // Set InPort buffers
-      addInPort("EvConfig", m_EvConfigIn);
-      addInPort("EvInFocus", m_EvInFocusIn);
-      addInPort("EvOff", m_EvOffIn);
-      addInPort("EvOn", m_EvOnIn);
-      addInPort("EvShutterFull", m_EvShutterFullIn);
-      addInPort("EvShutterHalf", m_EvShutterHalfIn);
-      addInPort("EvShutterReleased", m_EvShutterReleasedIn);
-      
-      machine_ = new Machine<>(Top.class, CameraProtocol.class, null);
-      m_que = new ArrayDeque<Event>();
-
-
-      m_EvConfigIn.addConnectorDataListener(
-                            ConnectorDataListenerType.ON_RECEIVED,
-                            new DataListener("EvConfig",m_que));
-      m_EvInFocusIn.addConnectorDataListener(
-                            ConnectorDataListenerType.ON_RECEIVED,
-                            new DataListener("EvInFocus",m_que));
-      m_EvOffIn.addConnectorDataListener(
-                            ConnectorDataListenerType.ON_RECEIVED,
-                            new DataListener("EvOff",m_que));
-      m_EvOnIn.addConnectorDataListener(
-                            ConnectorDataListenerType.ON_RECEIVED,
-                            new DataListener("EvOn",m_que));
-      m_EvShutterFullIn.addConnectorDataListener(
-                            ConnectorDataListenerType.ON_RECEIVED,
-                            new DataListener("EvShutterFull",m_que));
-      m_EvShutterHalfIn.addConnectorDataListener(
-                            ConnectorDataListenerType.ON_RECEIVED,
-                            new DataListener("EvShutterHalf",m_que));
-      m_EvShutterReleasedIn.addConnectorDataListener(
-                            ConnectorDataListenerType.ON_RECEIVED,
-                            new DataListener("EvShutterReleased",m_que));
-
-      // Set OutPort buffer
-      addOutPort("out", m_outOut);
-      // </rtc-template>
-      
-      
-
-      return super.onInitialize();
-  }
-
-  /***
-   *
-   * The finalize action (on ALIVE->END transition)
-   * formaer rtc_exiting_entry()
-   *
-   * @return RTC::ReturnCode_t
-   * 
-   * 
-   */
-//    @Override
-//    protected ReturnCode_t onFinalize() {
-//        return super.onFinalize();
-//    }
-
-  /***
-   *
-   * The startup action when ExecutionContext startup
-   * former rtc_starting_entry()
-   *
-   * @param ec_id target ExecutionContext Id
-   *
-   * @return RTC::ReturnCode_t
-   * 
-   * 
-   */
-//    @Override
-//    protected ReturnCode_t onStartup(int ec_id) {
-//        return super.onStartup(ec_id);
-//    }
-
-  /***
-   *
-   * The shutdown action when ExecutionContext stop
-   * former rtc_stopping_entry()
-   *
-   * @param ec_id target ExecutionContext Id
-   *
-   * @return RTC::ReturnCode_t
-   * 
-   * 
-   */
-//    @Override
-//    protected ReturnCode_t onShutdown(int ec_id) {
-//        return super.onShutdown(ec_id);
-//    }
-
-  /***
-   *
-   * The activated action (Active state entry action)
-   * former rtc_active_entry()
-   *
-   * @param ec_id target ExecutionContext Id
-   *
-   * @return RTC::ReturnCode_t
-   * 
-   * 
-   */
-//    @Override
-//    protected ReturnCode_t onActivated(int ec_id) {
-//        return super.onActivated(ec_id);
-//    }
-
-  /***
-   *
-   * The deactivated action (Active state exit action)
-   * former rtc_active_exit()
-   *
-   * @param ec_id target ExecutionContext Id
-   *
-   * @return RTC::ReturnCode_t
-   * 
-   * 
-   */
-//    @Override
-//    protected ReturnCode_t onDeactivated(int ec_id) {
-//        return super.onDeactivated(ec_id);
-//    }
-
-  /**
-   *
-   * The execution action that is invoked periodically
-   * former rtc_active_do()
-   *
-   * @param ec_id target ExecutionContext Id
-   *
-   * @return RTC::ReturnCode_t
-   * 
-   * 
-   */
-  @Override
-  protected ReturnCode_t onExecute(int ec_id) {
-      synchronized (m_que) {
-          while (!m_que.isEmpty()) {
-              Event ev = m_que.poll();
-              machine_.dispatch(ev);
-          }
-      }
-      while (!machine_.current().isOutputData()) {
-          m_out_val.data = machine_.current().getOutputData();
-          System.out.println("output data: "  + m_out_val.data);
-          m_outOut.write();
-      }
-      machine_.current().on_do();
-      return super.onExecute(ec_id);
-  }
-
-  /***
-   *
-   * The aborting action when main logic error occurred.
-   * former rtc_aborting_entry()
-   *
-   * @param ec_id target ExecutionContext Id
-   *
-   * @return RTC::ReturnCode_t
-   * 
-   * 
-   */
-//  @Override
-//  public ReturnCode_t onAborting(int ec_id) {
-//      return super.onAborting(ec_id);
-//  }
-
-  /***
-   *
-   * The error action in ERROR state
-   * former rtc_error_do()
-   *
-   * @param ec_id target ExecutionContext Id
-   *
-   * @return RTC::ReturnCode_t
-   * 
-   * 
-   */
-//    @Override
-//    public ReturnCode_t onError(int ec_id) {
-//        return super.onError(ec_id);
-//    }
-
-  /***
-   *
-   * The reset action that is invoked resetting
-   * This is same but different the former rtc_init_entry()
-   *
-   * @param ec_id target ExecutionContext Id
-   *
-   * @return RTC::ReturnCode_t
-   * 
-   * 
-   */
-//    @Override
-//    protected ReturnCode_t onReset(int ec_id) {
-//        return super.onReset(ec_id);
-//    }
-
-  /***
-   *
-   * The state update action that is invoked after onExecute() action
-   * no corresponding operation exists in OpenRTm-aist-0.2.0
-   *
-   * @param ec_id target ExecutionContext Id
-   *
-   * @return RTC::ReturnCode_t
-   * 
-   * 
-   */
-//    @Override
-//    protected ReturnCode_t onStateUpdate(int ec_id) {
-//        return super.onStateUpdate(ec_id);
-//    }
-
-  /***
-   *
-   * The action that is invoked when execution context's rate is changed
-   * no corresponding operation exists in OpenRTm-aist-0.2.0
-   *
-   * @param ec_id target ExecutionContext Id
-   *
-   * @return RTC::ReturnCode_t
-   * 
-   * 
-   */
-//    @Override
-//    protected ReturnCode_t onRateChanged(int ec_id) {
-//        return super.onRateChanged(ec_id);
-//    }
-//
-  // DataInPort declaration
-  // <rtc-template block="inport_declare">
-  protected TimedLong m_EvConfig_val;
-  protected DataRef<TimedLong> m_EvConfig;
-  /*!
-   */
-  protected InPort<TimedLong> m_EvConfigIn;
-
-  protected TimedLong m_EvInFocus_val;
-  protected DataRef<TimedLong> m_EvInFocus;
-  /*!
-   */
-  protected InPort<TimedLong> m_EvInFocusIn;
-
-  protected TimedLong m_EvOff_val;
-  protected DataRef<TimedLong> m_EvOff;
-  /*!
-   */
-  protected InPort<TimedLong> m_EvOffIn;
-
-  protected TimedLong m_EvOn_val;
-  protected DataRef<TimedLong> m_EvOn;
-  /*!
-   */
-  protected InPort<TimedLong> m_EvOnIn;
-
-  protected TimedLong m_EvShutterFull_val;
-  protected DataRef<TimedLong> m_EvShutterFull;
-  /*!
-   */
-  protected InPort<TimedLong> m_EvShutterFullIn;
-
-  protected TimedLong m_EvShutterHalf_val;
-  protected DataRef<TimedLong> m_EvShutterHalf;
-  /*!
-   */
-  protected InPort<TimedLong> m_EvShutterHalfIn;
-
-  protected TimedLong m_EvShutterReleased_val;
-  protected DataRef<TimedLong> m_EvShutterReleased;
-  /*!
-   */
-  protected InPort<TimedLong> m_EvShutterReleasedIn;
-
-    
-  // </rtc-template>
-
-  // DataOutPort declaration
-  // <rtc-template block="outport_declare">
-  protected TimedLong m_out_val;
-  protected DataRef<TimedLong> m_out;
-  /*!
-   */
-  protected OutPort<TimedLong> m_outOut;
-
-  private Machine<Top, CameraProtocol> machine_;
-  private Queue<Event> m_que;
-    
-  // </rtc-template>
-
-  // CORBA Port declaration
-  // <rtc-template block="corbaport_declare">
-    
-  // </rtc-template>
-
-  // Service declaration
-  // <rtc-template block="service_declare">
-    
-  // </rtc-template>
-
-  // Consumer declaration
-  // <rtc-template block="consumer_declare">
-    
-  // </rtc-template>
-
-
-  private void initializeParam(Object target) {
-      Class<?> targetClass = target.getClass();
-      ClassLoader loader = target.getClass().getClassLoader();
-      //
-      Field[] fields = targetClass.getFields();
-      for(Field field : fields) {
-          if(field.getType().isPrimitive()) continue;
-			
-          try {
-              if(field.getType().isArray()) {
-                  Object arrayValue = null;
-                  Class<?> clazz = null;
-                  if(field.getType().getComponentType().isPrimitive()) {
-                      clazz = field.getType().getComponentType();
-                  } else {
-                      clazz = loader.loadClass(field.getType().getComponentType().getName());
-                  }
-                  arrayValue = Array.newInstance(clazz, 0);
-                  field.set(target, arrayValue);
-
-              } else {
-                  Constructor<?>[] constList = field.getType().getConstructors();
-                  if(constList.length==0) {
-                      Method[] methodList = field.getType().getMethods();
-                      for(Method method : methodList) {
-                          if(method.getName().equals("from_int")==false) continue;
-                              Object objFld = method.invoke(target, new Object[]{ new Integer(0) });
-                              field.set(target, objFld);
-                              break;
-                      }
-                  } else {
-                      Class<?> classFld = Class.forName(field.getType().getName(), true, loader);
-                      Object objFld = classFld.newInstance();
-                      initializeParam(objFld);
-                      field.set(target, objFld);
-                  }
-              }
-          } catch (ClassNotFoundException e) {
-              e.printStackTrace();
-          } catch (InstantiationException e) {
-              e.printStackTrace();
-          } catch (IllegalAccessException e) {
-              e.printStackTrace();
-          } catch (IllegalArgumentException e) {
-              e.printStackTrace();
-          } catch (InvocationTargetException e) {
-              e.printStackTrace();
-          }
-      }
-  }
-
-  class DataListener extends ConnectorDataListenerT<TimedLong>{
-      public DataListener(final String name, Queue<Event> que){
-          super(TimedLong.class);
-          m_name = name;
-          m_que = que;
-      }
-
-      public ReturnCode operator(ConnectorBase.ConnectorInfo arg,
-                             TimedLong data) {
-          ConnectorBase.ConnectorInfo info =(ConnectorBase.ConnectorInfo)arg;
-          System.out.println("------------------------------");
-          System.out.println("Listener:       "+m_name);
-          System.out.println("Data:           "+data.data);
-          System.out.println("------------------------------");
-          synchronized (m_que) {
-              Class<?>[] args = new Class<?>[1];
-              args[0] = data.getClass();
-              m_que.offer(new Event(m_name,args,(Object)data));
-          }
-          return ReturnCode.NO_CHANGE;
-      }
-
-      private String m_name;
-      private Queue<Event> m_que;
-  }
-}

Modified: trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Top.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Top.java	2017-02-07 06:31:32 UTC (rev 935)
+++ trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/StaticFsm/Top.java	2017-02-07 06:39:01 UTC (rev 936)
@@ -12,39 +12,18 @@
 /**
  * 
  */
-//@DataType(Top.Data.class)
-public class Top extends StateDef implements CameraProtocol {
+ at DataType(Top.Data.class)
+public class Top extends StateDef implements MicrowaveProtocol {
 
-/*
     public static class Data {
 
         private int myCookingTime;
-// pyfsm/test/api_test.py:10
-//    class Data(object):
-//        def __init__(self):
-//            self.my_cooking_time = 0
-//
-//        def print_timer(self):
-//            pyfsm_logger.debug("  Timer set to {0} minutes".format(self.my_cooking_time))
-//
-//        def increment_timer(self):
-//            self.my_cooking_time += 1
-//
-//        def decrement_timer(self):
-//            self.my_cooking_time -= 1
-//
-//        def reset_timer(self):
-//            self.my_cooking_time = 0
-//
-//        def get_remaining_time(self):
-//            return self.my_cooking_time
-
         public Data() {
             myCookingTime = 0;
         }
 
         public void printTimer() {
-            LOGGER.debug("  Timer set to {} minutes", myCookingTime);
+            System.out.println("  Timer set to {} minutes"+ myCookingTime);
         }
 
         public void incrementTimer() {
@@ -63,67 +42,52 @@
             return myCookingTime;
         }
     }
-*/
 
     @Override
-    public void onEntry() {
-        System.out.println("Top::onEntry");
-        setOutputData(0);
+    public void onInit() {
+        System.out.println("[Microwave] TOP::onInit()");
+        setState(new State(Operational.class));
     }
 
     @Override
-    public void onInit() {
-        System.out.println("Top::onInit");
-        setState(new State(Off.class));
+    public void onEntry() {
+        System.out.println("[Microwave] TOP::onEntry()");
     }
 
     @Override
     public void onExit() {
-        System.out.println("Top::onExit");
+        System.out.println("[Microwave] TOP::onExit()");
     }
 
     @Override
-    public void on_do() {
-        System.out.println("Top::on_do");
+    public void open() {
+        // do nothing
     }
 
     @Override
-    public void EvOn(TimedLong param){ 
+    public void close() {
+        // do nothing
     }
+
     @Override
-    public void EvOff(TimedLong param){ 
+    public void minute() {
+        // do nothing
     }
+
     @Override
-    public void EvConfig(TimedLong param){
+    public void start() {
+        // do nothing
     }
-    @Override
-    public void EvInFocus(TimedLong param){
-    }
-    @Override
-    public void EvShutterHalf(TimedLong param){
-    }
-    @Override
-    public void EvShutterFull(TimedLong param){
-    }
-    @Override
-    public void EvShutterReleased(TimedLong param){
-    }
 
     @Override
-    public int getOutputData() {
-        return m_que.poll();
+    public void stop() {
+        // do nothing
     }
 
     @Override
-    public boolean isOutputData() {
-        return m_que.isEmpty();
+    public void tick() {
+        // do nothing
     }
 
-    protected void setOutputData(int val) {
-         m_que.offer(val);
-    }
-
-    private int m_val;
-    private static Queue<Integer> m_que = new ArrayDeque<Integer>();;
 }
 



More information about the openrtm-commit mailing list