def start_follow(self):
     FunctionUnit.init_node(self)
     #print 'hello 1'
     #print self._receive_topic
     receive_1 = FunctionUnit.create_receive(self, self._receive_topic_follower, Odometry, self.receive_1_cb)
     receive_2 = FunctionUnit.create_receive(self, self._receive_topic_intruder, Odometry, self.receive_2_cb)
     #print 'hello 2'
     FunctionUnit.spin(self)    
Ejemplo n.º 2
0
 def start_switch(self):
     FunctionUnit.init_node(self)
     #print 'run'
     if not(self._topic_1 == None):
         receive_1 = FunctionUnit.create_receive(self, self._topic_1, self._msg_type_1, self.receive_cb_1)
     if not(self._topic_2 == None):
         receive_2 = FunctionUnit.create_receive(self, self._topic_2, self._msg_type_2, self.receive_cb_2)
     receive_3 = FunctionUnit.create_receive(self, self._motive_topic_1, Bool, self.motivational_shared_var_update)
     FunctionUnit.spin(self)
 def start_detect(self):
     FunctionUnit.init_node(self)
     #print 'hello 1'
     #print self._receive_topic
     receive_1 = FunctionUnit.create_receive(self, self._receive_topic, Image, self.receive_1_cb)
     #print 'hello 2'
     FunctionUnit.spin(self)
Ejemplo n.º 4
0
 def add_action(self, sub_action_name, pub_action_name):
     #self._action=action_client
     self._action_mode = True
     self._recieve_action_cancel = FunctionUnit.create_receive(
         self, sub_action_name + '/goal', MoveBaseActionGoal,
         self.receive_cb_goal)
     self._send_cancel = FunctionUnit.create_send(
         self, pub_action_name + '/cancel', GoalID)
 def run(self):
     FunctionUnit.init_node(self)
     thread.start_new_thread(self.timer,())
     heartbeat_receive = FunctionUnit.create_receive(self, self._heartbeat_topic, Heartbeat, self.heartbeat_on_received)
     self._heartbeat_send = FunctionUnit.create_send(self, 'heart_beat', Heartbeat)
     self._switch_send = FunctionUnit.create_send(self, self._switch_topic, Bool)
     #sensory_receive = FunctionUnit.create_receive(self, self._node_name+"/sensory_feedback", Bool, self.sensory_on_received)
     FunctionUnit.spin(self)
Ejemplo n.º 6
0
 def run(self):
     FunctionUnit.init_node(self)
     receive_3 = FunctionUnit.create_receive(
         self, self._motive_topic_1, Bool,
         self.motivational_shared_var_update)
     self.set_switch()
     FunctionUnit.spin(self)
     pass
 def start_detect(self):
     FunctionUnit.init_node(self)
     #print 'hello 1'
     #print self._receive_topic
     receive_1 = FunctionUnit.create_receive(self, self._receive_topic,
                                             Image, self.receive_1_cb)
     #print 'hello 2'
     FunctionUnit.spin(self)
Ejemplo n.º 8
0
 def add_pair(self, input_topic, topic_type, output_topic):
     self._output_list.append(
         FunctionUnit.create_send(self, output_topic, topic_type))
     self._cb_list.append(
         SwitchCallback(self._output_list[self._list_count],
                        self._shared_list))
     self._input_list.append(
         FunctionUnit.create_receive(self, input_topic, topic_type,
                                     self._cb_list[self._list_count]))
     self._list_count += 1
Ejemplo n.º 9
0
 def run(self):
     FunctionUnit.init_node(self)
     self.user()
     self._robot_id=rospy.get_param('~robot_id',0)
     self._behavior_id = rospy.get_param('~behavior_id',0)
     thread.start_new_thread(self.timer,())
     heartbeat_receive = FunctionUnit.create_receive(self, self._heartbeat_topic, Heartbeat, self.heartbeat_on_received)
     self._heartbeat_send = FunctionUnit.create_send(self, '/heart_beat', Heartbeat)
     self._switch_send = FunctionUnit.create_send(self, self._switch_topic, Bool)
     #sensory_receive = FunctionUnit.create_receive(self, self._node_name+"/sensory_feedback", Bool, self.sensory_on_received)
     FunctionUnit.spin(self)
Ejemplo n.º 10
0
 def run(self):
     FunctionUnit.init_node(self)
     self._num = rospy.get_param('~num', 1)
     for i in range(0, self._num):  #bs_id
         self._shared_list.append([])
         for j in range(0, self._num):  #r_id
             self._shared_list[i].append(False)
     receive_3 = FunctionUnit.create_receive(
         self, '/heart_beat', Bool, self.motivational_shared_var_update)
     self.set_type(Twist)
     for i in range(0, self._num):
         self._output_list.append(
             FunctionUnit.create_send(self, 'output_' + str(i), self._type))
     for i in range(0, self._num):
         self._cb_list.append(
             MultiSwitchCallback(self._output_list, self._shared_list,
                                 self._num, i))
         self._input_list.append(
             FunctionUnit.create_receive(self, 'input_' + str(i),
                                         self._type, self._cb_list[i]))
     FunctionUnit.spin(self)
     pass
Ejemplo n.º 11
0
 def add_action(self,sub_action_name,pub_action_name):
     #self._action=action_client
     self._action_mode=True
     self._recieve_action_cancel = FunctionUnit.create_receive(self, sub_action_name + '/goal', MoveBaseActionGoal, self.receive_cb_goal)
     self._send_cancel= FunctionUnit.create_send(self, pub_action_name+'/cancel', GoalID)
 def set_sensor(self,sensor_topic):
       sensory_receive = FunctionUnit.create_receive(self, sensor_topic, Bool, self.sensory_on_received)
 def add_pair(self,input_topic,topic_type,output_topic):
     self._output_list.append(FunctionUnit.create_send(self, output_topic, topic_type))
     self._cb_list.append(SwitchCallback(self._output_list[self._list_count],self._shared_list))
     self._input_list.append(FunctionUnit.create_receive(self, input_topic, topic_type, self._cb_list[self._list_count]))    
     self._list_count += 1
Ejemplo n.º 14
0
 def run(self):
     FunctionUnit.init_node(self)
     receive_3 = FunctionUnit.create_receive(self, self._motive_topic_1, Bool, self.motivational_shared_var_update)
     self.set_switch()
     FunctionUnit.spin(self)
     pass
Ejemplo n.º 15
0
 def user(self):  #user defined inc(fast)
     self._fast_receive = FunctionUnit.create_receive(
         self, 'inc_input', Twist, self.fast_on_received)
     self._fast = 0
Ejemplo n.º 16
0
 def user(self):#user defined inc(fast)
     self._fast_receive = FunctionUnit.create_receive(self, 'inc_input', Twist, self.fast_on_received)
     self._fast = 0