[openrtm-commit:03076] r1103 - in branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src: RTMExamples RTMExamples/SimpleService RTMExamples/Throughput RTMExamples_scripts jp/go/aist/rtm/RTC jp/go/aist/rtm/RTC/util
openrtm @ openrtm.org
openrtm @ openrtm.org
2018年 1月 18日 (木) 15:14:08 JST
Author: t-katami
Date: 2018-01-18 15:14:08 +0900 (Thu, 18 Jan 2018)
New Revision: 1103
Added:
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/Throughput/
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples_scripts/Throughput.bat
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples_scripts/Throughput.sh
Modified:
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/MyServiceConsumerImpl.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/MyServiceSVC_impl.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/rtc.conf
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/Throughput/ThroughputImpl.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/Throughput/rtc.conf
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/TimeValue.java
Log:
[merge] r1086,r1088-r1098,r1102 have been merged from trunk.
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/MyServiceConsumerImpl.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/MyServiceConsumerImpl.java 2018-01-18 06:00:37 UTC (rev 1102)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/MyServiceConsumerImpl.java 2018-01-18 06:14:08 UTC (rev 1103)
@@ -8,6 +8,7 @@
import jp.go.aist.rtm.RTC.Manager;
import jp.go.aist.rtm.RTC.port.CorbaConsumer;
import jp.go.aist.rtm.RTC.port.CorbaPort;
+import jp.go.aist.rtm.RTC.util.DataRef;
import RTC.ReturnCode_t;
public class MyServiceConsumerImpl extends DataFlowComponentBase {
@@ -16,6 +17,7 @@
super(manager);
// <rtc-template block="initializer">
m_MyServicePort = new CorbaPort("MyService");
+ this.result = new DataRef<String>(resultVal);
}
// The initialize action (on CREATED->ALIVE transition)
@@ -112,10 +114,21 @@
std::cout << "arg : " << argv[1] << std::endl;
*/
+ if(async != null && !async.isAlive()){
+ System.out.println( "echo() finished: " + this.result.v );
+ async = null;
+ }
m_myservice0 = m_myservice0Base._ptr();
if( argv[0].equals("echo") && argv.length>1 ) {
- String retmsg = m_myservice0.echo(argv[1]);
- System.out.println( "echo return: " + retmsg );
+ if(async == null){
+ //String retmsg = m_myservice0.echo(argv[1]);
+ //System.out.println( "echo return: " + retmsg );
+ async = new Thread(
+ new echoFunctor(m_myservice0,argv[1],this.result));
+ async.start();
+ } else{
+ System.out.println("echo() still invoking");
+ }
return super.onExecute(ec_id);
}
@@ -217,4 +230,25 @@
protected MyService m_myservice0;
// </rtc-template>
+ Thread async;
+ String resultVal = new String();
+ DataRef<String> result;
+
+ class echoFunctor implements Runnable{
+ public echoFunctor(MyService comp,String arg,DataRef<String> result){
+ this.obj = comp;
+ this.arg = arg;
+ this.result = result;
+ }
+
+ @Override
+ public void run() {
+ result.v = obj.echo(this.arg);
+ }
+ MyService obj;
+ String arg;
+ DataRef<String> result;
+ }
+
+
}
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/MyServiceSVC_impl.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/MyServiceSVC_impl.java 2018-01-18 06:00:37 UTC (rev 1102)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/MyServiceSVC_impl.java 2018-01-18 06:14:08 UTC (rev 1103)
@@ -23,7 +23,14 @@
if( m_echoList.value==null ) m_echoList.value = new String[0];
this.push_back(m_echoList, msg);
System.out.println( "MyService::echo() was called." );
- System.out.println( "Message: " + msg );
+ for(int ic=0;ic<10;++ic){
+ System.out.println( "Message: " + msg );
+ try{
+ Thread.sleep(1000L);
+ }catch(InterruptedException ex){
+ }
+ }
+ System.out.println( "MyService::echo() was finished." );
return msg;
}
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/rtc.conf
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/rtc.conf 2018-01-18 06:00:37 UTC (rev 1102)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/SimpleService/rtc.conf 2018-01-18 06:14:08 UTC (rev 1103)
@@ -3,10 +3,12 @@
logger.enable:YES
logger.log_level:PARANOID
-#manager.modules.load_path:./RTMExamples/SimpleIO
-#manager.modules.preload: ConsoleOut
-#manager.components.precreate: ConsoleOut
+manager.modules.load_path:./RTMExamples/SimpleService
+#manager.modules.preload: MyServiceConsumer
+#manager.modules.preload: MyServiceProvider
+#manager.components.precreate: MyServiceConsumer
+#manager.components.precreate: MyServiceProvider
+#
+#Generic.MyServiceProvider.config_file: ../RTMExamples/SimpleService/component.conf
+#Generic.MyServiceConsumer.config_file: ../RTMExamples/SimpleService/component.conf
-#Generic.MyServiceProvider.config_file: ./RTMExamples/SimpleService/component.conf
-#Generic.MyServiceConsumer.config_file: ./RTMExamples/SimpleService/component.conf
-
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/Throughput/ThroughputImpl.java
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/Throughput/ThroughputImpl.java 2017-12-22 08:55:35 UTC (rev 1086)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/Throughput/ThroughputImpl.java 2018-01-18 06:14:08 UTC (rev 1103)
@@ -12,7 +12,7 @@
import jp.go.aist.rtm.RTC.DataFlowComponentBase;
import jp.go.aist.rtm.RTC.Manager;
-import jp.go.aist.rtm.RTC.connectorListener.ReturnCode;
+//import jp.go.aist.rtm.RTC.connectorListener.ReturnCode;
import jp.go.aist.rtm.RTC.port.InPort;
import jp.go.aist.rtm.RTC.port.OutPort;
import jp.go.aist.rtm.RTC.port.ConnectorBase;
@@ -37,6 +37,68 @@
import org.omg.CORBA.portable.OutputStream;
+/**
+ * {@.ja Clock Throughput Component}
+ * <p>
+ * {@.ja 時間計測用RTC
+ *
+ * データポートのスループットを計測するコンポーネント。interface_type,
+ * subscription_type 等 ConnectorProfile パラメータやデータサイズ、サン
+ * プル数などを変更して、その際の転送時間(最大、最小、平均、標準偏差)
+ * およびスループットを測定してファイルに記録することができる。
+ *
+ * 基本的には、以下の(a)や(b)のような接続形態で使用する。
+ * <pre>
+ * +-----------+
+ * | ______ | ______ ______
+ * +->|_____|>-+ >|_____|>-->|_____|>
+ * (a) (b)
+ * </pre>
+ * 同一コンポーネント内では(a)、同一プロセス内、同一ノード内のスループッ
+ * トは (a)または(b)、異なるノード間のスループットを計測する際は (b)の
+ * 接続形態で計測する。計測は以下の手順で行う。
+ *
+ * <ul>
+ * <li># コンポーネントを起動する
+ * <li># コンフィグレーションパラメータを設定する
+ * <li># 必要なコネクタプロファイルを設定してポートを接続する
+ * <li># コンポーネントをアクティベートする
+ * </ul>
+ *
+ * 計測結果はデータを受け取ったコンポーネントがファイルに記録する。
+ *
+ * * コンフィギュレーションパラメータ
+ * <ul>
+ * <li> mode: 計測モード名。logincr, incr, const から選択可能。
+ * - logincr: logスケールでデータ数を増加させ計測。実際には、1, 2, 5,
+ * 10, .. といった間隔でデータ数を増加させ、logスケールでプ
+ * ロットした際にほぼ等間隔となるように計測する。
+ * - incr: incrementパラメータで指定されたバイト数で、一定間隔でデータ
+ * 数を増加させる。
+ * - const: データは増加させず一定サイズでスループットを計測する。
+ *
+ * <li> outputfile: 出力ファイル名。onActivated時、またはデータ受信時にファ
+ * イルがオープンされるので、それ以降にパラメータを設定し
+ * た場合は反映されない。
+ * <li> increment: データ増分。
+ * mode が incr の場合のデータ増分を byte で指定する。
+ *
+ * <li> maxsize: 最大データ個数を指定する。送信するシーケンスデータのサイ
+ * ズを指定する。実際のデータサイズは、この個数に1データ当た
+ * りのバイト数をかけたものとなる。
+ * <li> maxsend: 最大送信数。データ送信回数の最大値を指定する。モードが
+ * logincr, incr の場合、データサイズ毎に maxsend 回数データ
+ * を送信する。
+ * <li> maxsample: 最大サンプリング数。データを受信し、統計情報を計算する
+ * 際の最大サンプル数を指定する。データ送信側の送信数がサン
+ * プル数より少ない場合、受信したサンプル数で統計情報を計算
+ * する。データ送信側の送信数がサンプル数より多い場合、古い
+ * 情報は破棄され、最新の maxsample 個の計測データから統計情
+ * 報を計算する。
+ * </ul>}
+ *
+ *
+ */
public class ThroughputImpl extends DataFlowComponentBase {
public ThroughputImpl(Manager manager) {
@@ -195,7 +257,7 @@
inLongIn.addConnectorListener(
ConnectorListenerType.ON_CONNECT, new Listener(this));
addOutPort("out", outLongOut);
- varSize = Long.SIZE;
+ varSize = Integer.SIZE;
} else if(type.equals("float")){
addInPort("in", inFloatIn);
inFloatIn.addConnectorDataListener(
@@ -220,12 +282,12 @@
} catch (Exception e) {
e.printStackTrace();
}
- System.out.println("varsize: "+varSize);
+ //System.out.println("varsize: "+varSize);
- record.ensureCapacity(maxSample.getValue());
for(int ic=0;ic<maxSample.getValue();++ic){
- record.add(new TimeValue());
+ record.add(new RTC.Time(0,0));
}
+
return super.onInitialize();
}
@@ -281,7 +343,8 @@
if (getInPortConnectorSize() == 0) {
- super.exit();
+ Thread async = new Thread(new func_exit(this));
+ async.start();
}
return super.onDeactivated(ec_id);
}
@@ -318,7 +381,7 @@
dataSize = dataSize + increment.getValue();
} else {
if((long)sendCount > maxSend.getValue()) {
- exit();
+ deactivate(ec_id);
return ReturnCode_t.RTC_OK;
}
}
@@ -331,7 +394,7 @@
*/
try{
- Thread.sleep((long)(sleepTime.getValue()*1000));
+ Thread.sleep((long)(sleepTime.getValue()*1000.0));
}catch(InterruptedException ex){
}
@@ -448,13 +511,21 @@
public void receiveData(final RTC.Time rtcTime, final long seqLength) {
// data arrived -> getting time
- TimeValue receivedTime
- = ClockManager.getInstance().getClock("system").getTime();
+ //TimeValue receivedTime
+ // = ClockManager.getInstance().getClock("system").getTime();
+
+ long nanotime = System.nanoTime();
+ RTC.Time receivedTime = new RTC.Time((int)(nanotime/1000000000),
+ (int)(nanotime%1000000000));
+ //TimeValue receivedTime
+ // = new TimeValue((nanotime/1000000000),(nanotime%1000000000));
+
if (seqSize == 0) {
seqSize = seqLength;
}
// calculate latency statistics
+ /*
System.out.println(
"Time: " + rtcTime.sec + "[s]\t" + rtcTime.nsec + "[ns]");
System.out.print("length(): " + seqLength);
@@ -461,6 +532,7 @@
System.out.print("\tseqSize: " + seqSize);
System.out.print("\trecordNum: " + recordNum);
System.out.println("\trecordPtr: " + recordPtr);
+ */
if (seqLength != seqSize && recordNum != 0) {
double maxLatency = 0.0, minLatency = 10000.0, meanLatency = 0.0;
@@ -472,19 +544,21 @@
} else {
recordLen = recordPtr;
}
-
+ /*
System.out.print("%%%%% record_num: " + recordNum);
System.out.print(" record_ptr: " + recordPtr);
System.out.print(" record_len: " + recordLen);
System.out.println(" maxsample: " + maxSample.getValue());
-
+ */
for (int ic = 0; ic < recordLen; ++ic) {
- double tmp = record.get(ic).toDouble();
+ double tmp = (double)record.get(ic).sec
+ + (double)record.get(ic).nsec/(1000000000.0);
sum = sum + tmp;
- sqSum = (sqSum + tmp) * tmp;
+ sqSum = sqSum + (tmp * tmp);
if (tmp > maxLatency) {
maxLatency = tmp;
- } else if (tmp < minLatency) {
+ }
+ if (tmp < minLatency) {
minLatency = tmp;
}
}
@@ -493,9 +567,11 @@
stdDev = Math.sqrt(variance);
// Time tm (long, long) = 4byte + 4byte [Mbps]
throughput
- = ((((seqSize * varSize) + 8) * 8) / meanLatency) / (1024 * 1024);
+ = (((seqSize * varSize) + (Integer.SIZE + Integer.SIZE))
+ / meanLatency)
+ / (1024 * 1024);
- // size[byte], min[s], max[s], mean[s], stddev[s], throughpiut[Mbps]
+ // size[byte], min[s], max[s], mean[s], stddev[s], throughput[Mbps]
String str = new String();
str = seqSize + "\t";
str = str + minLatency + "\t" + maxLatency + "\t";
@@ -507,27 +583,34 @@
} catch(Exception ex){
System.out.println(ex.toString());
}
-
+ /*
System.out.println("==============================");
System.out.print(seqSize + "\t");
System.out.print(minLatency + "\t" + maxLatency + "\t");
System.out.print(meanLatency + "\t" + stdDev + "\t");
System.out.println(throughput);
+ */
// reset size/index variables
recordNum = 0;
recordPtr = 0;
if (seqLength < seqSize) {
- super.exit();
-/*
- coil::Async* async;
- async = coil::AsyncInvoker(this, std::mem_fun(&Throughput::exit));
- async->invoke();
-*/
+ Thread async = new Thread(new func_exit(this));
+ async.start();
+ return;
}
}
// measuring latency
- TimeValue sendTime = new TimeValue(rtcTime.sec, rtcTime.nsec/1000);
- receivedTime = receivedTime.minus(sendTime);
+ int sec;
+ int nsec;
+ if(receivedTime.nsec>=rtcTime.nsec){
+ sec = receivedTime.sec - rtcTime.sec;
+ nsec = receivedTime.nsec - rtcTime.nsec;
+ } else {
+ sec = receivedTime.sec - rtcTime.sec - 1;
+ nsec = (receivedTime.nsec+1000000000) - rtcTime.nsec;
+ }
+ receivedTime = new RTC.Time(sec,nsec);
+
record.set(recordPtr,receivedTime);
seqSize = seqLength;
recordPtr = recordPtr + 1;
@@ -567,16 +650,17 @@
outputStream.newLine();
String str = new String();
str = info.properties._dump(str,info.properties,0);
- outputStream.write(str);
+ String crlf = System.getProperty("line.separator");
+ str = str.replace(crlf, crlf+"# ");
+ outputStream.write("# "+str+crlf);
// print header
outputStream.write(
- "size[byte]\tmin[s]\tmax[s]\tmean[s]\tstddev[s]\tthroughpiut[Mbps]");
+ "size[byte]\tmin[s]\tmax[s]\tmean[s]\tstddev[s]\tthroughput[Mbps]");
outputStream.newLine();
outputStream.flush();
- record.ensureCapacity(maxSample.getValue());
for(int ic=0;ic<maxSample.getValue();++ic){
- record.add(new TimeValue());
+ record.add(new RTC.Time(0,0));
}
} catch(Exception ex) {
System.out.println(ex.toString());
@@ -590,9 +674,6 @@
// DataOutPort declaration
// <rtc-template block="outport_declare">
- //protected TimedLong m_out_val;
- //protected DataRef<TimedLong> m_out;
- //protected OutPort<TimedLong> m_outOut;
protected TimedOctetSeq inOctet = new TimedOctetSeq();
protected DataRef<TimedOctetSeq> inOctetRef;
@@ -665,7 +746,7 @@
private int dataSize;
private BufferedWriter outputStream;
- private ArrayList<TimeValue> record = new ArrayList<TimeValue>();
+ private ArrayList<RTC.Time> record = new ArrayList<RTC.Time>();
private long sendCount;
private int logMulCnt;
private long varSize;
@@ -674,6 +755,18 @@
private int recordNum = 0;
private int recordPtr = 0;
+ class func_exit implements Runnable{
+ public func_exit(ThroughputImpl comp){
+ this.obj = comp;
+ }
+
+ @Override
+ public void run() {
+ obj.exit();
+ }
+ ThroughputImpl obj;
+ }
+
class DataListener<DataType> extends ConnectorDataListenerT<DataType>{
public DataListener(ThroughputImpl comp, Class cl){
super(cl);
@@ -680,7 +773,8 @@
throughputComp = comp;
}
@Override
- public ReturnCode operator(ConnectorBase.ConnectorInfo arg,
+ //public ReturnCode operator(ConnectorBase.ConnectorInfo arg,
+ public void operator(ConnectorBase.ConnectorInfo arg,
DataType data) {
ConnectorBase.ConnectorInfo info =(ConnectorBase.ConnectorInfo)arg;
Class cl = data.getClass();
@@ -699,7 +793,7 @@
//set throws
}
throughputComp.receiveData(tim, leng);
- return ReturnCode.NO_CHANGE;
+ //return ReturnCode.NO_CHANGE;
}
public ThroughputImpl throughputComp;
}
@@ -710,21 +804,24 @@
}
@Override
- public ReturnCode operator(ConnectorBase.ConnectorInfo arg){
+ //public ReturnCode operator(ConnectorBase.ConnectorInfo arg){
+ public void operator(ConnectorBase.ConnectorInfo arg){
System.out.println("------------------------------");
- System.out.println(" Connected !!");
- System.out.println("------------------------------");
+ //System.out.println(" Connected !!");
+ //System.out.println("------------------------------");
System.out.println("Profile::name: "+arg.name);
System.out.println("Profile::id: "+arg.id);
System.out.println("Profile::properties: ");
String str = new String();
+ /*
System.out.println(
"Profile::data_type:"+arg.properties.getProperty("data_type"));
+ */
str = arg.properties._dump(str,arg.properties,0);
System.out.println(str);
System.out.println("------------------------------");
throughputComp.setConnectorProfile(arg);
- return ReturnCode.NO_CHANGE;
+ //return ReturnCode.NO_CHANGE;
}
public ThroughputImpl throughputComp;
}
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/Throughput/rtc.conf
===================================================================
--- trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/Throughput/rtc.conf 2017-12-22 08:55:35 UTC (rev 1086)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples/Throughput/rtc.conf 2018-01-18 06:14:08 UTC (rev 1103)
@@ -5,6 +5,6 @@
manager.components.preactivation: Throughput0
example.Throughput.conf.default.maxsize: 1000000
-example.Throughput.conf.default.datatype: float
+example.Throughput.conf.default.datatype: long
example.Throughput.conf.default.filesuffix: -samecomp
Copied: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples_scripts/Throughput.bat (from rev 1098, trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples_scripts/Throughput.bat)
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples_scripts/Throughput.bat (rev 0)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples_scripts/Throughput.bat 2018-01-18 06:14:08 UTC (rev 1103)
@@ -0,0 +1,3 @@
+ at call set_classpath.bat
+java RTMExamples.Throughput.ThroughputComp -f RTMExamples\Throughput\rtc.conf %*
+pause;
Copied: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples_scripts/Throughput.sh (from rev 1086, trunk/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples_scripts/Throughput.sh)
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples_scripts/Throughput.sh (rev 0)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/RTMExamples_scripts/Throughput.sh 2018-01-18 06:14:08 UTC (rev 1103)
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+if test "x$RTM_JAVA_ROOT" = "x" ; then
+ echo "Environment variable RTM_JAVA_ROOT is not set."
+ echo "Please specify the OpenRTM-aist installation directory."
+ echo "Abort."
+ exit 1
+fi
+cd `dirname $0`
+. ./search_classpath.func
+export CLASSPATH=`get_classpath`
+java RTMExamples.Throughput.ThroughputComp -f RTMExamples/Throughput/rtc.conf ${1+"$@"}
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2018-01-18 06:00:37 UTC (rev 1102)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/Manager.java 2018-01-18 06:14:08 UTC (rev 1103)
@@ -868,178 +868,8 @@
}
precreateComponent();
+ initPreConnection();
initPreActivation();
- initPreConnection();
-/*
- { // pre-connection
- String preconnect
- = m_config.getProperty("manager.components.preconnect");
- rtcout.println(Logbuf.TRACE, "Connection pre-connection: "
- + preconnect);
- String[] connectors = new String[0];
- if ( preconnect == null || preconnect.length() == 0 ) {
- }
- else {
- connectors = preconnect.split(",");
- rtcout.println(Logbuf.TRACE, "connectors: "
- +Arrays.toString(connectors));
- }
- for (int ic=0; ic < connectors.length; ++ic) {
- // ConsoleIn.out:Console.in(dataflow_type=push&....)
- String[] conn_prop = connectors[ic].split("\\(");
- if ( conn_prop == null || conn_prop.length == 0 ) {
- }
- if ( conn_prop.length == 2 ) {
- conn_prop[1] = conn_prop[1].replace(")","");
- }
- String[] comp_ports = conn_prop[0].split(":");
- if(comp_ports.length != 2) {
- rtcout.println(Logbuf.ERROR,
- "Invalid format for pre-connection.");
- rtcout.println(Logbuf.ERROR,
- "Format must be Comp0.port0:Comp1.port1");
- continue;
- }
- String comp0_name = comp_ports[0].split("\\.")[0];
- String comp1_name = comp_ports[1].split("\\.")[0];
- RTObject_impl comp0 = getComponent(comp0_name);
- RTObject_impl comp1 = getComponent(comp1_name);
- if (comp0 == null) {
- rtcout.println(Logbuf.ERROR,
- comp0_name + " not found.");
- continue;
- }
- if (comp1 == null) {
- rtcout.println(Logbuf.ERROR,
- comp1_name + " not found.");
- continue;
- }
- String port0 = comp_ports[0];
- String port1 = comp_ports[1];
-
- PortServiceListHolder ports0 = new PortServiceListHolder();
- ports0.value = comp0.get_ports();
-
- PortServiceListHolder ports1 = new PortServiceListHolder();
- ports1.value = comp1.get_ports();
-
- rtcout.println(Logbuf.DEBUG, comp0_name + " has "
- + ports0.value.length + " ports.");
- rtcout.println(Logbuf.DEBUG, comp1_name + " has "
- + ports1.value.length + " ports.");
-
- PortServiceListHolder port0_var = new PortServiceListHolder();
- port0_var.value = new PortService[0];
- int port0_ic = -1;
- for (int p=0; p < ports0.value.length; ++p) {
- RTC.PortProfile pp = ports0.value[p].get_port_profile();
- String s = pp.name;
- if (comp_ports[0].equals(s)) {
- rtcout.println(Logbuf.DEBUG, "port " + comp_ports[0]
- + " found: ");
- port0_ic = p;
- }
- }
- PortServiceListHolder port1_var = new PortServiceListHolder();
- int port1_ic = -1;
- for (int p=0; p < ports1.value.length; ++p) {
- RTC.PortProfile pp = ports1.value[p].get_port_profile();
- String s = pp.name;
- if (comp_ports[1].equals(s)) {
- rtcout.println(Logbuf.DEBUG, "port " + comp_ports[1]
- + " found: ");
- port1_ic = p;
- }
- }
- if (port0_ic == -1) {
- rtcout.println(Logbuf.ERROR,
- "port0 " + comp_ports[0] +" is nil obj");
- continue;
- }
- if (port1_ic == -1) {
- rtcout.println(Logbuf.ERROR,
- "port1 " + comp_ports[1] +" is nil obj");
- continue;
- }
- ConnectorProfile conn_prof = new ConnectorProfile();
- String prof_name;
- conn_prof.name = connectors[ic];
- conn_prof.connector_id = "";
- conn_prof.ports = new PortService[2];
- conn_prof.ports[0] = ports0.value[port0_ic];
- conn_prof.ports[1] = ports1.value[port1_ic];
-
- NVListHolder nvholder = new NVListHolder();
- nvholder.value = conn_prof.properties;
- if( nvholder.value==null ) {
- nvholder.value = new NameValue[0];
- }
-
-
- if ( conn_prop.length == 2 ) {
- String[] opt_props = conn_prop[1].split("\\&");
- for (int o=0; o < opt_props.length; ++o) {
- String[] temp = opt_props[o].split("=");
- //prop["dataport." + temp[0]] = temp[1];
- rtcout.println(Logbuf.TRACE, "options: " + Arrays.toString(temp));
- CORBA_SeqUtil.push_back(nvholder,
- NVUtil.newNVString("dataport." + temp[0],temp[1]));
- }
- }
- int index;
- index = NVUtil.find_index(nvholder,"dataport.dataflow_type");
- if(index<0) {
- CORBA_SeqUtil.push_back(nvholder,
- NVUtil.newNVString("dataport.dataflow_type", "push"));
- }
- index = NVUtil.find_index(nvholder,"dataport.interface_type");
- if(index<0) {
- CORBA_SeqUtil.push_back(nvholder,
- NVUtil.newNVString("dataport.interface_type","corba_cdr"));
- }
- conn_prof.properties = nvholder.value;
-
- ConnectorProfileHolder profileholder = new ConnectorProfileHolder();
- profileholder.value = conn_prof;
-
- if (ReturnCode_t.RTC_OK != ports0.value[port0_ic].connect(profileholder)) {
- rtcout.println(Logbuf.ERROR,
- "Connection error: " + connectors[ic]);
- }
-
- NVUtil.dump(nvholder);
- }
- } // end of pre-connection
-*/
-/*
- { // pre-activation
- String preactivation
- = m_config.getProperty("manager.components.preactivation");
- rtcout.println(Logbuf.TRACE,
- "Components pre-activation: "
- + Arrays.toString(preactivation.split(",")));
- String[] comps = new String[0];
- if ( preactivation == null || preactivation.length() == 0 ) {
- }
- else {
- comps = preactivation.split(",");
- }
-
- for (int ic=0; ic < comps.length; ++ic) {
- comps[ic] = comps[ic].trim();
- RTObject_impl comp = getComponent(comps[ic]);
- if (comp == null) {
- rtcout.println(Logbuf.ERROR, comps[ic] + " not found.");
- continue;
- }
- ExecutionContextListHolder eclistholder
- = new ExecutionContextListHolder();
- eclistholder.value = new ExecutionContext[0];
- eclistholder.value = comp.get_owned_contexts();
- eclistholder.value[0].activate_component(comp.getObjRef());
- }
- } // end of pre-activation
-*/
return true;
}
Modified: branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/TimeValue.java
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/TimeValue.java 2018-01-18 06:00:37 UTC (rev 1102)
+++ branches/RELENG_1_2/OpenRTM-aist-Java/jp.go.aist.rtm.RTC/src/jp/go/aist/rtm/RTC/util/TimeValue.java 2018-01-18 06:14:08 UTC (rev 1103)
@@ -202,7 +202,7 @@
*/
public double toDouble(){
normalize();
- return this.tv_sec + this.tv_usec/ (double)TIMEVALUE_ONE_SECOND_IN_USECS;
+ return (double)this.tv_sec + (double)this.tv_usec/ (double)TIMEVALUE_ONE_SECOND_IN_USECS;
}
/**
More information about the openrtm-commit
mailing list