Revision ba6302b1

View differences:

client/cpp/include/MiddlewareROS.h
50 50
class MiddlewareROS : public Middleware{
51 51
#ifndef ROS_SUPPORT
52 52
public:
53
    MiddlewareRSB(std::string scope){
53
    MiddlewareRSB(std::string scope) : Middleware(scope){
54 54
        printf("> ERROR: hlrc was compiled without ROS middleware support. Please use MiddlewareRSB() instead!\n\n");
55 55
        exit(EXIT_FAILURE);
56 56
    }
client/cpp/include/MiddlewareRSB.h
42 42
class MiddlewareRSB : public Middleware{
43 43
#ifndef RSB_SUPPORT
44 44
public:
45
    MiddlewareRSB(std::string scope){
45
    MiddlewareRSB(std::string scope) : Middleware(scope){
46 46
        printf("> ERROR: hlrc was compiled without RSB middleware support. Please use MiddlewareROS() instead!\n\n");
47 47
        exit(EXIT_FAILURE);
48 48
    }
client/python/hlrc_client/MiddlewareRSB.py
28 28
from Middleware import *
29 29
import errno
30 30

  
31
try:
32
    import rsb
33
    import rsb.converter
34
    import rst
35
    import rstsandbox
36
    from   rst.robot.EmotionState_pb2 import EmotionState
37
    from   rst.robot.Animation_pb2    import Animation
38
    from   rst.robot.GazeTarget_pb2   import GazeTarget
39
    from   rst.robot.MouthTarget_pb2  import MouthTarget
31
import rsb
32
import rsb.converter
33
import rst
34
import rstsandbox
35
from   rst.robot.EmotionState_pb2 import EmotionState
36
from   rst.robot.Animation_pb2    import Animation
37
from   rst.robot.GazeTarget_pb2   import GazeTarget
38
from   rst.robot.MouthTarget_pb2  import MouthTarget
40 39
    
41
except ImportError as exception:
42
    sys.stderr.write("ImportError: {}\n> HINT: try to export PYTHONPATH=$PYTHONPATH:$YOUR_PREFIX/lib/python2.7/site-packages/\n\n".format(exception))
43
    sys.exit(errno.ENOPKG)
40
#except ImportError as exception:
41
#    sys.stderr.write("ImportError: {}\n> HINT: try to export PYTHONPATH=$PYTHONPATH:$YOUR_PREFIX/lib/python2.7/site-packages/\n\n".format(exception))
42
#    sys.exit(errno.ENOPKG)
44 43

  
45 44
class MiddlewareRSB(Middleware):
46 45
	#######################################################################
......
285 284
			return EmotionState().FEAR
286 285
		else:
287 286
			self.logger.error("invalid emotion type %d\n" % (value))
288
			return  EmotionState().NEUTRAL
287
			return  EmotionState().NEUTRAL
client/python/hlrc_client/RobotController.py
26 26
"""
27 27

  
28 28
import logging
29
from MiddlewareRSB import *
29
try:
30
	import rsb
31
except ImportError:
32
	RSB_SUPPORT = False
33
else:
34
	from MiddlewareRSB import *
35
	RSB_SUPPORT = True
36

  
30 37
from MiddlewareROS import *
38
import sys
31 39

  
32 40
class RobotController:
33 41
	def __init__(self, mw_name, scope, loglevel=logging.WARNING):
......
50 58
		
51 59
				
52 60
		if (self.mw.upper() == "RSB"):
53
			self.logger.info("creating new middleware connection via RSB")
54
			self.middleware = MiddlewareRSB(self.scope, self.loglevel)
61
			if (not RSB_SUPPORT):
62
				self.logger.error("ERROR: no RSB support detected")
63
				sys.exit(errno.EINVAL)
64
			else:
65
				self.logger.info("creating new middleware connection via RSB")
66
				self.middleware = MiddlewareRSB(self.scope, self.loglevel)
55 67
		elif (self.mw.upper() == "ROS"):
56 68
			self.logger.info("creating new middleware connection via ROS")
57 69
			self.middleware = MiddlewareROS(self.scope, self.loglevel)
client/python/hlrc_client/__init__.py
1 1
from Middleware import Middleware
2
from MiddlewareRSB import MiddlewareRSB
3
from MiddlewareROS import MiddlewareROS
4 2
from RobotEmotion import RobotEmotion
5 3
from RobotController import RobotController
6 4
from RobotGaze import RobotGaze
client/python/hlrc_client/hlrc_test_gui.py
38 38
from PyQt4 import QtGui, QtCore
39 39
from PyQt4.QtCore import SIGNAL
40 40

  
41
#from hlrc_speak_utterance import hlrc_utterance
42
#from hlrc_play_animation import hlrc_animation
43
#from hlrc_set_emotion import hlrc_emotion
44

  
45 41
class HLRCExample(QtGui.QWidget):
46 42
    
47 43
	def __init__(self, scope, mw):

Also available in: Unified diff