def __init__(self, node_name, receive_topic, send_topic, virtual_off=None):
     FunctionUnit.__init__(self, node_name)
     self._receive_topic = receive_topic
     self._send_topic = send_topic
     self._virtual = virtual_off
     self.br = CvBridge()
     self._virtual_send = FunctionUnit.create_send(self, virtual_off, Bool)
Пример #2
0
    def __init__(self, node_name, topic_1 = None, msg_type_1 = None, send_topic_1 = None, topic_2 = None, msg_type_2 = None, send_topic_2 = None):
        
        self._motive_topic_1=node_name+'/activate'
        if not(topic_1 == None) and not(msg_type_1 == None):
            self._topic_1 = topic_1
            self._msg_type_1 = msg_type_1
            self._send_topic_1=send_topic_1
            self.send_1 = FunctionUnit.create_send(self, self._send_topic_1, self._msg_type_1)
        else:
            self._topic_1 = None
            self._msg_type_1 = None            

        if not(topic_2 == None) and not(msg_type_2 == None):
            self._topic_2 = topic_2
            self._msg_type_2 = msg_type_2
            self._send_topic_2=send_topic_2
            self.send_2 = FunctionUnit.create_send(self, self._send_topic_2, self._msg_type_2)
        else:
            self._topic_2 = None
        
        #print 'init'
        FunctionUnit.__init__(self, node_name)
        self.motivational_shared_var = False #'True' means the behavior set is activated
        self._action_mode = False
        self._last_goal = GoalID()
 def __init__(self, node_name, receive_topic, send_topic, virtual_off= None):
     FunctionUnit.__init__(self, node_name)    
     self._receive_topic = receive_topic
     self._send_topic = send_topic
     self._virtual = virtual_off
     self.br = CvBridge()
     self._virtual_send = FunctionUnit.create_send(self, virtual_off, Bool)
    def __init__(self, node_name, robot_id, behavior_id, switch_topic, heartbeat_topic = None):
        if heartbeat_topic == None:
            self._heartbeat_topic = 'heart_beat'
         #param
        self._fast = 20#fast rate, constant for now
        self._slow = 3#slow rate,constant for now
        self._comm_influence_time=10
        self._comm_keep_time=20
        self._reset_influence_time=10
        self._acquienscence_time_0=20#if other robot is runing the same behavior
        self._acquienscence_time_1=60
        self._acquienscence_influence_time=5
        self._robot_id=robot_id#i
        self._behavior_id=behavior_id#j
        self._switch_topic=switch_topic
        self._broadcast_rate=5
        self._random_inc = False

        self._node_name=node_name
        FunctionUnit.__init__(self, node_name)
        self._threshold_of_activation = 100#The initial value of threshold_of_activation is 100.
        self._sensory_feedback = 0#If the sensory information is valid, the sensory feedback is true, the value is 1 or 0.
        self._comm_recieved = [[0 for col in range(1)] for row in range(10)]#_comm_received,row=k,col=t
        self._activity_suppression = 1        
        self._impatience = self._fast
        self._impatience_reset = 1#if this robot is running an other behavior,reset=0
        self._acquiescence = 1#if this behavior has run too long, acquiescence=0
        self._m = 0#final score
        self._time = 0
        self._active=0#bool, active=0 else=1
        self._active_time = 0#when this behavior is active
Пример #5
0
    def __init__(self, node_name):
        self._input_list = []
        self._output_list = []
        self._cb_list = []
        self._shared_list = []

        FunctionUnit.__init__(self, node_name)
        self._action_mode = False
        self._last_goal = GoalID()
 def __init__(self, node_name, pose_0, pose_1, pose_2, pose_3, topic, wait_time):
     FunctionUnit.__init__(self, node_name)
     #self._node_name = node_name
     self._pose_0 = pose_0
     self._pose_1 = pose_1
     self._pose_2 = pose_2
     self._pose_3 = pose_3
     self._topic = topic
     self._wait_time = wait_time
 def __init__(self, node_name, pose_0, pose_1, pose_2, pose_3, topic,
              wait_time):
     FunctionUnit.__init__(self, node_name)
     #self._node_name = node_name
     self._pose_0 = pose_0
     self._pose_1 = pose_1
     self._pose_2 = pose_2
     self._pose_3 = pose_3
     self._topic = topic
     self._wait_time = wait_time
Пример #8
0
    def __init__(self, node_name):
        self._input_list=[]
        self._output_list=[]
        self._cb_list=[]
        self._shared_list=[]
        self._shared_list.append(False)
        self._list_count = 0
        self._motive_topic_1='activate'

        FunctionUnit.__init__(self, node_name)
        self._action_mode = False
        self._last_goal = GoalID()
 def __init__(self, node_name, receive_topic_follower, receive_topic_intruder, send_topic):
     FunctionUnit.__init__(self, node_name)    
     self._receive_topic_follower = receive_topic_follower
     self._receive_topic_intruder = receive_topic_intruder
     self.follower_pose_x = 0.0
     self.follower_pose_y = 0.0
     self.intruder_pose_x = 0.0
     self.intruder_pose_y = 0.0 
     self.follow_distance = 0.5 # The follower will be away from the intruder according to this distance      
     self.linear_velocity = 0.3
     self.angular_velocity = 0.5
     self.send = FunctionUnit.create_send(self, send_topic, Twist)
Пример #10
0
    def __init__(self, node_name):
        self._input_list = []
        self._output_list = []
        self._cb_list = []
        self._shared_list = []
        self._shared_list.append(False)
        self._list_count = 0
        self._motive_topic_1 = 'activate'

        FunctionUnit.__init__(self, node_name)
        self._action_mode = False
        self._last_goal = GoalID()
 def __init__(self, node_name, robot_id, behavior_id, switch_topic, filename = None,heartbeat_topic = None):
     if heartbeat_topic == None:
         self._heartbeat_topic = 'heart_beat'
      #param
     self._fast = 20#fast rate, constant for now
     self._slow = 3#slow rate,constant for now
     self._comm_influence_time=10
     self._comm_keep_time=20
     self._reset_influence_time=10
     self._acquienscence_time_0=20#if other robot is runing the same behavior
     self._acquienscence_time_1=60
     self._acquienscence_influence_time=5
     self._robot_id=robot_id#i
     self._behavior_id=behavior_id#j
     self._switch_topic=switch_topic
     self._broadcast_rate=5
     self._random_inc = False
     
     if(filename !=None):
         self._debug_mode = True
     else:
         self._debug_mode = False
     if(self._debug_mode == True):
         print "Debug"
         self._f = file(filename,'w+')
         self._f.close()
         self._filename=filename
     self._node_name=node_name
     FunctionUnit.__init__(self, node_name)
     self._threshold_of_activation = 100#The initial value of threshold_of_activation is 100.
     self._sensory_feedback = 0#If the sensory information is valid, the sensory feedback is true, the value is 1 or 0.
     self._comm_recieved = [[0 for col in range(1)] for row in range(10)]#_comm_received,row=k,col=t
     self._activity_suppression = 1        
     self._impatience = self._fast
     self._impatience_reset = 1#if this robot is running an other behavior,reset=0
     self._acquiescence = 1#if this behavior has run too long, acquiescence=0
     self._m = 0#final score
     self._time = 0
     self._active=0#bool, active=0 else=1
     self._active_time = 0#when this behavior is active