Project

General

Profile

Actions

バグ #3704

open

ECにアタッチされたRTCが即座に追加されないためACTIVATE時に適切に遷移しない問題

Added by n-miyamoto over 8 years ago. Updated over 7 years ago.

Status:
担当
Priority:
通常
Assignee:
katami
Start date:
11/07/2016
Due date:
% Done:

100%

Estimated time:

Description

#3697 と同じ

Actions #1

Updated by katami over 7 years ago

  • Status changed from 新規 to 担当

動作確認

examples/Composite のSensorCompを利用して、初期化関数を以下のように変更

  • ControllerとMotorはrtc.confで.soをロードしておく。
  • 以下のように、SensorのECを取り出し、Controller, Motor にアタッチ
  • Motor, Controller, Sensor の順で activate した。
    public void myModuleInit(Manager mgr) {
      Properties prop = new Properties(Sensor.component_conf);
      mgr.registerFactory(prop, new Sensor(), new Sensor());

      System.out.println("1");
      // Create a component
      RTObject_impl scomp = mgr.createComponent("Sensor");
      if( scomp==null ) {
          System.err.println("Component create failed.");
          System.exit(0);
      }
      System.out.println("2");
      RTC.RTObject srtc = scomp.getObjRef();

      System.out.println("3");
      // Create a component
      RTObject_impl ccomp = mgr.createComponent("Controller");
      if( ccomp==null ) {
          System.err.println("Component create failed.");
          System.exit(0);
      }
      System.out.println("4");
      RTC.RTObject crtc = ccomp.getObjRef();

      System.out.println("5");
      // Create a component
      RTObject_impl mcomp = mgr.createComponent("Motor");
      if( mcomp==null ) {
          System.err.println("Component create failed.");
          System.exit(0);
      }
      System.out.println("6");
      RTC.RTObject mrtc = mcomp.getObjRef();

      System.out.println("7");
      ExecutionContextListHolder eclist = new ExecutionContextListHolder();
      eclist.value =  srtc.get_owned_contexts();

      System.out.println("8");
      eclist.value[0].add_component(crtc);
      System.out.println("9");
      eclist.value[0].add_component(mrtc);
      System.out.println("10");

      eclist.value[0].activate_component(mrtc);
      System.out.println("11");
      eclist.value[0].activate_component(crtc);
      System.out.println("12");
      eclist.value[0].activate_component(srtc);
      System.out.println("13");
    }

./Sensor.sh -o exec_cxt.periodic.rate:1 
1
2
3
4
5
6
7
8
9
10
11
12
13
Sensor Activated
Controller Activated
Motor Activated

$ rtls localhost/ -l
Active  2/0  1/0  1/0  0/0  Motor0.rtc
Active  2/0  1/0  1/0  0/0  Sensor0.rtc
Active  2/0  1/0  1/0  0/0  Controller0.rtc
-       -    -    -    -    ubuntu.host_cxt
Actions #2

Updated by katami over 7 years ago

  • Assignee set to katami
  • Target version set to RELEASE_1_2_0
  • % Done changed from 0 to 100
Actions #3

Updated by katami over 7 years ago

テスト用のプログラムを変更して再度確認

    public void myModuleInit(Manager mgr) {
      Properties prop = new Properties(Sensor.component_conf);
      mgr.registerFactory(prop, new Sensor(), new Sensor());

      System.out.println("1");
      // Create a component
      RTObject_impl scomp = mgr.createComponent("Sensor");
      if( scomp==null ) {
          System.err.println("Component create failed.");
          System.exit(0);
      }
      System.out.println("2");
      RTC.RTObject srtc = scomp.getObjRef();

      System.out.println("3");
      // Create a component
      RTObject_impl ccomp = mgr.createComponent("Controller");
      if( ccomp==null ) {
          System.err.println("Component create failed.");
          System.exit(0);
      }
      System.out.println("4");
      RTC.RTObject crtc = ccomp.getObjRef();

      System.out.println("5");
      // Create a component
      RTObject_impl mcomp = mgr.createComponent("Motor");
      if( mcomp==null ) {
          System.err.println("Component create failed.");
          System.exit(0);
      }
      System.out.println("6");
      RTC.RTObject mrtc = mcomp.getObjRef();

      System.out.println("7");
      ExecutionContextListHolder eclist = new ExecutionContextListHolder();
      eclist.value =  srtc.get_owned_contexts();

      System.out.println("8");
      eclist.value[0].add_component(crtc);
      System.out.println("9");
      eclist.value[0].add_component(mrtc);
      System.out.println("10");

      eclist.value[0].activate_component(mrtc);
      System.out.println("11");
      eclist.value[0].activate_component(crtc);
      System.out.println("12");
      eclist.value[0].activate_component(srtc);
      System.out.println("13");

      try{
          Thread.sleep(3000);
      }catch(InterruptedException e){}

      System.out.println("14");
      LifeCycleState state;
      state = eclist.value[0].get_component_state(crtc);
      if (state == LifeCycleState.ACTIVE_STATE) {
          System.out.println("Controller is ACTIVE_STATE");
      }
      System.out.println("15");
      state = eclist.value[0].get_component_state(mrtc);
      if (state == LifeCycleState.ACTIVE_STATE) {
          System.out.println("Motor is ACTIVE_STATE");
      }
      System.out.println("16");
    }

1
2
3
4
5
6
7
8
9
10
11
12
13
Sensor Activated ec_id=0
Controller Activated ec_id=1000
Motor Activated ec_id=1000
14
Controller is ACTIVE_STATE
15
Motor is ACTIVE_STATE
16

openrtp(RTSE)では、実行コンテキストビューで実行コンテキストをparticipatingに切り替えて、ACTIVEであることを確認した。
Actions

Also available in: Atom PDF