[openrtm-commit:02344] r2895 - in branches/FSM4RTC/OpenRTM-aist/examples: . StaticFsm
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 1月 28日 (土) 23:28:40 JST
Author: n-ando
Date: 2017-01-28 23:28:40 +0900 (Sat, 28 Jan 2017)
New Revision: 2895
Added:
branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/
branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/ConnectorComp.cpp
branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Display.cpp
branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Display.h
branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/DisplayComp.cpp
branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Inputbutton.cpp
branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Inputbutton.h
branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/InputbuttonComp.cpp
branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Makefile.am
branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Microwave.cpp
branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Microwave.h
branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/MicrowaveComp.cpp
branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/MicrowaveFsm.cpp
branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/MicrowaveFsm.h
branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/display.conf
branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/inputbutton.conf
branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/microwave.conf
branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/rtc.conf
branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/run.sh
Log:
[FSM4RTC,example] StaticFsm sample which is for new Static FSM framework has been added. refs #3655
Property changes on: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm
___________________________________________________________________
Added: svn:ignore
+ Makefile.in
Makefile
Added: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/ConnectorComp.cpp
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/ConnectorComp.cpp (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/ConnectorComp.cpp 2017-01-28 14:28:40 UTC (rev 2895)
@@ -0,0 +1,289 @@
+// -*- C++ -*-
+/*!
+ * @file ConnectorComp.cpp
+ * @brief connector application
+ * @date $Date: 2008-01-13 07:24:08 $
+ *
+ * Copyright (c) 2003-2007 Noriaki Ando <n-ando at aist.go.jp>
+ * Task-intelligence Research Group,
+ * Intelligent System Research Institute,
+ * National Institute of Industrial Science (AIST), Japan
+ * All rights reserved.
+ *
+ * $Id: ConnectorComp.cpp 2523 2014-03-14 01:48:15Z n-ando $
+ */
+
+#include <iostream>
+#include <vector>
+#include <string>
+#include <rtm/CorbaNaming.h>
+#include <rtm/RTObject.h>
+#include <rtm/NVUtil.h>
+#include <rtm/CORBA_SeqUtil.h>
+#include <rtm/CorbaConsumer.h>
+#include <assert.h>
+#include <coil/stringutil.h>
+
+
+using namespace RTC;
+
+#ifdef __QNX__
+using std::exit;
+#endif
+
+void usage()
+{
+ std::cout << std::endl;
+ std::cout << "usage: ConnectorComp [options].." << std::endl;
+ std::cout << std::endl;
+ std::cout << " --port * ";
+ std::cout << ": Set port no 2809 (default:9876)" << std::endl;
+ std::cout << " --origin * ";
+ std::cout << ": Set origin of connection OUT (default:IN)" << std::endl;
+ std::cout << " : Set origin OUT , ConsoleOut -> ConsoleIn" << std::endl;
+ std::cout << " : default connection, ConsoleIn -> ConsoleOut" << std::endl;
+ std::cout << " --flush ";
+ std::cout << ": Set subscription type flush (default:flush)" << std::endl;
+ std::cout << " --new ";
+ std::cout << ": Set subscription type new" << std::endl;
+ std::cout << " --periodic [Hz] ";
+ std::cout << ": Set subscription type periodic" << std::endl;
+ std::cout << " --policy [any] ";
+ std::cout << ": Set push policy ALL or FIFO or SKIP or NEW" << std::endl;
+ std::cout << " --skip [n] ";
+ std::cout << ": Set skip count 0..n" << std::endl;
+ std::cout << " --endian * ";
+ std::cout << ": Set endian type Little or Big" << std::endl;
+ std::cout << " --buffer : Set buffer configuration" << std::endl;
+ std::cout << " --buffer [inport|outport].buffer.[length|[read|write.[policy|timeout]] value" << std::endl;
+ std::cout << " policy: [write.full_policy,read.empty_policy]" << std::endl;
+ std::cout << " timeout: [write.timeout,read.timeout]" << std::endl;
+ std::cout << " value: " << std::endl;
+ std::cout << " full_policy: [overwrite, do_nothing, block]" << std::endl;
+ std::cout << " empty_policy: [readback, do_nothing, block]" << std::endl;
+ std::cout << " timeout: sec (e.g. 1.0)" << std::endl;
+ std::cout << " length: The length of the ring buffer. (e.g. 10)" << std::endl;
+ std::cout << std::endl;
+ std::cout << "exsample:" << std::endl;
+ std::cout << " ConnectorComp --port 2809 --origin OUT" << std::endl;
+ std::cout << " ConnectorComp --flush" << std::endl;
+ std::cout << " ConnectorComp --new" << std::endl;
+ std::cout << " ConnectorComp --new --policy ALL" << std::endl;
+ std::cout << " ConnectorComp --new --policy SKIP --skip 100" << std::endl;
+ std::cout << " ConnectorComp --periodic 10" << std::endl;
+ std::cout << " ConnectorComp --periodic 10 --policy FIFO" << std::endl;
+ std::cout << " ConnectorComp --periodic 10 --policy NEW" << std::endl;
+ std::cout << " ConnectorComp --flush --endian Little" << std::endl;
+ std::cout << " ConnectorComp --buffer inport.buffer.read.empty_policy block \\" << std::endl;
+ std::cout << " --buffer inport.buffer.read.timeout 0.1 \\ " << std::endl;
+ std::cout << " --buffer inport.buffer.length 10 " << std::endl;
+ std::cout << std::endl;
+}
+
+int main (int argc, char** argv)
+{
+ int _argc(0);
+ char** _argv(0);
+
+ std::string subs_type("flush");
+ std::string period;
+ std::string push_policy;
+ std::string skip_count;
+ std::string endian;
+ std::string port_no("9876");
+ std::string connect_origin("in");
+ std::map<std::string, std::string> buffer_prop;
+
+ if (argc < 2)
+ {
+ usage();
+ }
+
+ for (int i = 1; i < argc; ++i)
+ {
+ std::string arg(argv[i]);
+ coil::normalize(arg);
+ if (arg == "--flush") subs_type = "flush";
+ else if (arg == "--new") subs_type = "new";
+ else if (arg == "--periodic")
+ {
+ subs_type = "periodic";
+ if (++i < argc) period = argv[i];
+ else period = "1.0";
+ }
+ else if (arg == "--help")
+ {
+ usage();
+ exit(1);
+ }
+ else if (arg == "--policy")
+ {
+ if (++i < argc)
+ {
+ std::string arg2(argv[i]);
+ coil::normalize(arg2);
+ push_policy = arg2;
+ }
+ else push_policy = "new";
+ }
+ else if (arg == "--skip")
+ {
+ if (++i < argc) skip_count = argv[i];
+ else skip_count = "0";
+ }
+
+ if (arg == "--endian")
+ {
+ if (++i < argc)
+ {
+ std::string arg2(argv[i]);
+ coil::normalize(arg2);
+ endian = arg2;
+ }
+ else endian = "";
+ }
+ if (arg == "--port")
+ {
+ if (++i < argc)
+ {
+ port_no = argv[i];
+ }
+ }
+ if (arg == "--origin")
+ {
+ if (++i < argc)
+ {
+ std::string arg2(argv[i]);
+ coil::normalize(arg2);
+ connect_origin = arg2;
+ }
+ }
+ if (arg == "--buffer")
+ {
+ if (++i < argc)
+ {
+ std::string key(argv[i]);
+ key = coil::normalize(key);
+ std::string val(argv[++i]);
+ val = coil::normalize(val);
+ buffer_prop.insert(std::pair< std::string, std::string >(key,val));
+ }
+ }
+ }
+
+ CORBA::ORB_var orb = CORBA::ORB_init(_argc, _argv);
+ std::string name_server("localhost:");
+ name_server.append(port_no);
+ CorbaNaming naming(orb, name_server.c_str());
+
+ CorbaConsumer<RTObject> conin, conout;
+ PortServiceList_var pin;
+ PortServiceList_var pout;
+
+ // option dump
+ std::cout << " Name Server: " << name_server << std::endl;
+ std::cout << "Subscription Type: " << subs_type << std::endl;
+ if (period != "")
+ std::cout << " Period: " << period << " [Hz]" << std::endl;
+
+ std::cout << " push policy: " << push_policy << std::endl;
+ std::cout << " skip count: " << skip_count << std::endl;
+
+ if (endian != "")
+ std::cout << " endian: " << endian << std::endl;
+
+ if (connect_origin == "in")
+ std::cout << " connect: ConsoleIn -> ConsoleOut" << std::endl;
+ else
+ std::cout << " connect: ConsoleOut -> ConsoleIn" << std::endl;
+ std::cout << std::endl;
+
+ // find ConsoleIn0 component
+ conin.setObject(naming.resolve("ConsoleIn0.rtc"));
+
+ // get ports
+ pin = conin->get_ports();
+ pin[(CORBA::ULong)0]->disconnect_all();
+ assert(pin->length() > 0);
+ // activate ConsoleIn0
+ ExecutionContextList_var eclisti;
+ eclisti = conin->get_owned_contexts();
+ eclisti[(CORBA::ULong)0]->activate_component(RTObject::_duplicate(conin._ptr()));
+
+ // find ConsoleOut0 component
+ conout.setObject(naming.resolve("ConsoleOut0.rtc"));
+ // get ports
+ pout = conout->get_ports();
+ pout[(CORBA::ULong)0]->disconnect_all();
+ assert(pout->length() > 0);
+ // activate ConsoleOut0
+ ExecutionContextList_var eclisto;
+ eclisto = conout->get_owned_contexts();
+ eclisto[(CORBA::ULong)0]->activate_component(RTObject::_duplicate(conout._ptr()));
+
+ // connect ports
+ ConnectorProfile prof;
+ prof.connector_id = (char*)"";
+ prof.name = CORBA::string_dup("connector0");
+ prof.ports.length(2);
+ prof.ports[0] = pin[(CORBA::ULong)0];
+ prof.ports[1] = pout[(CORBA::ULong)0];
+ CORBA_SeqUtil::push_back(prof.properties,
+ NVUtil::newNV("dataport.interface_type",
+ "corba_cdr"));
+ CORBA_SeqUtil::push_back(prof.properties,
+ NVUtil::newNV("dataport.dataflow_type",
+ "push"));
+ if (subs_type != "")
+ CORBA_SeqUtil::push_back(prof.properties,
+ NVUtil::newNV("dataport.subscription_type",
+ subs_type.c_str()));
+ else
+ CORBA_SeqUtil::push_back(prof.properties,
+ NVUtil::newNV("dataport.subscription_type",
+ "flush"));
+ if (subs_type == "periodic" && period != "")
+ CORBA_SeqUtil::push_back(prof.properties,
+ NVUtil::newNV("dataport.publisher.push_rate",
+ period.c_str()));
+ if (push_policy != "")
+ CORBA_SeqUtil::push_back(prof.properties,
+ NVUtil::newNV("dataport.publisher.push_policy",
+ push_policy.c_str()));
+ if (push_policy == "skip" && skip_count != "")
+ CORBA_SeqUtil::push_back(prof.properties,
+ NVUtil::newNV("dataport.publisher.skip_count",
+ skip_count.c_str()));
+ if (endian != "")
+ CORBA_SeqUtil::push_back(prof.properties,
+ NVUtil::newNV("dataport.serializer.cdr.endian",
+ endian.c_str()));
+
+ std::map<std::string, std::string>::iterator it=buffer_prop.begin();
+ while (it != buffer_prop.end()) {
+ std::string key("dataport.");
+ key += it->first;
+ CORBA_SeqUtil::push_back(prof.properties,
+ NVUtil::newNV(key.c_str(),
+ it->second.c_str()));
+ ++it;
+ }
+
+ ReturnCode_t ret;
+ if (connect_origin == "in")
+ {
+ ret = pin[(CORBA::ULong)0]->connect(prof);
+ }
+ else
+ {
+ ret = pout[(CORBA::ULong)0]->connect(prof);
+ }
+
+ assert(ret == RTC::RTC_OK);
+
+ std::cout << "Connector ID: " << prof.connector_id << std::endl;
+ NVUtil::dump(prof.properties);
+
+ orb->destroy();
+ exit(1);
+}
Property changes on: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/ConnectorComp.cpp
___________________________________________________________________
Added: svn:executable
+ *
Added: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Display.cpp
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Display.cpp (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Display.cpp 2017-01-28 14:28:40 UTC (rev 2895)
@@ -0,0 +1,126 @@
+// -*- C++ -*-
+/*!
+ * @file Display.cpp
+ * @brief Display oven FSM sample component
+ * $Date$
+ *
+ * $Id$
+ */
+
+#include "Display.h"
+
+// Module specification
+// <rtc-template block="module_spec">
+static const char* consoleout_spec[] =
+ {
+ "implementation_id", "Display",
+ "type_name", "Display",
+ "description", "Console output component",
+ "version", "1.0",
+ "vendor", "Noriaki Ando, AIST",
+ "category", "example",
+ "activity_type", "DataFlowComponent",
+ "max_instance", "10",
+ "language", "C++",
+ "lang_type", "compile",
+ ""
+ };
+// </rtc-template>
+
+Display::Display(RTC::Manager* manager)
+ : RTC::DataFlowComponentBase(manager),
+ // <rtc-template block="initializer">
+ m_inIn("in", m_in)
+
+ // </rtc-template>
+{
+ // Registration: InPort/OutPort/Service
+ // <rtc-template block="registration">
+ // Set InPort buffers
+
+ // Set OutPort buffer
+
+ // Set service provider to Ports
+
+ // Set service consumers to Ports
+
+ // Set CORBA Service Ports
+
+ // </rtc-template>
+
+}
+
+Display::~Display()
+{
+}
+
+
+RTC::ReturnCode_t Display::onInitialize()
+{
+ addInPort("in", m_inIn);
+
+ m_inIn.addConnectorDataListener(ON_BUFFER_WRITE,
+ new DataListener("ON_BUFFER_WRITE"));
+ m_inIn.addConnectorDataListener(ON_BUFFER_FULL,
+ new DataListener("ON_BUFFER_FULL"));
+ m_inIn.addConnectorDataListener(ON_BUFFER_WRITE_TIMEOUT,
+ new DataListener("ON_BUFFER_WRITE_TIMEOUT"));
+ m_inIn.addConnectorDataListener(ON_BUFFER_OVERWRITE,
+ new DataListener("ON_BUFFER_OVERWRITE"));
+ m_inIn.addConnectorDataListener(ON_BUFFER_READ,
+ new DataListener("ON_BUFFER_READ"));
+ m_inIn.addConnectorDataListener(ON_SEND,
+ new DataListener("ON_SEND"));
+ m_inIn.addConnectorDataListener(ON_RECEIVED,
+ new DataListener("ON_RECEIVED"));
+ m_inIn.addConnectorDataListener(ON_RECEIVER_FULL,
+ new DataListener("ON_RECEIVER_FULL"));
+ m_inIn.addConnectorDataListener(ON_RECEIVER_TIMEOUT,
+ new DataListener("ON_RECEIVER_TIMEOUT"));
+
+ m_inIn.addConnectorListener(ON_BUFFER_EMPTY,
+ new ConnListener("ON_BUFFER_EMPTY"));
+ m_inIn.addConnectorListener(ON_BUFFER_READ_TIMEOUT,
+ new ConnListener("ON_BUFFER_READ_TIMEOUT"));
+ m_inIn.addConnectorListener(ON_SENDER_EMPTY,
+ new ConnListener("ON_SENDER_EMPTY"));
+ m_inIn.addConnectorListener(ON_SENDER_TIMEOUT,
+ new ConnListener("ON_SENDER_TIMEOUT"));
+ m_inIn.addConnectorListener(ON_SENDER_ERROR,
+ new ConnListener("ON_SENDER_ERROR"));
+ m_inIn.addConnectorListener(ON_CONNECT,
+ new ConnListener("ON_CONNECT"));
+ m_inIn.addConnectorListener(ON_DISCONNECT,
+ new ConnListener("ON_DISCONNECT"));
+
+ // m_machine = new Macho::Machine<Example::Top>(Macho::State<Example::Top>(11));
+
+ return RTC::RTC_OK;
+}
+
+RTC::ReturnCode_t Display::onExecute(RTC::UniqueId ec_id)
+{
+ if (m_inIn.isNew())
+ {
+ m_inIn.read();
+ std::cout << "Received: " << m_in.data << std::endl;
+ std::cout << "TimeStamp: " << m_in.tm.sec << "[s] ";
+ std::cout << m_in.tm.nsec << "[ns]" << std::endl;
+ }
+ coil::usleep(1000);
+
+ return RTC::RTC_OK;
+}
+
+extern "C"
+{
+ void DisplayInit(RTC::Manager* manager)
+ {
+ coil::Properties profile(consoleout_spec);
+ manager->registerFactory(profile,
+ RTC::Create<Display>,
+ RTC::Delete<Display>);
+ }
+};
+
+
Property changes on: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Display.cpp
___________________________________________________________________
Added: svn:executable
+ *
Added: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Display.h
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Display.h (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Display.h 2017-01-28 14:28:40 UTC (rev 2895)
@@ -0,0 +1,189 @@
+// -*- C++ -*-
+/*!
+ * @file Display.h
+ * @brief Display oven FSM example component
+ * @date $Date$
+ *
+ * $Id$
+ */
+
+#ifndef DISPLAY_H
+#define DISPLAY_H
+
+#include <rtm/idl/BasicDataTypeSkel.h>
+#include <rtm/Manager.h>
+#include <rtm/DataFlowComponentBase.h>
+#include <rtm/CorbaPort.h>
+#include <rtm/DataInPort.h>
+#include <rtm/DataOutPort.h>
+#include <rtm/ConnectorListener.h>
+#include <rtm/Macho.h>
+#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
+
+#include <iostream>
+
+// Service implementation headers
+// <rtc-template block="service_impl_h">
+
+// </rtc-template>
+
+// Service Consumer stub headers
+// <rtc-template block="consumer_stub_h">
+
+// </rtc-template>
+
+using namespace RTC;
+class Display;
+
+
+class DataListener
+ : public ConnectorDataListenerT<RTC::TimedLong>
+{
+ USE_CONNLISTENER_STATUS;
+public:
+ DataListener(const char* name) : m_name(name) {}
+ virtual ~DataListener()
+ {
+ std::cout << "dtor of " << m_name << std::endl;
+ }
+
+ virtual ReturnCode operator()(ConnectorInfo& info,
+ TimedLong& data)
+ {
+ std::cout << "------------------------------" << std::endl;
+ std::cout << "Data Listener: " << m_name << std::endl;
+ std::cout << "Profile::name: " << info.name << std::endl;
+ std::cout << "Profile::id: " << info.id << std::endl;
+// std::cout << "Profile::properties: " << std::endl;
+// std::cout << info.properties;
+// std::cout << std::endl;
+ std::cout << "Data: " << data.data << std::endl;
+ std::cout << "------------------------------" << std::endl;
+ return NO_CHANGE;
+ };
+ std::string m_name;
+};
+
+
+class ConnListener
+ : public ConnectorListener
+{
+ USE_CONNLISTENER_STATUS;
+public:
+ ConnListener(const char* name) : m_name(name) {}
+ virtual ~ConnListener()
+ {
+ std::cout << "dtor of " << m_name << std::endl;
+ }
+
+ virtual ReturnCode operator()(ConnectorInfo& info)
+ {
+ std::cout << "------------------------------" << std::endl;
+ std::cout << "Connector Listener: " << m_name << std::endl;
+ std::cout << "Profile::name: " << info.name << std::endl;
+ std::cout << "Profile::id: " << info.id << std::endl;
+ std::cout << "Profile::properties: " << std::endl;
+ std::cout << info.properties;
+ std::cout << std::endl;
+ std::cout << "------------------------------" << std::endl;
+ return NO_CHANGE;
+ };
+ std::string m_name;
+};
+
+
+class Display
+ : public RTC::DataFlowComponentBase
+{
+ public:
+ Display(RTC::Manager* manager);
+ ~Display();
+
+ // The initialize action (on CREATED->ALIVE transition)
+ // formaer rtc_init_entry()
+ virtual RTC::ReturnCode_t onInitialize();
+
+ // The finalize action (on ALIVE->END transition)
+ // formaer rtc_exiting_entry()
+ // virtual RTC::ReturnCode_t onFinalize();
+
+ // The startup action when ExecutionContext startup
+ // former rtc_starting_entry()
+ // virtual RTC::ReturnCode_t onStartup(RTC::UniqueId ec_id);
+
+ // The shutdown action when ExecutionContext stop
+ // former rtc_stopping_entry()
+ // virtual RTC::ReturnCode_t onShutdown(RTC::UniqueId ec_id);
+
+ // The activated action (Active state entry action)
+ // former rtc_active_entry()
+ // virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id);
+
+ // The deactivated action (Active state exit action)
+ // former rtc_active_exit()
+ // virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id);
+
+ // The execution action that is invoked periodically
+ // former rtc_active_do()
+ virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id);
+
+ // The aborting action when main logic error occurred.
+ // former rtc_aborting_entry()
+ // virtual RTC::ReturnCode_t onAborting(RTC::UniqueId ec_id);
+
+ // The error action in ERROR state
+ // former rtc_error_do()
+ // virtual RTC::ReturnCode_t onError(RTC::UniqueId ec_id);
+
+ // The reset action that is invoked resetting
+ // This is same but different the former rtc_init_entry()
+ // virtual RTC::ReturnCode_t onReset(RTC::UniqueId ec_id);
+
+ // The state update action that is invoked after onExecute() action
+ // no corresponding operation exists in OpenRTm-aist-0.2.0
+ // virtual RTC::ReturnCode_t onStateUpdate(RTC::UniqueId ec_id);
+
+ // The action that is invoked when execution context's rate is changed
+ // no corresponding operation exists in OpenRTm-aist-0.2.0
+ // virtual RTC::ReturnCode_t onRateChanged(RTC::UniqueId ec_id);
+
+ CORBA::Long getInPortValue() { return m_in.data; }
+ protected:
+ // DataInPort declaration
+ // <rtc-template block="inport_declare">
+ TimedLong m_in;
+ InPort<TimedLong> m_inIn;
+
+ // </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:
+
+};
+
+extern "C"
+{
+ DLL_EXPORT void DisplayInit(RTC::Manager* manager);
+};
+
+#endif // DISPLAY_H
Property changes on: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Display.h
___________________________________________________________________
Added: svn:executable
+ *
Added: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/DisplayComp.cpp
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/DisplayComp.cpp (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/DisplayComp.cpp 2017-01-28 14:28:40 UTC (rev 2895)
@@ -0,0 +1,98 @@
+// -*- C++ -*-
+/*!
+ * @file DisplayComp.cpp
+ * @brief Standalone component
+ * @date $Date$
+ *
+ * $Id$
+ */
+
+#include <rtm/Manager.h>
+#include <iostream>
+#include <string>
+#include "Display.h"
+
+
+void MyModuleInit(RTC::Manager* manager)
+{
+ DisplayInit(manager);
+ RTC::RtcBase* comp;
+
+ // Create a component
+ comp = manager->createComponent("Display");
+ std::cout << "succeed." << std::endl;
+
+ RTC::ComponentProfile_var prof;
+ prof = comp->get_component_profile();
+ std::cout << "=================================================" << std::endl;
+ std::cout << " Component Profile" << std::endl;
+ std::cout << "-------------------------------------------------" << std::endl;
+ std::cout << "InstanceID: " << prof->instance_name << std::endl;
+ std::cout << "Implementation: " << prof->type_name << std::endl;
+ std::cout << "Description: " << prof->description << std::endl;
+ std::cout << "Version: " << prof->version << std::endl;
+ std::cout << "Maker: " << prof->vendor << std::endl;
+ std::cout << "Category: " << prof->category << std::endl;
+ std::cout << " Other properties " << std::endl;
+ NVUtil::dump(prof->properties);
+ std::cout << "=================================================" << std::endl;
+
+ PortServiceList* portlist;
+ portlist = comp->get_ports();
+
+ for (CORBA::ULong i(0), n(portlist->length()); i < n; ++i)
+ {
+ PortService_ptr port;
+ port = (*portlist)[i];
+ std::cout << "================================================="
+ << std::endl;
+ std::cout << "Port" << i << " (name): ";
+ std::cout << port->get_port_profile()->name << std::endl;
+ std::cout << "-------------------------------------------------"
+ << std::endl;
+
+
+ RTC::PortInterfaceProfileList iflist;
+ iflist = port->get_port_profile()->interfaces;
+
+ for (CORBA::ULong i(0), n(iflist.length()); i < n; ++i)
+ {
+ std::cout << "I/F name: ";
+ std::cout << iflist[i].instance_name << std::endl;
+ std::cout << "I/F type: ";
+ std::cout << iflist[i].type_name << std::endl;
+ const char* pol;
+ pol = iflist[i].polarity == 0 ? "PROVIDED" : "REQUIRED";
+ std::cout << "Polarity: " << pol << std::endl;
+ }
+ std::cout << "- properties -" << std::endl;
+ NVUtil::dump(port->get_port_profile()->properties);
+ std::cout << "-------------------------------------------------"
+ << std::endl;
+ }
+
+
+ return;
+}
+
+int main (int argc, char** argv)
+{
+ RTC::Manager* manager;
+ manager = RTC::Manager::init(argc, argv);
+
+ // Set module initialization proceduer
+ // This procedure will be invoked in activateManager() function.
+ manager->setModuleInitProc(MyModuleInit);
+
+ // 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);
+
+ return 0;
+}
Property changes on: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/DisplayComp.cpp
___________________________________________________________________
Added: svn:executable
+ *
Added: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Inputbutton.cpp
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Inputbutton.cpp (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Inputbutton.cpp 2017-01-28 14:28:40 UTC (rev 2895)
@@ -0,0 +1,137 @@
+// -*- C++ -*-
+/*!
+ * @file Inputbutton.cpp
+ * @brief Console input component
+ * $Date: 2007-10-09 07:33:04 $
+ *
+ * $Id: Inputbutton.cpp 1778 2010-01-25 10:29:27Z hakuta $
+ */
+
+#include "Inputbutton.h"
+#include <iostream>
+
+// Module specification
+// <rtc-template block="module_spec">
+static const char* consolein_spec[] =
+ {
+ "implementation_id", "Inputbutton",
+ "type_name", "Inputbutton",
+ "description", "Console input component",
+ "version", "1.0",
+ "vendor", "Noriaki Ando, AIST",
+ "category", "example",
+ "activity_type", "DataFlowComponent",
+ "max_instance", "10",
+ "language", "C++",
+ "lang_type", "compile",
+ ""
+ };
+// </rtc-template>
+
+Inputbutton::Inputbutton(RTC::Manager* manager)
+ : RTC::DataFlowComponentBase(manager),
+ // <rtc-template block="initializer">
+ m_openOut("open", m_open),
+ m_closeOut("close", m_close),
+ m_minuteOut("minute", m_minute),
+ m_startOut("start", m_start),
+ m_stopOut("stop", m_stop),
+ m_tickOut("tick", m_tick)
+ // </rtc-template>
+{
+ // Registration: InPort/OutPort/Service
+ // <rtc-template block="registration">
+ // Set InPort buffers
+
+ // Set OutPort buffer
+
+ // Set service provider to Ports
+
+ // Set service consumers to Ports
+
+ // Set CORBA Service Ports
+
+ // </rtc-template>
+
+}
+
+Inputbutton::~Inputbutton()
+{
+}
+
+
+RTC::ReturnCode_t Inputbutton::onInitialize()
+{
+ addOutPort("open", m_openOut);
+ addOutPort("close", m_closeOut);
+ addOutPort("minute", m_minuteOut);
+ addOutPort("start", m_startOut);
+ addOutPort("stop", m_stopOut);
+ addOutPort("tick", m_tickOut);
+
+ return RTC::RTC_OK;
+}
+RTC::ReturnCode_t Inputbutton::onExecute(RTC::UniqueId ec_id)
+{
+ std::string cmd;
+ std::cout << std::endl;
+ std::cout << "Please select action!!" << std::endl;
+ std::cout << "Commands: " << std::endl;
+ std::cout << " open : Open the microwave's door." << std::endl;
+ std::cout << " close : Close the microwave's door." << std::endl;
+ std::cout << " minute <int> : Increment timer. " << std::endl;
+ std::cout << " start : Start the microwave." << std::endl;
+ std::cout << " stop : Stop the microwave." << std::endl;
+ std::cout << " tick : Proceed time." << std::endl;
+ std::cout << " -> others are interpreted as tick commnad." << std::endl;
+ std::cout << ">> ";
+ std::getline(std::cin, cmd);
+
+ coil::vstring cmds = coil::split(cmd, " ");
+ coil::eraseBlank(cmds[0]);
+
+ std::cout << "[command]: " << cmds[0];
+ if (cmds.size() > 1)
+ {
+ std::cout << " [args]: ";
+ for (size_t i(1); i < cmds.size(); ++i)
+ {
+ std::cout << cmds[i] << " ";
+ }
+ }
+ std::cout << std::endl;
+
+ if (cmds[0] == "open") { m_open.data = 0; m_openOut.write(); }
+ else if (cmds[0] == "close") { m_close.data = 0; m_closeOut.write(); }
+ else if (cmds[0] == "minute")
+ {
+ CORBA::Long min;
+ if (cmds.size() < 2 || !coil::stringTo(min, cmds[1].c_str()))
+ {
+ std::cout << "minute command needs an integer arg." << std::endl;
+ return RTC::RTC_OK;
+ }
+ m_minute.data = min; m_minuteOut.write();
+ }
+ else if (cmds[0] == "start") { m_start.data = 0; m_startOut.write(); }
+ else if (cmds[0] == "stop") { m_stop.data = 0; m_stopOut.write(); }
+ else { std::cout << "tick" << std::endl; m_tick.data = 0; m_tickOut.write(); }
+
+ return RTC::RTC_OK;
+}
+
+
+extern "C"
+{
+
+ void InputbuttonInit(RTC::Manager* manager)
+ {
+ RTC::Properties profile(consolein_spec);
+ manager->registerFactory(profile,
+ RTC::Create<Inputbutton>,
+ RTC::Delete<Inputbutton>);
+ }
+
+};
+
+
Property changes on: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Inputbutton.cpp
___________________________________________________________________
Added: svn:executable
+ *
Added: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Inputbutton.h
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Inputbutton.h (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Inputbutton.h 2017-01-28 14:28:40 UTC (rev 2895)
@@ -0,0 +1,196 @@
+// -*- C++ -*-
+/*!
+ * @file Inputbutton.h
+ * @brief Console input component
+ * @date $Date: 2008-02-29 04:55:01 $
+ *
+ * $Id: Inputbutton.h 2412 2014-02-06 03:19:47Z n-ando $
+ */
+
+#ifndef INPUTBUTTON_H
+#define INPUTBUTTON_H
+
+#include <rtm/idl/BasicDataTypeSkel.h>
+#include <rtm/Manager.h>
+#include <rtm/DataFlowComponentBase.h>
+#include <rtm/CorbaPort.h>
+#include <rtm/DataInPort.h>
+#include <rtm/DataOutPort.h>
+#include <rtm/ConnectorListener.h>
+
+#include <iostream>
+// Service implementation headers
+// <rtc-template block="service_impl_h">
+
+// </rtc-template>
+
+// Service Consumer stub headers
+// <rtc-template block="consumer_stub_h">
+
+// </rtc-template>
+
+using namespace RTC;
+
+
+class DataListener
+ : public ConnectorDataListenerT<RTC::TimedLong>
+{
+ USE_CONNLISTENER_STATUS;
+public:
+ DataListener(const char* name) : m_name(name) {}
+ virtual ~DataListener()
+ {
+ std::cout << "dtor of " << m_name << std::endl;
+ }
+
+ virtual ReturnCode operator()(ConnectorInfo& info,
+ TimedLong& data)
+ {
+ std::cout << "------------------------------" << std::endl;
+ std::cout << "Data Listener: " << m_name << std::endl;
+ std::cout << "Profile::name: " << info.name << std::endl;
+ std::cout << "Profile::id: " << info.id << std::endl;
+// std::cout << "Profile::properties: " << std::endl;
+// std::cout << info.properties;
+// std::cout << std::endl;
+ std::cout << "Data: " << data.data << std::endl;
+ std::cout << "------------------------------" << std::endl;
+ return NO_CHANGE;
+ };
+ std::string m_name;
+};
+
+
+class ConnListener
+ : public ConnectorListener
+{
+ USE_CONNLISTENER_STATUS;
+public:
+ ConnListener(const char* name) : m_name(name) {}
+ virtual ~ConnListener()
+ {
+ std::cout << "dtor of " << m_name << std::endl;
+ }
+
+ virtual ReturnCode operator()(ConnectorInfo& info)
+ {
+ std::cout << "------------------------------" << std::endl;
+ std::cout << "Connector Listener: " << m_name << std::endl;
+ std::cout << "Profile::name: " << info.name << std::endl;
+ std::cout << "Profile::id: " << info.id << std::endl;
+ std::cout << "Profile::properties: " << std::endl;
+ std::cout << info.properties;
+ std::cout << std::endl;
+ std::cout << "------------------------------" << std::endl;
+ return NO_CHANGE;
+ };
+ std::string m_name;
+};
+
+
+class Inputbutton
+ : public RTC::DataFlowComponentBase
+{
+ public:
+ Inputbutton(RTC::Manager* manager);
+ ~Inputbutton();
+
+ // The initialize action (on CREATED->ALIVE transition)
+ // formaer rtc_init_entry()
+ virtual RTC::ReturnCode_t onInitialize();
+
+ // The finalize action (on ALIVE->END transition)
+ // formaer rtc_exiting_entry()
+ // virtual RTC::ReturnCode_t onFinalize();
+
+ // The startup action when ExecutionContext startup
+ // former rtc_starting_entry()
+ // virtual RTC::ReturnCode_t onStartup(RTC::UniqueId ec_id);
+
+ // The shutdown action when ExecutionContext stop
+ // former rtc_stopping_entry()
+ // virtual RTC::ReturnCode_t onShutdown(RTC::UniqueId ec_id);
+
+ // The activated action (Active state entry action)
+ // former rtc_active_entry()
+ // virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id);
+
+ // The deactivated action (Active state exit action)
+ // former rtc_active_exit()
+ // virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id);
+
+ // The execution action that is invoked periodically
+ // former rtc_active_do()
+ virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id);
+
+ // The aborting action when main logic error occurred.
+ // former rtc_aborting_entry()
+ // virtual RTC::ReturnCode_t onAborting(RTC::UniqueId ec_id);
+
+ // The error action in ERROR state
+ // former rtc_error_do()
+ // virtual RTC::ReturnCode_t onError(RTC::UniqueId ec_id);
+
+ // The reset action that is invoked resetting
+ // This is same but different the former rtc_init_entry()
+ // virtual RTC::ReturnCode_t onReset(RTC::UniqueId ec_id);
+
+ // The state update action that is invoked after onExecute() action
+ // no corresponding operation exists in OpenRTm-aist-0.2.0
+ // virtual RTC::ReturnCode_t onStateUpdate(RTC::UniqueId ec_id);
+
+ // The action that is invoked when execution context's rate is changed
+ // no corresponding operation exists in OpenRTm-aist-0.2.0
+ // virtual RTC::ReturnCode_t onRateChanged(RTC::UniqueId ec_id);
+
+
+ protected:
+ // DataInPort declaration
+ // <rtc-template block="inport_declare">
+
+ // </rtc-template>
+
+
+ // DataOutPort declaration
+ // <rtc-template block="outport_declare">
+ TimedLong m_open;
+ OutPort<TimedLong> m_openOut;
+ TimedLong m_close;
+ OutPort<TimedLong> m_closeOut;
+ TimedLong m_minute;
+ OutPort<TimedLong> m_minuteOut;
+ TimedLong m_start;
+ OutPort<TimedLong> m_startOut;
+ TimedLong m_stop;
+ OutPort<TimedLong> m_stopOut;
+ TimedLong m_tick;
+ OutPort<TimedLong> m_tickOut;
+
+ // </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:
+
+};
+
+
+extern "C"
+{
+ DLL_EXPORT void InputbuttonInit(RTC::Manager* manager);
+};
+
+#endif // INPUTBUTTON_H
Property changes on: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Inputbutton.h
___________________________________________________________________
Added: svn:executable
+ *
Added: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/InputbuttonComp.cpp
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/InputbuttonComp.cpp (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/InputbuttonComp.cpp 2017-01-28 14:28:40 UTC (rev 2895)
@@ -0,0 +1,97 @@
+// -*- C++ -*-
+/*!
+ * @file InputbuttonComp.cpp
+ * @brief Standalone component
+ * @date $Date: 2008-01-14 07:43:41 $
+ *
+ * $Id: InputbuttonComp.cpp 778 2008-07-29 04:59:25Z n-ando $
+ */
+
+#include <rtm/Manager.h>
+#include <iostream>
+#include <string>
+#include "Inputbutton.h"
+#include <rtm/NVUtil.h>
+
+
+void MyModuleInit(RTC::Manager* manager)
+{
+ InputbuttonInit(manager);
+ RTC::RtcBase* comp;
+
+ // Create a component
+ std::cout << "Creating a component: \"Inputbutton\"....";
+ comp = manager->createComponent("Inputbutton");
+ std::cout << "succeed." << std::endl;
+
+ RTC::ComponentProfile_var prof;
+ prof = comp->get_component_profile();
+ std::cout << "=================================================" << std::endl;
+ std::cout << " Component Profile" << std::endl;
+ std::cout << "-------------------------------------------------" << std::endl;
+ std::cout << "InstanceID: " << prof->instance_name << std::endl;
+ std::cout << "Implementation: " << prof->type_name << std::endl;
+ std::cout << "Description: " << prof->description << std::endl;
+ std::cout << "Version: " << prof->version << std::endl;
+ std::cout << "Maker: " << prof->vendor << std::endl;
+ std::cout << "Category: " << prof->category << std::endl;
+ std::cout << " Other properties " << std::endl;
+ NVUtil::dump(prof->properties);
+ std::cout << "=================================================" << std::endl;
+
+ PortServiceList* portlist;
+ portlist = comp->get_ports();
+
+ for (CORBA::ULong i(0), n(portlist->length()); i < n; ++i)
+ {
+ PortService_ptr port;
+ port = (*portlist)[i];
+ std::cout << "================================================="
+ << std::endl;
+ std::cout << "Port" << i << " (name): ";
+ std::cout << port->get_port_profile()->name << std::endl;
+ std::cout << "-------------------------------------------------"
+ << std::endl;
+ RTC::PortInterfaceProfileList iflist;
+ iflist = port->get_port_profile()->interfaces;
+
+ for (CORBA::ULong i(0), n(iflist.length()); i < n; ++i)
+ {
+ std::cout << "I/F name: ";
+ std::cout << iflist[i].instance_name << std::endl;
+ std::cout << "I/F type: ";
+ std::cout << iflist[i].type_name << std::endl;
+ const char* pol;
+ pol = iflist[i].polarity == 0 ? "PROVIDED" : "REQUIRED";
+ std::cout << "Polarity: " << pol << std::endl;
+ }
+ std::cout << "- properties -" << std::endl;
+ NVUtil::dump(port->get_port_profile()->properties);
+ std::cout << "-------------------------------------------------" << std::endl;
+ }
+ return;
+}
+
+
+
+int main (int argc, char** argv)
+{
+ RTC::Manager* manager;
+ manager = RTC::Manager::init(argc, argv);
+
+ // Set module initialization proceduer
+ // This procedure will be invoked in activateManager() function.
+ manager->setModuleInitProc(MyModuleInit);
+
+ // 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);
+
+ return 0;
+}
Property changes on: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/InputbuttonComp.cpp
___________________________________________________________________
Added: svn:executable
+ *
Added: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Makefile.am
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Makefile.am (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Makefile.am 2017-01-28 14:28:40 UTC (rev 2895)
@@ -0,0 +1,366 @@
+## -*- Makefile -*-
+##---------------------------------------------------------------------------
+## Makefile.am for Inputbutton/Microwave components
+##
+## $Id$
+##---------------------------------------------------------------------------
+
+AUTOMAKE_OPTIONS = 1.9
+
+AM_CPPFLAGS=-I$(top_srcdir)/src/lib -I$(top_srcdir)/src/lib/coil/include -I$(top_srcdir)/src/lib/rtm/idl
+AM_LDFLAGS=-L$(top_builddir) -L$(top_builddir)/src/lib/rtm -L$(top_builddir)/src/lib/rtm/idl
+
+#------------------------------------------------------------
+# Targets
+#------------------------------------------------------------
+# Targets directories
+exampledir = $(rtm_exampledir)
+socompdir = $(exampledir)/rtc
+sourcedir = $(exampledir)/src/StaticFsm
+
+# Loadable RTCs
+socomp_LTLIBRARIES = Inputbutton.la Microwave.la Display.la
+
+Inputbutton_la_SOURCES = Inputbutton.cpp Inputbutton.h
+Inputbutton_la_LDFLAGS = -module
+Inputbutton_la_FLAGS = -L$(top_builddir)/src/lib/rtm/.lib
+Inputbutton_la_LIBADD = \
+ $(top_builddir)/src/lib/rtm/libRTC.la \
+ $(top_builddir)/src/lib/coil/lib/libcoil.la
+
+Microwave_la_SOURCES = \
+ MicrowaveFsm.cpp MicrowaveFsm.h \
+ Microwave.cpp Microwave.h
+Microwave_la_LDFLAGS = -module
+Microwave_la_FLAGS = -L$(top_builddir)/src/lib/rtm/.lib
+Microwave_la_LIBADD = \
+ $(top_builddir)/src/lib/rtm/libRTC.la \
+ $(top_builddir)/src/lib/coil/lib/libcoil.la
+
+Display_la_SOURCES = Display.cpp Display.h
+Display_la_LDFLAGS = -module
+Display_la_FLAGS = -L$(top_builddir)/src/lib/rtm/.lib
+Display_la_LIBADD = \
+ $(top_builddir)/src/lib/rtm/libRTC.la \
+ $(top_builddir)/src/lib/coil/lib/libcoil.la
+
+# Standalone RTCs
+example_PROGRAMS = InputbuttonComp MicrowaveComp DisplayComp
+example_DATA = rtc.conf inputbutton.conf microwave.conf display.conf
+
+InputbuttonComp_SOURCES = InputbuttonComp.cpp
+#InputbuttonComp_DEPENDENCIES = Inputbutton.la
+InputbuttonComp_LDFLAGS = -L$(top_builddir)/src/lib/rtm/.libs
+InputbuttonComp_LDADD = Inputbutton.o \
+ $(top_builddir)/src/lib/rtm/libRTC.la \
+ $(top_builddir)/src/lib/coil/lib/libcoil.la
+
+MicrowaveComp_SOURCES = MicrowaveComp.cpp
+#MicrowaveComp_DEPENDENCIES = Microwave.la MicrowaveFsm.la
+MicrowaveComp_LDFLAGS = -L$(top_builddir)/src/lib/rtm/.libs
+MicrowaveComp_LDADD = Microwave.o MicrowaveFsm.o \
+ $(top_builddir)/src/lib/rtm/libRTC.la \
+ $(top_builddir)/src/lib/coil/lib/libcoil.la
+
+DisplayComp_SOURCES = DisplayComp.cpp
+DisplayComp_LDFLAGS = -L$(top_builddir)/src/lib/rtm/.libs
+DisplayComp_LDADD = Display.o \
+ $(top_builddir)/src/lib/rtm/libRTC.la \
+ $(top_builddir)/src/lib/coil/lib/libcoil.la
+
+# Example sources
+source_DATA = $(ALL_SRC) $(EXTRA_DIST)
+
+#------------------------------------------------------------
+# Extra distributed files
+#------------------------------------------------------------
+EXTRA_DIST = \
+ run.sh \
+ rtc.conf \
+ inputbutton.conf \
+ microwave.conf \
+ display.conf
+
+ALL_SRC = \
+ InputbuttonComp.cpp \
+ Inputbutton.cpp \
+ Inputbutton.h \
+ MicrowaveComp.cpp \
+ Microwave.cpp \
+ Microwave.h \
+ DisplayComp.cpp \
+ Display.cpp \
+ Display.h
+
+#------------------------------------------------------------
+# File list for deb/ports packages
+#------------------------------------------------------------
+lst:
+ echo $(ALL_SRC) > src.lst
+ echo $(EXTRA_DIST) > other.lst
+
+#------------------------------------------------------------
+# Visual Studio Project
+#------------------------------------------------------------
+win32_builddir=$(top_builddir)/win32/OpenRTM-aist/examples/SimpleIO
+
+vcproj: vc8proj vc9proj vc10proj vc11proj vc12proj vc14proj
+
+vc8proj:
+ $(top_builddir)/build/vcprojtool.py vcproj \
+ --type EXE \
+ --vcversion "8.00" \
+ --projectname "InputbuttonComp" \
+ --version $(RTM_VERSION) \
+ --out $(win32_builddir)/Inputbutton_vc8.vcproj \
+ --yaml ../rtc.vcproj.yaml \
+ --source Inputbutton.cpp InputbuttonComp.cpp \
+ --header Inputbutton.h
+ qkc -O- -sm $(win32_builddir)/Inputbutton_vc8.vcproj
+ $(top_builddir)/build/vcprojtool.py vcproj \
+ --type DLL \
+ --vcversion "8.00" \
+ --projectname "Inputbutton" \
+ --version $(RTM_VERSION) \
+ --out $(win32_builddir)/InputbuttonDll_vc8.vcproj \
+ --yaml ../rtcdll.vcproj.yaml \
+ --source Inputbutton.cpp \
+ --header Inputbutton.h
+ qkc -O- -sm $(win32_builddir)/InputbuttonDll_vc8.vcproj
+ $(top_builddir)/build/vcprojtool.py vcproj \
+ --type EXE \
+ --vcversion "8.00" \
+ --projectname "MicrowaveComp" \
+ --version $(RTM_VERSION) \
+ --out $(win32_builddir)/Microwave_vc8.vcproj \
+ --yaml ../rtc.vcproj.yaml \
+ --source Microwave.cpp MicrowaveComp.cpp \
+ --header Microwave.h
+ qkc -O- -sm $(win32_builddir)/Microwave_vc8.vcproj
+ $(top_builddir)/build/vcprojtool.py vcproj \
+ --type DLL \
+ --vcversion "8.00" \
+ --projectname "Microwave" \
+ --version $(RTM_VERSION) \
+ --out $(win32_builddir)/MicrowaveDll_vc8.vcproj \
+ --yaml ../rtcdll.vcproj.yaml \
+ --source Microwave.cpp \
+ --header Microwave.h
+ qkc -O- -sm $(win32_builddir)/MicrowaveDll_vc8.vcproj
+
+vc9proj:
+ $(top_builddir)/build/vcprojtool.py vcproj \
+ --type EXE \
+ --vcversion "9.00" \
+ --projectname "InputbuttonComp" \
+ --version $(RTM_VERSION) \
+ --out $(win32_builddir)/Inputbutton_vc9.vcproj \
+ --yaml ../rtc.vcproj.yaml \
+ --source Inputbutton.cpp InputbuttonComp.cpp \
+ --header Inputbutton.h
+ qkc -O- -sm $(win32_builddir)/Inputbutton_vc9.vcproj
+ $(top_builddir)/build/vcprojtool.py vcproj \
+ --type DLL \
+ --vcversion "9.00" \
+ --projectname "Inputbutton" \
+ --version $(RTM_VERSION) \
+ --out $(win32_builddir)/InputbuttonDll_vc9.vcproj \
+ --yaml ../rtcdll.vcproj.yaml \
+ --source Inputbutton.cpp \
+ --header Inputbutton.h
+ qkc -O- -sm $(win32_builddir)/InputbuttonDll_vc9.vcproj
+ $(top_builddir)/build/vcprojtool.py vcproj \
+ --type EXE \
+ --vcversion "9.00" \
+ --projectname "MicrowaveComp" \
+ --version $(RTM_VERSION) \
+ --out $(win32_builddir)/Microwave_vc9.vcproj \
+ --yaml ../rtc.vcproj.yaml \
+ --source Microwave.cpp MicrowaveComp.cpp \
+ --header Microwave.h
+ qkc -O- -sm $(win32_builddir)/Microwave_vc9.vcproj
+ $(top_builddir)/build/vcprojtool.py vcproj \
+ --type DLL \
+ --vcversion "9.00" \
+ --projectname "Microwave" \
+ --version $(RTM_VERSION) \
+ --out $(win32_builddir)/MicrowaveDll_vc9.vcproj \
+ --yaml ../rtcdll.vcproj.yaml \
+ --source Microwave.cpp \
+ --header Microwave.h
+ qkc -O- -sm $(win32_builddir)/MicrowaveDll_vc9.vcproj
+
+vc10proj:
+ $(top_builddir)/build/vcxprojtool.py vcxproj \
+ --type EXE \
+ --vcversion "10.00" \
+ --projectname "InputbuttonComp" \
+ --version $(RTM_VERSION) \
+ --out $(win32_builddir)/Inputbutton_vc10.vcxproj \
+ --yaml ../rtc.vcproj.yaml \
+ --source Inputbutton.cpp InputbuttonComp.cpp \
+ --header Inputbutton.h
+ qkc -O- -sm $(win32_builddir)/Inputbutton_vc10.vcxproj
+ $(top_builddir)/build/vcxprojtool.py vcxproj \
+ --type DLL \
+ --vcversion "10.00" \
+ --projectname "Inputbutton" \
+ --version $(RTM_VERSION) \
+ --out $(win32_builddir)/InputbuttonDll_vc10.vcxproj \
+ --yaml ../rtcdll.vcproj.yaml \
+ --source Inputbutton.cpp \
+ --header Inputbutton.h
+ qkc -O- -sm $(win32_builddir)/InputbuttonDll_vc10.vcxproj
+ $(top_builddir)/build/vcxprojtool.py vcxproj \
+ --type EXE \
+ --vcversion "10.00" \
+ --projectname "MicrowaveComp" \
+ --version $(RTM_VERSION) \
+ --out $(win32_builddir)/Microwave_vc10.vcxproj \
+ --yaml ../rtc.vcproj.yaml \
+ --source Microwave.cpp MicrowaveComp.cpp \
+ --header Microwave.h
+ qkc -O- -sm $(win32_builddir)/Microwave_vc10.vcxproj
+ $(top_builddir)/build/vcxprojtool.py vcxproj \
+ --type DLL \
+ --vcversion "10.00" \
+ --projectname "Microwave" \
+ --version $(RTM_VERSION) \
+ --out $(win32_builddir)/MicrowaveDll_vc10.vcxproj \
+ --yaml ../rtcdll.vcproj.yaml \
+ --source Microwave.cpp \
+ --header Microwave.h
+ qkc -O- -sm $(win32_builddir)/MicrowaveDll_vc10.vcxproj
+
+vc11proj:
+ $(top_builddir)/build/vcxprojtool.py vcxproj \
+ --type EXE \
+ --vcversion "11.00" \
+ --projectname "InputbuttonComp" \
+ --version $(RTM_VERSION) \
+ --out $(win32_builddir)/Inputbutton_vc11.vcxproj \
+ --yaml ../rtc.vcproj.yaml \
+ --source Inputbutton.cpp InputbuttonComp.cpp \
+ --header Inputbutton.h
+ qkc -O- -sm $(win32_builddir)/Inputbutton_vc11.vcxproj
+ $(top_builddir)/build/vcxprojtool.py vcxproj \
+ --type DLL \
+ --vcversion "11.00" \
+ --projectname "Inputbutton" \
+ --version $(RTM_VERSION) \
+ --out $(win32_builddir)/InputbuttonDll_vc11.vcxproj \
+ --yaml ../rtcdll.vcproj.yaml \
+ --source Inputbutton.cpp \
+ --header Inputbutton.h
+ qkc -O- -sm $(win32_builddir)/InputbuttonDll_vc11.vcxproj
+ $(top_builddir)/build/vcxprojtool.py vcxproj \
+ --type EXE \
+ --vcversion "11.00" \
+ --projectname "MicrowaveComp" \
+ --version $(RTM_VERSION) \
+ --out $(win32_builddir)/Microwave_vc11.vcxproj \
+ --yaml ../rtc.vcproj.yaml \
+ --source Microwave.cpp MicrowaveComp.cpp \
+ --header Microwave.h
+ qkc -O- -sm $(win32_builddir)/Microwave_vc11.vcxproj
+ $(top_builddir)/build/vcxprojtool.py vcxproj \
+ --type DLL \
+ --vcversion "11.00" \
+ --projectname "Microwave" \
+ --version $(RTM_VERSION) \
+ --out $(win32_builddir)/MicrowaveDll_vc11.vcxproj \
+ --yaml ../rtcdll.vcproj.yaml \
+ --source Microwave.cpp \
+ --header Microwave.h
+ qkc -O- -sm $(win32_builddir)/MicrowaveDll_vc11.vcxproj
+
+vc12proj:
+ $(top_builddir)/build/vcxprojtool.py vcxproj \
+ --type EXE \
+ --vcversion "12.00" \
+ --projectname "InputbuttonComp" \
+ --version $(RTM_VERSION) \
+ --out $(win32_builddir)/Inputbutton_vc12.vcxproj \
+ --yaml ../rtc.vcproj.yaml \
+ --source Inputbutton.cpp InputbuttonComp.cpp \
+ --header Inputbutton.h
+ qkc -O- -sm $(win32_builddir)/Inputbutton_vc12.vcxproj
+ $(top_builddir)/build/vcxprojtool.py vcxproj \
+ --type DLL \
+ --vcversion "12.00" \
+ --projectname "Inputbutton" \
+ --version $(RTM_VERSION) \
+ --out $(win32_builddir)/InputbuttonDll_vc12.vcxproj \
+ --yaml ../rtcdll.vcproj.yaml \
+ --source Inputbutton.cpp \
+ --header Inputbutton.h
+ qkc -O- -sm $(win32_builddir)/InputbuttonDll_vc12.vcxproj
+ $(top_builddir)/build/vcxprojtool.py vcxproj \
+ --type EXE \
+ --vcversion "12.00" \
+ --projectname "MicrowaveComp" \
+ --version $(RTM_VERSION) \
+ --out $(win32_builddir)/Microwave_vc12.vcxproj \
+ --yaml ../rtc.vcproj.yaml \
+ --source Microwave.cpp MicrowaveComp.cpp \
+ --header Microwave.h
+ qkc -O- -sm $(win32_builddir)/Microwave_vc12.vcxproj
+ $(top_builddir)/build/vcxprojtool.py vcxproj \
+ --type DLL \
+ --vcversion "12.00" \
+ --projectname "Microwave" \
+ --version $(RTM_VERSION) \
+ --out $(win32_builddir)/MicrowaveDll_vc12.vcxproj \
+ --yaml ../rtcdll.vcproj.yaml \
+ --source Microwave.cpp \
+ --header Microwave.h
+ qkc -O- -sm $(win32_builddir)/MicrowaveDll_vc12.vcxproj
+
+vc14proj:
+ $(top_builddir)/build/vcxprojtool.py vcxproj \
+ --type EXE \
+ --vcversion "14.00" \
+ --projectname "InputbuttonComp" \
+ --version $(RTM_VERSION) \
+ --out $(win32_builddir)/Inputbutton_vc14.vcxproj \
+ --yaml ../rtc.vcproj.yaml \
+ --source Inputbutton.cpp InputbuttonComp.cpp \
+ --header Inputbutton.h
+ qkc -O- -sm $(win32_builddir)/Inputbutton_vc14.vcxproj
+ $(top_builddir)/build/vcxprojtool.py vcxproj \
+ --type DLL \
+ --vcversion "14.00" \
+ --projectname "Inputbutton" \
+ --version $(RTM_VERSION) \
+ --out $(win32_builddir)/InputbuttonDll_vc14.vcxproj \
+ --yaml ../rtcdll.vcproj.yaml \
+ --source Inputbutton.cpp \
+ --header Inputbutton.h
+ qkc -O- -sm $(win32_builddir)/InputbuttonDll_vc14.vcxproj
+ $(top_builddir)/build/vcxprojtool.py vcxproj \
+ --type EXE \
+ --vcversion "14.00" \
+ --projectname "MicrowaveComp" \
+ --version $(RTM_VERSION) \
+ --out $(win32_builddir)/Microwave_vc14.vcxproj \
+ --yaml ../rtc.vcproj.yaml \
+ --source Microwave.cpp MicrowaveComp.cpp \
+ --header Microwave.h
+ qkc -O- -sm $(win32_builddir)/Microwave_vc14.vcxproj
+ $(top_builddir)/build/vcxprojtool.py vcxproj \
+ --type DLL \
+ --vcversion "14.00" \
+ --projectname "Microwave" \
+ --version $(RTM_VERSION) \
+ --out $(win32_builddir)/MicrowaveDll_vc14.vcxproj \
+ --yaml ../rtcdll.vcproj.yaml \
+ --source Microwave.cpp \
+ --header Microwave.h
+ qkc -O- -sm $(win32_builddir)/MicrowaveDll_vc14.vcxproj
+
+dist-hook: lst vcproj
+
+clean-local:
+ rm -f *.bak *.rpo *.sym lib*.*_pure_*
+ rm -f *.lst *.core *~ *.so *.log
+ rm -f Makefile.old
Property changes on: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Makefile.am
___________________________________________________________________
Added: svn:executable
+ *
Added: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Microwave.cpp
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Microwave.cpp (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Microwave.cpp 2017-01-28 14:28:40 UTC (rev 2895)
@@ -0,0 +1,90 @@
+// -*- C++ -*-
+/*!
+ * @file Microwave.cpp
+ * @brief Microwave oven FSM sample component
+ * $Date$
+ *
+ * $Id$
+ */
+
+#include "Microwave.h"
+
+// Module specification
+// <rtc-template block="module_spec">
+static const char* consoleout_spec[] =
+ {
+ "implementation_id", "Microwave",
+ "type_name", "Microwave",
+ "description", "Console output component",
+ "version", "1.0",
+ "vendor", "Noriaki Ando, AIST",
+ "category", "example",
+ "activity_type", "DataFlowComponent",
+ "max_instance", "10",
+ "language", "C++",
+ "lang_type", "compile",
+ ""
+ };
+// </rtc-template>
+
+Microwave::Microwave(RTC::Manager* manager)
+ : RTC::DataFlowComponentBase(manager),
+ // <rtc-template block="initializer">
+ m_fsm(this),
+ m_eventIn("event", m_fsm)
+ // </rtc-template>
+{
+ // Registration: InPort/OutPort/Service
+ // <rtc-template block="registration">
+ // Set InPort buffers
+
+ // Set OutPort buffer
+
+ // Set service provider to Ports
+
+ // Set service consumers to Ports
+
+ // Set CORBA Service Ports
+
+ // </rtc-template>
+
+}
+
+Microwave::~Microwave()
+{
+}
+
+
+RTC::ReturnCode_t Microwave::onInitialize()
+{
+ addInPort("event", m_eventIn);
+
+ m_eventIn.bindEvent("open", &MicrowaveFsm::Top::open);
+ m_eventIn.bindEvent("close", &MicrowaveFsm::Top::close);
+ m_eventIn.bindEvent("minute", &MicrowaveFsm::Top::minute);
+ m_eventIn.bindEvent("start", &MicrowaveFsm::Top::start);
+ m_eventIn.bindEvent("stop", &MicrowaveFsm::Top::stop);
+ m_eventIn.bindEvent("tick", &MicrowaveFsm::Top::tick);
+
+ return RTC::RTC_OK;
+}
+
+RTC::ReturnCode_t Microwave::onExecute(RTC::UniqueId ec_id)
+{
+ coil::usleep(1000000);
+
+ return RTC::RTC_OK;
+}
+
+extern "C"
+{
+ void MicrowaveInit(RTC::Manager* manager)
+ {
+ coil::Properties profile(consoleout_spec);
+ manager->registerFactory(profile,
+ RTC::Create<Microwave>,
+ RTC::Delete<Microwave>);
+ }
+};
+
+
Property changes on: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Microwave.cpp
___________________________________________________________________
Added: svn:executable
+ *
Added: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Microwave.h
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Microwave.h (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Microwave.h 2017-01-28 14:28:40 UTC (rev 2895)
@@ -0,0 +1,139 @@
+// -*- C++ -*-
+/*!
+ * @file Microwave.h
+ * @brief Microwave oven FSM example component
+ * @date $Date$
+ *
+ * $Id$
+ */
+
+#ifndef MICROWAVE_H
+#define MICROWAVE_H
+
+#include <rtm/idl/BasicDataTypeSkel.h>
+#include <rtm/Manager.h>
+#include <rtm/DataFlowComponentBase.h>
+#include <rtm/CorbaPort.h>
+#include <rtm/DataInPort.h>
+#include <rtm/DataOutPort.h>
+#include <rtm/EventPort.h>
+#include <rtm/ConnectorListener.h>
+#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
+
+#include "MicrowaveFsm.h"
+
+// Service implementation headers
+// <rtc-template block="service_impl_h">
+
+// </rtc-template>
+
+// Service Consumer stub headers
+// <rtc-template block="consumer_stub_h">
+
+// </rtc-template>
+
+using namespace RTC;
+
+class Microwave
+ : public RTC::DataFlowComponentBase
+{
+ public:
+ Microwave(RTC::Manager* manager);
+ ~Microwave();
+
+ // The initialize action (on CREATED->ALIVE transition)
+ // formaer rtc_init_entry()
+ virtual RTC::ReturnCode_t onInitialize();
+
+ // The finalize action (on ALIVE->END transition)
+ // formaer rtc_exiting_entry()
+ // virtual RTC::ReturnCode_t onFinalize();
+
+ // The startup action when ExecutionContext startup
+ // former rtc_starting_entry()
+ // virtual RTC::ReturnCode_t onStartup(RTC::UniqueId ec_id);
+
+ // The shutdown action when ExecutionContext stop
+ // former rtc_stopping_entry()
+ // virtual RTC::ReturnCode_t onShutdown(RTC::UniqueId ec_id);
+
+ // The activated action (Active state entry action)
+ // former rtc_active_entry()
+ // virtual RTC::ReturnCode_t onActivated(RTC::UniqueId ec_id);
+
+ // The deactivated action (Active state exit action)
+ // former rtc_active_exit()
+ // virtual RTC::ReturnCode_t onDeactivated(RTC::UniqueId ec_id);
+
+ // The execution action that is invoked periodically
+ // former rtc_active_do()
+ virtual RTC::ReturnCode_t onExecute(RTC::UniqueId ec_id);
+
+ // The aborting action when main logic error occurred.
+ // former rtc_aborting_entry()
+ // virtual RTC::ReturnCode_t onAborting(RTC::UniqueId ec_id);
+
+ // The error action in ERROR state
+ // former rtc_error_do()
+ // virtual RTC::ReturnCode_t onError(RTC::UniqueId ec_id);
+
+ // The reset action that is invoked resetting
+ // This is same but different the former rtc_init_entry()
+ // virtual RTC::ReturnCode_t onReset(RTC::UniqueId ec_id);
+
+ // The state update action that is invoked after onExecute() action
+ // no corresponding operation exists in OpenRTm-aist-0.2.0
+ // virtual RTC::ReturnCode_t onStateUpdate(RTC::UniqueId ec_id);
+
+ // The action that is invoked when execution context's rate is changed
+ // no corresponding operation exists in OpenRTm-aist-0.2.0
+ // virtual RTC::ReturnCode_t onRateChanged(RTC::UniqueId ec_id);
+
+ protected:
+ // DataInPort declaration
+ // <rtc-template block="inport_declare">
+
+ // </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>
+
+ // State machine declaration
+ // <rtc-template block="consumer_declare">
+
+ RTC::Machine<MicrowaveFsm::Top> m_fsm;
+ // </rtc-template>
+
+ // EventPort declaration
+ // <rtc-template block="event_declare">
+
+ EventInPort< Macho::Machine<MicrowaveFsm::Top> > m_eventIn;
+ // </rtc-template>
+
+ private:
+
+};
+
+extern "C"
+{
+ DLL_EXPORT void MicrowaveInit(RTC::Manager* manager);
+};
+
+#endif // MICROWAVE_H
Property changes on: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/Microwave.h
___________________________________________________________________
Added: svn:executable
+ *
Added: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/MicrowaveComp.cpp
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/MicrowaveComp.cpp (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/MicrowaveComp.cpp 2017-01-28 14:28:40 UTC (rev 2895)
@@ -0,0 +1,98 @@
+// -*- C++ -*-
+/*!
+ * @file MicrowaveComp.cpp
+ * @brief Standalone component
+ * @date $Date$
+ *
+ * $Id$
+ */
+
+#include <rtm/Manager.h>
+#include <iostream>
+#include <string>
+#include "Microwave.h"
+
+
+void MyModuleInit(RTC::Manager* manager)
+{
+ MicrowaveInit(manager);
+ RTC::RtcBase* comp;
+
+ // Create a component
+ comp = manager->createComponent("Microwave");
+ std::cout << "succeed." << std::endl;
+
+ RTC::ComponentProfile_var prof;
+ prof = comp->get_component_profile();
+ std::cout << "=================================================" << std::endl;
+ std::cout << " Component Profile" << std::endl;
+ std::cout << "-------------------------------------------------" << std::endl;
+ std::cout << "InstanceID: " << prof->instance_name << std::endl;
+ std::cout << "Implementation: " << prof->type_name << std::endl;
+ std::cout << "Description: " << prof->description << std::endl;
+ std::cout << "Version: " << prof->version << std::endl;
+ std::cout << "Maker: " << prof->vendor << std::endl;
+ std::cout << "Category: " << prof->category << std::endl;
+ std::cout << " Other properties " << std::endl;
+ NVUtil::dump(prof->properties);
+ std::cout << "=================================================" << std::endl;
+
+ PortServiceList* portlist;
+ portlist = comp->get_ports();
+
+ for (CORBA::ULong i(0), n(portlist->length()); i < n; ++i)
+ {
+ PortService_ptr port;
+ port = (*portlist)[i];
+ std::cout << "================================================="
+ << std::endl;
+ std::cout << "Port" << i << " (name): ";
+ std::cout << port->get_port_profile()->name << std::endl;
+ std::cout << "-------------------------------------------------"
+ << std::endl;
+
+
+ RTC::PortInterfaceProfileList iflist;
+ iflist = port->get_port_profile()->interfaces;
+
+ for (CORBA::ULong i(0), n(iflist.length()); i < n; ++i)
+ {
+ std::cout << "I/F name: ";
+ std::cout << iflist[i].instance_name << std::endl;
+ std::cout << "I/F type: ";
+ std::cout << iflist[i].type_name << std::endl;
+ const char* pol;
+ pol = iflist[i].polarity == 0 ? "PROVIDED" : "REQUIRED";
+ std::cout << "Polarity: " << pol << std::endl;
+ }
+ std::cout << "- properties -" << std::endl;
+ NVUtil::dump(port->get_port_profile()->properties);
+ std::cout << "-------------------------------------------------"
+ << std::endl;
+ }
+
+
+ return;
+}
+
+int main (int argc, char** argv)
+{
+ RTC::Manager* manager;
+ manager = RTC::Manager::init(argc, argv);
+
+ // Set module initialization proceduer
+ // This procedure will be invoked in activateManager() function.
+ manager->setModuleInitProc(MyModuleInit);
+
+ // 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);
+
+ return 0;
+}
Property changes on: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/MicrowaveComp.cpp
___________________________________________________________________
Added: svn:executable
+ *
Added: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/MicrowaveFsm.cpp
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/MicrowaveFsm.cpp (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/MicrowaveFsm.cpp 2017-01-28 14:28:40 UTC (rev 2895)
@@ -0,0 +1,152 @@
+// A simple simulation of an microwave oven:
+// Timer can be programmed in minutes, last mode will be resumed if opened.
+//
+// Compile like this:
+// g++ Macho.cpp Microwave.cpp
+
+
+#include <iostream>
+#include <rtm/Macho.h>
+#include "MicrowaveFsm.h"
+#include "Microwave.h"
+
+namespace MicrowaveFsm
+{
+ //============================================================
+ // Top state
+ RTC::ReturnCode_t Top::onInit()
+ {
+ std::cout << "[Microwave] TOP::onInit()" << std::endl;
+ setState<Operational>();
+ return RTC::RTC_OK;
+ }
+ RTC::ReturnCode_t Top::onEntry()
+ {
+ std::cout << "[Microwave] TOP::onEntry()" << std::endl;
+ return RTC::RTC_OK;
+ }
+ RTC::ReturnCode_t Top::onExit()
+ {
+ std::cout << "[Microwave] TOP::onExit()" << std::endl;
+ return RTC::RTC_OK;
+ }
+
+ //============================================================
+ // State Disabled
+ void Disabled::close()
+ {
+ std::cout << "[Microwave] >>> Door closed <<<" << std::endl;
+ setState<Operational>();
+ }
+ RTC::ReturnCode_t Disabled::onEntry()
+ {
+ std::cout << "[Microwave] Disabled::onEntry()" << std::endl;
+ return RTC::RTC_OK;
+ }
+ RTC::ReturnCode_t Disabled::onExit()
+ {
+ std::cout << "[Microwave] Disabled::onExit()" << std::endl;
+ return RTC::RTC_OK;
+ }
+
+ //============================================================
+ // State Operational
+ void Operational::open()
+ {
+ std::cout << "[Microwave] >>> Door opened <<<" << std::endl;
+ setState<Disabled>();
+ }
+ void Operational::stop()
+ {
+ std::cout << "[Microwave] >>> Stopped <<<" << std::endl;
+ setState<Idle>();
+ }
+ RTC::ReturnCode_t Operational::onInit()
+ {
+ std::cout << "[Microwave] Operational::onInit()" << std::endl;
+ setState<Idle>();
+ return RTC::RTC_OK;
+ }
+
+
+ //============================================================
+ // State Idle
+ RTC::ReturnCode_t Idle::onEntry()
+ {
+ TOP::box().resetTimer();
+ std::cout << "[Microwave] Idle::onEntry()" << std::endl;
+ std::cout << "[Microwave] >>> Microwave ready <<<" << std::endl;
+ return RTC::RTC_OK;
+ }
+ void Idle::minute(RTC::TimedLong time)
+ {
+ std::cout << "[Microwave] >>> Timer incremented <<<" << std::endl;
+ setState<Programmed>();
+ dispatch(Event(&TOP::minute, time));
+ }
+
+ //============================================================
+ // State Programmed
+ void Programmed::minute(RTC::TimedLong time)
+ {
+ std::cout << "[Microwave] >>> Timer incremented <<<" << std::endl;
+ for (size_t i(0); i < (size_t)time.data; ++i)
+ {
+ TOP::box().incrementTimer();
+ }
+ TOP::box().printTimer();
+ }
+ void Programmed::start()
+ {
+ std::cout << "[Microwave] >>> Microwave started <<<" << std::endl;
+ setState<Cooking>();
+ }
+ RTC::ReturnCode_t Programmed::onInit()
+ {
+ std::cout << "[Microwave] Programmed::onInit()" << std::endl;
+ return RTC::RTC_OK;
+ }
+ RTC::ReturnCode_t Programmed::onEntry()
+ {
+ std::cout << "[Microwave] Programmed::onEntry()" << std::endl;
+ return RTC::RTC_OK;
+ }
+ RTC::ReturnCode_t Programmed::onExit()
+ {
+ std::cout << "[Microwave] Programmed::onExit()" << std::endl;
+ return RTC::RTC_OK;
+ }
+
+
+ //============================================================
+ // State Cooking
+ void Cooking::tick()
+ {
+ std::cout << "[Microwave] >>> Clock tick <<<" << std::endl;
+
+ TOP::Box & tb = TOP::box();
+ tb.decrementTimer();
+ if(tb.getRemainingTime() == 0)
+ {
+ std::cout << "[Microwave] >>> Finished <<<" << std::endl;
+ setState<Idle>();
+ }
+ else
+ {
+ tb.printTimer();
+ }
+ }
+ RTC::ReturnCode_t Cooking::onEntry()
+ {
+ std::cout << "[Microwave] Cooking::onEntry()" << std::endl;
+ std::cout << "[Microwave] >>> Heating on <<<" << std::endl;
+ return RTC::RTC_OK;
+ }
+ RTC::ReturnCode_t Cooking::onExit()
+ {
+ std::cout << "[Microwave] Cooking::onExit()" << std::endl;
+ std::cout << "[Microwave] >>> Heating off <<<" << std::endl;
+ return RTC::RTC_OK;
+ }
+
+}; // namespace Microwave
Property changes on: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/MicrowaveFsm.cpp
___________________________________________________________________
Added: svn:executable
+ *
Added: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/MicrowaveFsm.h
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/MicrowaveFsm.h (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/MicrowaveFsm.h 2017-01-28 14:28:40 UTC (rev 2895)
@@ -0,0 +1,161 @@
+// A simple simulation of an microwave oven:
+// Timer can be programmed in minutes, last mode will be resumed if opened.
+//
+// Compile like this:
+// g++ Macho.cpp Microwave.cpp
+
+#ifndef MICROWAVEFSM_H
+#define MICROWAVEFSM_H
+
+#include <iostream>
+#include <rtm/StaticFSM.h>
+#include <rtm/idl/BasicDataTypeSkel.h>
+#include <rtm/RTC.h>
+
+class Microwave;
+
+// Simple microwave simulation
+namespace MicrowaveFsm
+{
+
+ /*!
+ * @if jp
+ * @brief dqWóÔ}VTv
+ *
+ * Macho Ét®Ì Microwave FSM ÌTv
+ *
+ * @else
+ * @brief Microwave state machine sample
+ *
+ * Microwave FSM example included in Macho
+ *
+ * @endif
+ */
+
+ /*!
+ * @if jp
+ * @class TOPóÔ
+ *
+ *
+ * @else
+ * @brief TOP state
+ *
+ * @endif
+ */
+ FSM_TOPSTATE(Top)
+ {
+ // Top state data (visible to all substates)
+ struct Box
+ {
+ Box() : myCookingTime(0) {}
+ void printTimer()
+ {
+ std::cout << " Timer set to ";
+ std::cout << myCookingTime << " minutes" << std::endl;
+ }
+ void incrementTimer() { ++myCookingTime; }
+ void decrementTimer() { -- myCookingTime; }
+ void resetTimer() { myCookingTime = 0; }
+ int getRemainingTime() { return myCookingTime; }
+ private:
+ int myCookingTime;
+ };
+
+ FSM_STATE(Top);
+
+ // Machine's event protocol
+ virtual void open() {}
+ virtual void close() {}
+ virtual void minute(RTC::TimedLong time) {}
+// {
+// std::cout << "Top::minute()" << std::endl;
+// for (size_t i(0); i < (size_t)time.data; ++i)
+// {
+// box().incrementTimer();
+// }
+// } // Increment timer by a minute
+ virtual void start() {} // Start cooking
+ virtual void stop() {} // Stop cooking
+ virtual void tick() {} // Minute has passed
+
+ private:
+ virtual RTC::ReturnCode_t onInit();
+ virtual RTC::ReturnCode_t onEntry();
+ virtual RTC::ReturnCode_t onExit();
+ };
+
+ //============================================================
+ // Microwave has been opened
+ FSM_SUBSTATE(Disabled, Top)
+ {
+ FSM_STATE(Disabled);
+
+ // Event handler
+ virtual void close();
+
+ private:
+ virtual RTC::ReturnCode_t onEntry();
+ virtual RTC::ReturnCode_t onExit();
+ };
+
+ //============================================================
+ // Microwave is ready
+ FSM_SUBSTATE(Operational, Top)
+ {
+ FSM_STATE(Operational);
+
+ // State has history enabled
+ DEEPHISTORY();
+
+ // Event handler
+ void open();
+ void stop();
+
+ private:
+ virtual RTC::ReturnCode_t onInit();
+ };
+
+ //============================================================
+ // Microwave is idling
+ FSM_SUBSTATE(Idle, Operational)
+ {
+ FSM_STATE(Idle);
+
+ void minute(RTC::TimedLong time);
+
+ private:
+ virtual RTC::ReturnCode_t onEntry();
+ };
+
+ //============================================================
+ // Microwave is being programmed
+ FSM_SUBSTATE(Programmed, Operational)
+ {
+ FSM_STATE(Programmed);
+
+ void minute(RTC::TimedLong time);
+ void start();
+
+ private:
+ virtual RTC::ReturnCode_t onEntry();
+ virtual RTC::ReturnCode_t onInit();
+ virtual RTC::ReturnCode_t onExit();
+ };
+
+ //============================================================
+ // Microwave is heating
+ FSM_SUBSTATE(Cooking, Programmed)
+ {
+ FSM_STATE(Cooking);
+
+ void tick();
+
+ private:
+ virtual RTC::ReturnCode_t onEntry();
+ virtual RTC::ReturnCode_t onExit();
+ };
+};
+
+//typedef Macho::Machine<MicrowaveFsm::Top> MicrowaveFsmImpl;
+
+#endif // MICROWAVEFSM_H
Property changes on: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/MicrowaveFsm.h
___________________________________________________________________
Added: svn:executable
+ *
Added: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/display.conf
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/display.conf (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/display.conf 2017-01-28 14:28:40 UTC (rev 2895)
@@ -0,0 +1,5 @@
+#============================================================
+# component profile
+#============================================================
+# data port configurations
+#
Property changes on: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/display.conf
___________________________________________________________________
Added: svn:executable
+ *
Added: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/inputbutton.conf
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/inputbutton.conf (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/inputbutton.conf 2017-01-28 14:28:40 UTC (rev 2895)
@@ -0,0 +1,5 @@
+#============================================================
+# component profile
+#============================================================
+# data port configurations
+#
Property changes on: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/inputbutton.conf
___________________________________________________________________
Added: svn:executable
+ *
Added: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/microwave.conf
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/microwave.conf (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/microwave.conf 2017-01-28 14:28:40 UTC (rev 2895)
@@ -0,0 +1,5 @@
+#============================================================
+# component profile
+#============================================================
+# data port configurations
+#
Property changes on: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/microwave.conf
___________________________________________________________________
Added: svn:executable
+ *
Added: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/rtc.conf
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/rtc.conf (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/rtc.conf 2017-01-28 14:28:40 UTC (rev 2895)
@@ -0,0 +1,19 @@
+corba.nameservers: localhost
+naming.formats: %h.host_cxt/%n.rtc
+logger.enable: YES
+#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.modules.preload: Microwave.so
+manager.components.precreate: Microwave
+manager.components.preactivation: Inputbutton0, Microwave0
+manager.components.preconnect: \
+ Inputbutton0.open:Microwave0.event(fsm_event_name=open), \
+ Inputbutton0.close:Microwave0.event(fsm_event_name=close), \
+ Inputbutton0.minute:Microwave0.event(fsm_event_name=minute), \
+ Inputbutton0.start:Microwave0.event(fsm_event_name=start), \
+ Inputbutton0.stop:Microwave0.event(fsm_event_name=stop), \
+ Inputbutton0.tick:Microwave0.event(fsm_event_name=tick)
Property changes on: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/rtc.conf
___________________________________________________________________
Added: svn:executable
+ *
Added: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/run.sh
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/run.sh (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/run.sh 2017-01-28 14:28:40 UTC (rev 2895)
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+./InputbuttonComp -f rtc.conf
Property changes on: branches/FSM4RTC/OpenRTM-aist/examples/StaticFsm/run.sh
___________________________________________________________________
Added: svn:executable
+ *
More information about the openrtm-commit
mailing list