Revision 73f57e84
client/python/hlrc_client/MiddlewareRSB.py | ||
---|---|---|
30 | 30 |
|
31 | 31 |
import rsb |
32 | 32 |
import rsb.converter |
33 |
import rst |
|
33 |
# import rst
|
|
34 | 34 |
|
35 | 35 |
from rstsandbox.animation.EmotionExpression_pb2 import EmotionExpression |
36 | 36 |
from rstsandbox.animation.HeadAnimation_pb2 import HeadAnimation |
... | ... | |
46 | 46 |
""" |
47 | 47 |
# init base settings |
48 | 48 |
Middleware.__init__(self, scope, loglevel) |
49 |
self.EmotionExpression_converter = None |
|
50 |
self.HeadAnimation_converter = None |
|
51 |
self.BinocularHeadGaze_converter = None |
|
52 |
self.server = None |
|
53 |
|
|
49 | 54 |
#call mw init |
50 | 55 |
self.init_middleware() |
51 | 56 |
|
... | ... | |
136 | 141 |
rsb_ani.duration_each = HeadAnimation.time_ms |
137 | 142 |
rsb_ani.scale = HeadAnimation.scale |
138 | 143 |
|
139 |
if (blocking):
|
|
144 |
if blocking:
|
|
140 | 145 |
#blocking: |
141 | 146 |
result = self.server.HeadAnimation(rsb_ani) |
142 | 147 |
self.logger.debug("server reply: '%s'" % result) |
... | ... | |
161 | 166 |
self.logger.debug("calling the gaze rpc (%s)..." % ("BLOCKING" if blocking else "NON-BLOCKING")) |
162 | 167 |
|
163 | 168 |
# create gaze target & fill it with values: |
164 |
rsb_gaze = BinocularHeadGaze()
|
|
169 |
hg = BinocularHeadGaze()
|
|
165 | 170 |
|
166 |
#fill proto |
|
167 | 171 |
t = SphericalDirectionFloat() |
168 | 172 |
t.elevation = gaze.tilt |
169 | 173 |
t.azimuth = gaze.pan |
170 |
rsb_gaze.target = t
|
|
174 |
hg.target = t
|
|
171 | 175 |
|
172 |
rsb_gaze.eye_vergence = gaze.vergence
|
|
176 |
hg.eye_vergence = gaze.vergence
|
|
173 | 177 |
|
174 | 178 |
o = SphericalDirectionFloat() |
175 | 179 |
o.elevation = gaze.tilt_offset |
176 | 180 |
o.azimuth = gaze.pan_offset |
181 |
hg.offset = o |
|
177 | 182 |
|
178 |
rsb_gaze.offset = o |
|
179 |
|
|
180 |
if (blocking): |
|
183 |
if blocking: |
|
181 | 184 |
# blocking: |
182 |
result = self.server.gaze(rsb_gaze)
|
|
185 |
result = self.server.gaze(hg)
|
|
183 | 186 |
self.logger.debug("server reply: '%s'" % result) |
184 | 187 |
else: |
185 |
future = self.server.gaze.async(rsb_gaze)
|
|
188 |
future = self.server.gaze.async(hg)
|
|
186 | 189 |
# we can block here for a incoming result with a timeout in s |
187 | 190 |
#print '> server reply: "%s"' % future.get(timeout = 10); |
188 | 191 |
|
Also available in: Unified diff