JoystickComp.java
Go to the documentation of this file.
1 // -*- Java -*-
10 package jp.go.aist.hrp.joystick.rtc;
11 
12 import jp.go.aist.rtm.RTC.Manager;
13 import jp.go.aist.rtm.RTC.ModuleInitProc;
14 import jp.go.aist.rtm.RTC.RTObject_impl;
15 import jp.go.aist.rtm.RTC.util.Properties;
16 
22 public class JoystickComp implements ModuleInitProc {
23 
24  public void myModuleInit(Manager mgr) {
26  mgr.registerFactory(prop, new Joystick(), new Joystick());
27 
28  // Create a component
29  RTObject_impl comp = mgr.createComponent("Joystick");
30  if( comp==null ) {
31  System.err.println("Component create failed.");
32  System.exit(0);
33  }
34 
35  // Example
36  // The following procedure is examples how handle RT-Components.
37  // These should not be in this function.
38 
39 // // Get the component's object reference
40 // Manager manager = Manager.instance();
41 // RTObject rtobj = null;
42 // try {
43 // rtobj = RTObjectHelper.narrow(manager.getPOA().servant_to_reference(comp));
44 // } catch (ServantNotActive e) {
45 // e.printStackTrace();
46 // } catch (WrongPolicy e) {
47 // e.printStackTrace();
48 // }
49 //
50 // // Get the port list of the component
51 // PortListHolder portlist = new PortListHolder();
52 // portlist.value = rtobj.get_ports();
53 //
54 // // getting port profiles
55 // System.out.println( "Number of Ports: " );
56 // System.out.println( portlist.value.length );
57 // for( int intIdx=0;intIdx<portlist.value.length;++intIdx ) {
58 // Port port = portlist.value[intIdx];
59 // System.out.println( "Port" + intIdx + " (name): ");
60 // System.out.println( port.get_port_profile().name );
61 //
62 // PortInterfaceProfileListHolder iflist = new PortInterfaceProfileListHolder();
63 // iflist.value = port.get_port_profile().interfaces;
64 // System.out.println( "---interfaces---" );
65 // for( int intIdx2=0;intIdx2<iflist.value.length;++intIdx2 ) {
66 // System.out.println( "I/F name: " );
67 // System.out.println( iflist.value[intIdx2].instance_name );
68 // System.out.println( "I/F type: " );
69 // System.out.println( iflist.value[intIdx2].type_name );
70 // if( iflist.value[intIdx2].polarity==PortInterfacePolarity.PROVIDED ) {
71 // System.out.println( "Polarity: PROVIDED" );
72 // } else {
73 // System.out.println( "Polarity: REQUIRED" );
74 // }
75 // }
76 // System.out.println( "---properties---" );
77 // NVUtil.dump( new NVListHolder(port.get_port_profile().properties) );
78 // System.out.println( "----------------" );
79 // }
80  }
81 
82 /*
83  public static void execMain() {
84  // Initialize manager
85  final Manager manager = Manager.instance();
86 
87  // Set module initialization proceduer
88  // This procedure will be invoked in activateManager() function.
89 // TkJoystickComp init = new TkJoystickComp();
90 // manager.setModuleInitProc(init);
91  manager.createComponent("TkJoyStick");
92 
93  // Activate manager and register to naming service
94  manager.activateManager();
95 
96  // run the manager in blocking mode
97  // runManager(false) is the default.
98  //manager.runManager();
99 
100  // If you want to run the manager in non-blocking mode, do like this
101  manager.runManager(true);
102  }
103 */
104 
105 }
void(* ModuleInitProc)(Manager *manager)
#define null
our own NULL pointer
Definition: IceTypes.h:57
Standalone component Class.
prop
Sample component for MobileRobotCanvas component.
Definition: Joystick.java:22


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat Apr 13 2019 02:14:23