Ejemplo n.º 1
0
def initialize():
	
	BB.Initialize(2100, fmap)
  	BB.Start()
	BB.SetReady(True)
	
	BB.SubscribeToSharedVar('recognizedSpeech',mySubscriptionHandler)
	BB.SubscribeToSharedVar('hypothesizedSpeech',myHandlerHypothesis)
Ejemplo n.º 2
0
def initialize():
	BB.Initialize(2100, fmap)
  	BB.Start()
	
	BB.CreateSharedVar(BB.SharedVarTypes.STRING, 'actuator')
        BB.WriteSharedVar(BB.SharedVarTypes.STRING, 'actuator', 'initial_value')
        BB.SubscribeToSharedVar('actuator',ActuatorHandler, subscriptionType='writeothers', reportType='content')

	BB.SetReady(True)
Ejemplo n.º 3
0
def main():
    BB.Initialize(2003)
    BB.Start()
    BB.SetReady(True)

    BB.SubscribeToSharedVar('test_string', printingFunc)

    print 'Waiting for shared variable updates...'

    BB.Wait()
Ejemplo n.º 4
0
def Initialize():
    BB.Initialize(2030, fmap)
    BB.Start()
    BB.CreateSharedVar(BB.SharedVarTypes.STRING, 'interface')
    BB.CreateSharedVar(BB.SharedVarTypes.STRING, 'smarthause')
    BB.SubscribeToSharedVar('smarthause',
                            LamparaHandler,
                            subscriptionType='writeothers',
                            reportType='content')
    BB.SetReady()
Ejemplo n.º 5
0
    def __init__(self, sharedVarName, bbVarType):
        """Constructor
		Creates a new BB2ROSPublisher Object.
		Receives:
			shredVarName: Name of the shared var to bridge.
			bbVarType: The type of the var.
		"""
        self.sharedVarName = sharedVarName
        try:
            #get the msg data type for ros publisher and subscriber
            self.bbVarType = bbVarType
            self.rosMsgType = bridge_utils.BB2ROS_TYPE_MAP[self.bbVarType][1]
            #create the corresponding ros publisher to update the ROS topic when updated the BB shared var
            self.rosPublisher = rospy.Publisher(self.sharedVarName,
                                                self.rosMsgType,
                                                queue_size=1000)
            rospy.logdebug('ROS publisher "' + str(self.rosMsgType) +
                           '" for "' + str(sharedVarName) + '" created.')
        except:
            rospy.logwarn('No ROS msg type associated with "' +
                          str(bbVarType) +
                          '" BB SV type. Using default association.')
            #get the default msg data type for ros publisher and subscriber
            self.bbVarType = 'default'
            self.rosMsgType = bridge_utils.BB2ROS_TYPE_MAP[self.bbVarType][1]
            #create the corresponding ros publisher to update the ROS topic when updated the BB shared var
            self.rosPublisher = rospy.Publisher(self.sharedVarName,
                                                self.rosMsgType,
                                                queue_size=1000)
            rospy.logdebug('ROS publisher "' + str(self.rosMsgType) +
                           '" for "' + str(sharedVarName) + '" created.')

        #create a subscriber to read the values of the BB shared var
        BB.SubscribeToSharedVar(self.sharedVarName, self.bridge_SV_data)
        #read the value of the shared var from BB and publish it to ROS
        self.pass_var_value()