[openrtm-commit:01654] r538 - in trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.python/src/jp/go/aist/rtm/rtcbuilder/python: manager template/python
openrtm @ openrtm.org
openrtm @ openrtm.org
2015年 11月 18日 (水) 23:35:23 JST
Author: n-ando
Date: 2015-11-18 23:35:23 +0900 (Wed, 18 Nov 2015)
New Revision: 538
Modified:
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.python/src/jp/go/aist/rtm/rtcbuilder/python/manager/PythonConverter.java
trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.python/src/jp/go/aist/rtm/rtcbuilder/python/template/python/Py_RTC.py.vsl
Log:
[incompat] Python RTC's inports/outpors variables now properly initialized.
Modified: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.python/src/jp/go/aist/rtm/rtcbuilder/python/manager/PythonConverter.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.python/src/jp/go/aist/rtm/rtcbuilder/python/manager/PythonConverter.java 2015-10-27 15:20:50 UTC (rev 537)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.python/src/jp/go/aist/rtm/rtcbuilder/python/manager/PythonConverter.java 2015-11-18 14:35:23 UTC (rev 538)
@@ -289,20 +289,31 @@
//文字列に()を付けてデフォルトコンストラクタ扱いにする
if(!rtcType.matches(".*::.*")) return rtcType + "()";
String methodName = rtcType.replace("::", ".");
-
+
//module名が「RTC」のときは親データ型である「Time」のコンストラクタを引数に入れた
//コンストラクタを引数に入れコンストラクタ文字列にして返す
//それ以外のmodule名の場合、()を付けただけのデフォルトコンストラクタを返す
- if(rtcType.startsWith("RTC::")) {
- methodName = methodName + "(RTC.Time(0,0)";
- }
- else {
- methodName = methodName + "()";
- }
+// if(rtcType.startsWith("RTC::")) {
+// methodName = methodName + "(RTC.Time(0,0)";
+// }
+// else {
+// methodName = methodName + "()";
+// }
return methodName;
}
+ /**
+ * データポート変数型定義変数を返す
+ *
+ * @param rtcType ポートの型
+ * @return 変数型定義変数
+ */
+ public String getTypeDefinition(String rtcType) {
+ String methodName = rtcType.replace("::", "._d_");
+ return methodName;
+ }
+
public String convFullName(String source) {
if(source.contains("::")) {
return source.replace("::", ".");
Modified: trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.python/src/jp/go/aist/rtm/rtcbuilder/python/template/python/Py_RTC.py.vsl
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.python/src/jp/go/aist/rtm/rtcbuilder/python/template/python/Py_RTC.py.vsl 2015-10-27 15:20:50 UTC (rev 537)
+++ trunk/rtmtools/jp.go.aist.rtm.rtcbuilder.python/src/jp/go/aist/rtm/rtcbuilder/python/template/python/Py_RTC.py.vsl 2015-11-18 14:35:23 UTC (rev 538)
@@ -118,7 +118,8 @@
OpenRTM_aist.DataFlowComponentBase.__init__(self, manager)
#foreach($port in ${rtcParam.inports})
- self._d_${port.tmplVarName} = ${pyConv.getDataportInitMethodName(${port.type})},${pyConv.convPortInit(${port.type})})
+ ${port.tmplVarName}_arg = [None] * ((len(${pyConv.getTypeDefinition(${port.type})}) - 4) / 2)
+ self._d_${port.tmplVarName} = ${pyConv.getDataportInitMethodName(${port.type})}(*${port.tmplVarName}_arg)
"""
#if(${port.docDescription.length()}>0) ${tmpltHelperPy.convertDescDocPy(${port.docDescription})}
#end
@@ -138,7 +139,8 @@
self._${port.name}In = OpenRTM_aist.InPort("${port.name}", self._d_${port.tmplVarName})
#end
#foreach($port in ${rtcParam.outports})
- self._d_${port.tmplVarName} = ${pyConv.getDataportInitMethodName(${port.type})},${pyConv.convPortInit(${port.type})})
+ ${port.tmplVarName}_arg = [None] * ((len(${pyConv.getTypeDefinition(${port.type})}) - 4) / 2)
+ self._d_${port.tmplVarName} = ${pyConv.getDataportInitMethodName(${port.type})}(*${port.tmplVarName}_arg)
"""
#if(${port.docDescription.length()}>0) ${tmpltHelperPy.convertDescDocPy(${port.docDescription})}
#end
More information about the openrtm-commit
mailing list