Revision 11b8a2b5
| client/python/hlrc_client/MiddlewareRSB.py | ||
|---|---|---|
| 98 | 98 |
rsb_em.emotion = self.convert_emotiontype_to_rsbval(emotion.value) |
| 99 | 99 |
rsb_em.duration = int(emotion.time_ms) |
| 100 | 100 |
|
| 101 |
with rsb.createRemoteServer(self.base_scope + '/set') as server: |
|
| 101 |
with rsb.createRemoteServer(self.base_scope + '/HeadAnimationset') as server:
|
|
| 102 | 102 |
self.logger.debug("calling the emotion rpc (%s)..." % ("BLOCKING" if blocking else "NON-BLOCKING"))
|
| 103 | 103 |
|
| 104 | 104 |
if (blocking): |
| ... | ... | |
| 118 | 118 |
#print '> server reply: "%s"' % future.get(timeout = 10); |
| 119 | 119 |
self.logger.debug("emotion rpc done")
|
| 120 | 120 |
|
| 121 |
def publish_head_HeadAnimation(self, HeadAnimation, blocking):
|
|
| 121 |
def publish_head_animation(self, animation, blocking):
|
|
| 122 | 122 |
"""publish an head HeadAnimation via mw |
| 123 | 123 |
:param HeadAnimation: HeadAnimation to set |
| 124 | 124 |
:param blocking: True if this call should block until execution finished on robot |
| ... | ... | |
| 130 | 130 |
rsb_ani = HeadAnimation() |
| 131 | 131 |
|
| 132 | 132 |
#select ani |
| 133 |
rsb_ani.target = self.convert_HeadAnimationtype_to_rsbval(HeadAnimation.value)
|
|
| 134 |
rsb_ani.repetitions = HeadAnimation.repetitions
|
|
| 135 |
rsb_ani.duration_each = HeadAnimation.time_ms
|
|
| 136 |
rsb_ani.scale = HeadAnimation.scale
|
|
| 133 |
rsb_ani.animation = self.convert_HeadAnimationtype_to_rsbval(animation.value)
|
|
| 134 |
rsb_ani.repetitions = animation.repetitions
|
|
| 135 |
rsb_ani.duration_each = animation.time_ms
|
|
| 136 |
rsb_ani.emphasis_scale = animation.scale
|
|
| 137 | 137 |
|
| 138 | 138 |
if blocking: |
| 139 | 139 |
#blocking: |
| ... | ... | |
| 214 | 214 |
# NOTE: this convertion is important as the actual integer values of |
| 215 | 215 |
# thy python api and the protobuf might be different |
| 216 | 216 |
|
| 217 |
if (value == RobotHeadAnimation.IDLE):
|
|
| 217 |
if value == HeadAnimation.IDLE:
|
|
| 218 | 218 |
return HeadAnimation().IDLE |
| 219 |
elif (value == RobotHeadAnimation.HEAD_NOD):
|
|
| 219 |
elif value == HeadAnimation.HEAD_NOD:
|
|
| 220 | 220 |
return HeadAnimation().HEAD_NOD |
| 221 |
elif (value == RobotHeadAnimation.HEAD_SHAKE):
|
|
| 221 |
elif (value == HeadAnimation.HEAD_SHAKE): |
|
| 222 | 222 |
return HeadAnimation().HEAD_SHAKE |
| 223 |
elif (value == RobotHeadAnimation.EYEBLINK_L):
|
|
| 224 |
return HeadAnimation().EYEBLINK_L |
|
| 225 |
elif (value == RobotHeadAnimation.EYEBLINK_R):
|
|
| 226 |
return HeadAnimation().EYEBLINK_R |
|
| 227 |
elif (value == RobotHeadAnimation.EYEBLINK_BOTH):
|
|
| 223 |
elif (value == HeadAnimation.EYEBLINK_LEFT):
|
|
| 224 |
return HeadAnimation().EYEBLINK_LEFT
|
|
| 225 |
elif (value == HeadAnimation.EYEBLINK_RIGHT):
|
|
| 226 |
return HeadAnimation().EYEBLINK_RIGHT
|
|
| 227 |
elif (value == HeadAnimation.EYEBLINK_BOTH): |
|
| 228 | 228 |
return HeadAnimation().EYEBLINK_BOTH |
| 229 |
elif (value == RobotHeadAnimation.EYEBROWS_RAISE):
|
|
| 229 |
elif (value == HeadAnimation.EYEBROWS_RAISE): |
|
| 230 | 230 |
return HeadAnimation().EYEBROWS_RAISE |
| 231 |
elif (value == RobotHeadAnimation.EYEBROWS_LOWER):
|
|
| 231 |
elif (value == HeadAnimation.EYEBROWS_LOWER): |
|
| 232 | 232 |
return HeadAnimation().EYEBROWS_LOWER |
| 233 | 233 |
else: |
| 234 | 234 |
self.logger.error("invalid HeadAnimation type %d\n" % (value))
|
Also available in: Unified diff