LeggedRobot_idl_example.py
1 |
#!/usr/bin/env python
|
---|---|
2 |
# -*- coding: utf-8 -*-
|
3 |
# -*- Python -*-
|
4 |
|
5 |
"""
|
6 |
@file LeggedRobot_idl_examplefile.py
|
7 |
@brief Python example implementations generated from LeggedRobot.idl
|
8 |
@date $Date$
|
9 |
|
10 |
@author 宮本 信彦 n-miyamoto@aist.go.jp
|
11 |
産業技術総合研究所 ロボットイノベーション研究センター
|
12 |
ロボットソフトウエアプラットフォーム研究チーム
|
13 |
"""
|
14 |
|
15 |
import omniORB |
16 |
from omniORB import CORBA, PortableServer |
17 |
import OpenHRP, OpenHRP__POAimport OpenHRP, OpenHRP__POAimport OpenHRP, OpenHRP__POAimport OpenHRP, OpenHRP__POAimport OpenHRP, OpenHRP__POAimport RTC, RTC__POAimport RTC, RTC__POA |
18 |
|
19 |
|
20 |
class ServerObject_i (OpenHRP__POA.ServerObject): |
21 |
"""
|
22 |
@class ServerObject_i
|
23 |
Example class implementing IDL interface OpenHRP.ServerObject
|
24 |
"""
|
25 |
|
26 |
def __init__(self): |
27 |
"""
|
28 |
@brief standard constructor
|
29 |
Initialise member variables here
|
30 |
"""
|
31 |
pass
|
32 |
|
33 |
# void shutdown()
|
34 |
def shutdown(self): |
35 |
raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO) |
36 |
# *** Implement me
|
37 |
# Must return: None
|
38 |
|
39 |
|
40 |
|
41 |
class ShapeSetInfo_i (OpenHRP__POA.ShapeSetInfo): |
42 |
"""
|
43 |
@class ShapeSetInfo_i
|
44 |
Example class implementing IDL interface OpenHRP.ShapeSetInfo
|
45 |
"""
|
46 |
|
47 |
def __init__(self): |
48 |
"""
|
49 |
@brief standard constructor
|
50 |
Initialise member variables here
|
51 |
"""
|
52 |
pass
|
53 |
|
54 |
|
55 |
|
56 |
class BodyInfo_i (OpenHRP__POA.BodyInfo): |
57 |
"""
|
58 |
@class BodyInfo_i
|
59 |
Example class implementing IDL interface OpenHRP.BodyInfo
|
60 |
"""
|
61 |
|
62 |
def __init__(self): |
63 |
"""
|
64 |
@brief standard constructor
|
65 |
Initialise member variables here
|
66 |
"""
|
67 |
pass
|
68 |
|
69 |
|
70 |
|
71 |
class SceneInfo_i (OpenHRP__POA.SceneInfo): |
72 |
"""
|
73 |
@class SceneInfo_i
|
74 |
Example class implementing IDL interface OpenHRP.SceneInfo
|
75 |
"""
|
76 |
|
77 |
def __init__(self): |
78 |
"""
|
79 |
@brief standard constructor
|
80 |
Initialise member variables here
|
81 |
"""
|
82 |
pass
|
83 |
|
84 |
|
85 |
|
86 |
class ModelLoader_i (OpenHRP__POA.ModelLoader): |
87 |
"""
|
88 |
@class ModelLoader_i
|
89 |
Example class implementing IDL interface OpenHRP.ModelLoader
|
90 |
"""
|
91 |
|
92 |
def __init__(self): |
93 |
"""
|
94 |
@brief standard constructor
|
95 |
Initialise member variables here
|
96 |
"""
|
97 |
pass
|
98 |
|
99 |
# BodyInfo getBodyInfo(in string url)
|
100 |
def getBodyInfo(self, url): |
101 |
raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO) |
102 |
# *** Implement me
|
103 |
# Must return: result
|
104 |
|
105 |
# BodyInfo getBodyInfoEx(in string url, in ModelLoadOption option)
|
106 |
def getBodyInfoEx(self, url, option): |
107 |
raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO) |
108 |
# *** Implement me
|
109 |
# Must return: result
|
110 |
|
111 |
# BodyInfo loadBodyInfo(in string url)
|
112 |
def loadBodyInfo(self, url): |
113 |
raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO) |
114 |
# *** Implement me
|
115 |
# Must return: result
|
116 |
|
117 |
# BodyInfo loadBodyInfoEx(in string url, in ModelLoadOption option)
|
118 |
def loadBodyInfoEx(self, url, option): |
119 |
raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO) |
120 |
# *** Implement me
|
121 |
# Must return: result
|
122 |
|
123 |
# SceneInfo loadSceneInfo(in string url)
|
124 |
def loadSceneInfo(self, url): |
125 |
raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO) |
126 |
# *** Implement me
|
127 |
# Must return: result
|
128 |
|
129 |
# void clearData()
|
130 |
def clearData(self): |
131 |
raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO) |
132 |
# *** Implement me
|
133 |
# Must return: None
|
134 |
|
135 |
|
136 |
|
137 |
class LeggedRobotCommonInterface_Servo_i (RTC__POA.LeggedRobotCommonInterface_Servo): |
138 |
"""
|
139 |
@class LeggedRobotCommonInterface_Servo_i
|
140 |
Example class implementing IDL interface RTC.LeggedRobotCommonInterface_Servo
|
141 |
"""
|
142 |
|
143 |
def __init__(self): |
144 |
"""
|
145 |
@brief standard constructor
|
146 |
Initialise member variables here
|
147 |
"""
|
148 |
pass
|
149 |
|
150 |
# boolean setSoftLimitJoint(in JointPos pos)
|
151 |
def setSoftLimitJoint(self, pos): |
152 |
raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO) |
153 |
# *** Implement me
|
154 |
# Must return: result
|
155 |
|
156 |
# JointPos getSoftLimitjoint()
|
157 |
def getSoftLimitjoint(self): |
158 |
raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO) |
159 |
# *** Implement me
|
160 |
# Must return: result
|
161 |
|
162 |
# boolean servoOFF()
|
163 |
def servoOFF(self): |
164 |
raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO) |
165 |
# *** Implement me
|
166 |
# Must return: result
|
167 |
|
168 |
# boolean servoON()
|
169 |
def servoON(self): |
170 |
raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO) |
171 |
# *** Implement me
|
172 |
# Must return: result
|
173 |
|
174 |
|
175 |
|
176 |
class LeggedRobotCommonInterface_Robot_i (RTC__POA.LeggedRobotCommonInterface_Robot): |
177 |
"""
|
178 |
@class LeggedRobotCommonInterface_Robot_i
|
179 |
Example class implementing IDL interface RTC.LeggedRobotCommonInterface_Robot
|
180 |
"""
|
181 |
|
182 |
def __init__(self): |
183 |
"""
|
184 |
@brief standard constructor
|
185 |
Initialise member variables here
|
186 |
"""
|
187 |
pass
|
188 |
|
189 |
# RobotInfo getRobotInfo()
|
190 |
def getRobotInfo(self): |
191 |
raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO) |
192 |
# *** Implement me
|
193 |
# Must return: result
|
194 |
|
195 |
# LegList getFeedbackPos()
|
196 |
def getFeedbackPos(self): |
197 |
raise CORBA.NO_IMPLEMENT(0, CORBA.COMPLETED_NO) |
198 |
# *** Implement me
|
199 |
# Must return: result
|
200 |
|
201 |
|
202 |
if __name__ == "__main__": |
203 |
import sys |
204 |
|
205 |
# Initialise the ORB
|
206 |
orb = CORBA.ORB_init(sys.argv) |
207 |
|
208 |
# As an example, we activate an object in the Root POA
|
209 |
poa = orb.resolve_initial_references("RootPOA")
|
210 |
|
211 |
# Create an instance of a servant class
|
212 |
servant = ServerObject_i() |
213 |
|
214 |
# Activate it in the Root POA
|
215 |
poa.activate_object(servant) |
216 |
|
217 |
# Get the object reference to the object
|
218 |
objref = servant._this() |
219 |
|
220 |
# Print a stringified IOR for it
|
221 |
print orb.object_to_string(objref)
|
222 |
|
223 |
# Activate the Root POA's manager
|
224 |
poa._get_the_POAManager().activate() |
225 |
|
226 |
# Run the ORB, blocking this thread
|
227 |
orb.run() |
228 |
|