[openrtm-commit:01962] r629 - in trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java: resource/100/ConfigSet resource/100/ConfigSet/AIST7 resource/100/ConfigSet/AIST7/src src/jp/go/aist/rtm/rtcbuilder/java/template/java test/jp/go/aist/rtm/rtcbuilder/java/_test/_100
openrtm @ openrtm.org
openrtm @ openrtm.org
2016年 5月 25日 (水) 19:59:34 JST
Author: ga
Date: 2016-05-25 19:59:34 +0900 (Wed, 25 May 2016)
New Revision: 629
Added:
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/resource/100/ConfigSet/AIST7/
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/resource/100/ConfigSet/AIST7/build_ModuleName.xml
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/resource/100/ConfigSet/AIST7/src/
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/resource/100/ConfigSet/AIST7/src/ModuleName.java
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/resource/100/ConfigSet/AIST7/src/ModuleNameComp.java
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/resource/100/ConfigSet/AIST7/src/ModuleNameImpl.java
Modified:
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/src/jp/go/aist/rtm/rtcbuilder/java/template/java/Java_RTC.java.vsl
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/test/jp/go/aist/rtm/rtcbuilder/java/_test/_100/ConfigSetTest.java
Log:
fixed "conf.__type__.***".
Added: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/resource/100/ConfigSet/AIST7/build_ModuleName.xml
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/resource/100/ConfigSet/AIST7/build_ModuleName.xml (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/resource/100/ConfigSet/AIST7/build_ModuleName.xml 2016-05-25 10:59:34 UTC (rev 629)
@@ -0,0 +1,28 @@
+<!--
+# -*- Buildfile -*-
+# @file build_ModuleName.xml
+# @brief RTComponent makefile for "ModuleName component"
+# @date $Date$
+#
+# $Id$
+ -->
+<project name="ModuleName" default="compile">
+ <property name="source" value="src" />
+ <property name="dest" value="bin" />
+ <property environment="env" />
+
+ <target name="mkdir">
+ <mkdir dir="${dest}" />
+ </target>
+
+
+ <target name="compile" depends="mkdir">
+ <javac srcdir="${source}" destdir="${dest}">
+ <classpath>
+ <fileset dir="${env.RTM_JAVA_ROOT}/jar">
+ <include name="*.jar"/>
+ </fileset>
+ </classpath>
+ </javac>
+ </target>
+</project>
Property changes on: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/resource/100/ConfigSet/AIST7/build_ModuleName.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/resource/100/ConfigSet/AIST7/src/ModuleName.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/resource/100/ConfigSet/AIST7/src/ModuleName.java (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/resource/100/ConfigSet/AIST7/src/ModuleName.java 2016-05-25 10:59:34 UTC (rev 629)
@@ -0,0 +1,53 @@
+// -*- Java -*-
+/*!
+ * @file ModuleName.java
+ * @date $Date$
+ *
+ * $Id$
+ */
+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;
+/*!
+ * @class ModuleName
+ * @brief ModuleDescription
+ */
+public class ModuleName implements RtcNewFunc, RtcDeleteFunc, RegisterModuleFunc {
+// Module specification
+// <rtc-template block="module_spec">
+ public static String component_conf[] = {
+ "implementation_id", "ModuleName",
+ "type_name", "ModuleName",
+ "description", "ModuleDescription",
+ "version", "1.0.0",
+ "vendor", "VenderName",
+ "category", "Category",
+ "activity_type", "DataFlowComponent",
+ "max_instance", "1",
+ "language", "Java",
+ "lang_type", "compile",
+ // Configuration variables
+ "conf.default.test", "0",
+ // Widget
+ "conf.__widget__.test", "slider.0.2",
+ // Constraints
+ "conf.__constraints__.test", "-1.0<x<1.0",
+ "conf.__type__.test", "double",
+ ""
+ };
+// </rtc-template>
+ public RTObject_impl createRtc(Manager mgr) {
+ return new ModuleNameImpl(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 ModuleName(), new ModuleName());
+ }
+}
Property changes on: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/resource/100/ConfigSet/AIST7/src/ModuleName.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/resource/100/ConfigSet/AIST7/src/ModuleNameComp.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/resource/100/ConfigSet/AIST7/src/ModuleNameComp.java (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/resource/100/ConfigSet/AIST7/src/ModuleNameComp.java 2016-05-25 10:59:34 UTC (rev 629)
@@ -0,0 +1,100 @@
+// -*- Java -*-
+/*!
+ * @file ModuleNameComp.java
+ * @brief Standalone component
+ * @date $Date$
+ *
+ * $Id$
+ */
+
+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.Properties;
+
+/*!
+ * @class ModuleNameComp
+ * @brief Standalone component Class
+ *
+ */
+public class ModuleNameComp implements ModuleInitProc {
+
+ public void myModuleInit(Manager mgr) {
+ Properties prop = new Properties(ModuleName.component_conf);
+ mgr.registerFactory(prop, new ModuleName(), new ModuleName());
+
+ // Create a component
+ RTObject_impl comp = mgr.createComponent("ModuleName");
+ if( comp==null ) {
+ System.err.println("Component create failed.");
+ System.exit(0);
+ }
+
+ // 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 (ServantNotActive e) {
+// e.printStackTrace();
+// } catch (WrongPolicy e) {
+// e.printStackTrace();
+// }
+//
+// // Get the port list of the component
+// PortListHolder portlist = new PortListHolder();
+// portlist.value = rtobj.get_ports();
+//
+// // getting port profiles
+// System.out.println( "Number of Ports: " );
+// System.out.println( portlist.value.length );
+// for( int intIdx=0;intIdx<portlist.value.length;++intIdx ) {
+// Port port = portlist.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.
+ ModuleNameComp init = new ModuleNameComp();
+ 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);
+ }
+
+}
Property changes on: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/resource/100/ConfigSet/AIST7/src/ModuleNameComp.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/resource/100/ConfigSet/AIST7/src/ModuleNameImpl.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/resource/100/ConfigSet/AIST7/src/ModuleNameImpl.java (rev 0)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/resource/100/ConfigSet/AIST7/src/ModuleNameImpl.java 2016-05-25 10:59:34 UTC (rev 629)
@@ -0,0 +1,238 @@
+// -*- Java -*-
+/*!
+ * @file ModuleNameImpl.java
+ * @brief ModuleDescription
+ * @date $Date$
+ *
+ * $Id$
+ */
+import jp.go.aist.rtm.RTC.DataFlowComponentBase;
+import jp.go.aist.rtm.RTC.Manager;
+import jp.go.aist.rtm.RTC.util.DoubleHolder;
+import RTC.ReturnCode_t;
+/*!
+ * @class ModuleNameImpl
+ * @brief ModuleDescription
+ *
+ */
+public class ModuleNameImpl extends DataFlowComponentBase {
+ /*!
+ * @brief constructor
+ * @param manager Maneger Object
+ */
+ public ModuleNameImpl(Manager manager) {
+ super(manager);
+ // <rtc-template block="initializer">
+ // </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">
+ // </rtc-template>
+ bindParameter("test", m_test, "0");
+ 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);
+// }
+//
+ // Configuration variable declaration
+ // <rtc-template block="config_declare">
+ /*!
+ *
+ * - Name: test
+ * - DefaultValue: 0
+ */
+ protected DoubleHolder m_test = new DoubleHolder();
+ // </rtc-template>
+ // 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>
+}
Property changes on: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/resource/100/ConfigSet/AIST7/src/ModuleNameImpl.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/src/jp/go/aist/rtm/rtcbuilder/java/template/java/Java_RTC.java.vsl
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/src/jp/go/aist/rtm/rtcbuilder/java/template/java/Java_RTC.java.vsl 2016-05-25 10:59:08 UTC (rev 628)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/src/jp/go/aist/rtm/rtcbuilder/java/template/java/Java_RTC.java.vsl 2016-05-25 10:59:34 UTC (rev 629)
@@ -62,7 +62,7 @@
#end
#foreach($configParam in ${rtcParam.configParams})
- "conf.__type__.${configParam.name}", "${configParam.type}#if( ${configParam.step.length()} > 0 )#end",
+ "conf.__type__.${configParam.name}", "${configParam.type}",
#end
#end
Modified: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/test/jp/go/aist/rtm/rtcbuilder/java/_test/_100/ConfigSetTest.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/test/jp/go/aist/rtm/rtcbuilder/java/_test/_100/ConfigSetTest.java 2016-05-25 10:59:08 UTC (rev 628)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.java/test/jp/go/aist/rtm/rtcbuilder/java/_test/_100/ConfigSetTest.java 2016-05-25 10:59:34 UTC (rev 629)
@@ -35,6 +35,37 @@
generator.addGenerateManager(new JavaCMakeGenerateManager());
}
+ public void testAIST7() throws Exception {
+ rtcParam.setName("ModuleName");
+ rtcParam.setDescription("ModuleDescription");
+ rtcParam.setVersion("1.0.0");
+ rtcParam.setVender("VenderName");
+ rtcParam.setCategory("Category");
+ rtcParam.setComponentType("DataFlowComponent");
+ rtcParam.setActivityType("PERIODIC");
+ rtcParam.setMaxInstance(1);
+ rtcParam.setComponentKind("DataFlowComponent");
+
+ List<ConfigSetParam> configset = new ArrayList<ConfigSetParam>();
+ ConfigSetParam param01 = new ConfigSetParam("test", "double", "", "0");
+ param01.setWidget("slider");
+ param01.setStep("0.2");
+ param01.setConstraint("-1.0<x<1.0");
+ configset.add(param01);
+ rtcParam.getConfigParams().addAll(configset);
+
+ List<GeneratedResult> result = generator.generateTemplateCode(genParam);
+
+ String targetDir = rootPath + "/resource/100/ConfigSet/AIST7/";
+
+ assertEquals(33, result.size());
+ checkCode(result, targetDir, "src/ModuleNameComp.java");
+ checkCode(result, targetDir, "src/ModuleName.java");
+ checkCode(result, targetDir, "src/ModuleNameImpl.java");
+ //
+ checkCode(result, targetDir, "build_ModuleName.xml");
+ }
+
public void testAIST6() throws Exception {
rtcParam.setName("ModuleName");
rtcParam.setDescription("ModuleDescription");
More information about the openrtm-commit
mailing list