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


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:55