PathConsumerComp.java
Go to the documentation of this file.
00001 // -*- Java -*-
00009 package jp.go.aist.hrp.simulator;
00010 
00011 import com.generalrobotix.ui.item.GrxPathPlanningAlgorithmItem;
00012 
00013 import jp.go.aist.hrp.simulator.PathPlanner;
00014 import jp.go.aist.rtm.RTC.Manager;
00015 import jp.go.aist.rtm.RTC.ModuleInitProc;
00016 import jp.go.aist.rtm.RTC.RTObject_impl;
00017 import jp.go.aist.rtm.RTC.util.Properties;
00018 
00019 public class PathConsumerComp implements ModuleInitProc {
00020 
00021         PathConsumerImpl impl=null;
00022         public PathPlanner getImpl(){
00023                 return impl.m_PathBase._ptr();
00024         }
00025         
00026         public String getInstanceName(){
00027                 return impl.getInstanceName();
00028         }
00029 
00030         public void setConnectedCallback(GrxPathPlanningAlgorithmItem item){
00031                 impl.setConnectedCallback(item);
00032         }
00033         
00034     public void myModuleInit(Manager mgr) {
00035       Properties prop = new Properties(PathConsumer.component_conf);
00036       mgr.registerFactory(prop, new PathConsumer(), new PathConsumer());
00037 
00038       // Create a component
00039       RTObject_impl comp = mgr.createComponent("PathConsumer");
00040       if( comp==null ) {
00041           System.err.println("Component create failed.");
00042           System.exit(0);
00043       }
00044 
00045       impl = (PathConsumerImpl) comp;
00046 
00047       // Example
00048       // The following procedure is examples how handle RT-Components.
00049       // These should not be in this function.
00050 
00051 //      // Get the component's object reference
00052 //      Manager manager = Manager.instance();
00053 //      RTObject rtobj = null;
00054 //      try {
00055 //          rtobj = RTObjectHelper.narrow(manager.getPOA().servant_to_reference(comp));
00056 //      } catch (ServantNotActive e) {
00057 //          e.printStackTrace();
00058 //      } catch (WrongPolicy e) {
00059 //          e.printStackTrace();
00060 //      }
00061 //
00062 //      // Get the port list of the component
00063 //      PortListHolder portlist = new PortListHolder();
00064 //      portlist.value = rtobj.get_ports();
00065 //
00066 //      // getting port profiles
00067 //      System.out.println( "Number of Ports: " );
00068 //      System.out.println( portlist.value.length );
00069 //      for( int intIdx=0;intIdx<portlist.value.length;++intIdx ) {
00070 //          Port port = portlist.value[intIdx];
00071 //          System.out.println( "Port" + intIdx + " (name): ");
00072 //          System.out.println( port.get_port_profile().name );
00073 //        
00074 //          PortInterfaceProfileListHolder iflist = new PortInterfaceProfileListHolder();
00075 //          iflist.value = port.get_port_profile().interfaces;
00076 //          System.out.println( "---interfaces---" );
00077 //          for( int intIdx2=0;intIdx2<iflist.value.length;++intIdx2 ) {
00078 //              System.out.println( "I/F name: " );
00079 //              System.out.println( iflist.value[intIdx2].instance_name  );
00080 //              System.out.println( "I/F type: " );
00081 //              System.out.println( iflist.value[intIdx2].type_name );
00082 //              if( iflist.value[intIdx2].polarity==PortInterfacePolarity.PROVIDED ) {
00083 //                  System.out.println( "Polarity: PROVIDED" );
00084 //              } else {
00085 //                  System.out.println( "Polarity: REQUIRED" );
00086 //              }
00087 //          }
00088 //          System.out.println( "---properties---" );
00089 //          NVUtil.dump( new NVListHolder(port.get_port_profile().properties) );
00090 //          System.out.println( "----------------" );
00091 //      }
00092     }
00093 /*
00094     public static void main(String[] args) {
00095         // Initialize manager
00096         final Manager manager = Manager.init(args);
00097 
00098         // Set module initialization proceduer
00099         // This procedure will be invoked in activateManager() function.
00100         PathConsumerComp init = new PathConsumerComp();
00101         manager.setModuleInitProc(init);
00102 
00103         // Activate manager and register to naming service
00104         manager.activateManager();
00105 
00106         // run the manager in blocking mode
00107         // runManager(false) is the default.
00108         manager.runManager();
00109 
00110         // If you want to run the manager in non-blocking mode, do like this
00111         // manager.runManager(true);
00112     }
00113 */
00114 
00115         
00116 }


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sun Apr 2 2017 03:43:56