6 import subprocess 
as sp
    11 from geometry_msgs.msg 
import Vector3
    18 Welcome to the commander of this multi-robot system.    19     Press number 1-5 to switch the robot.    20     Press 9 to select all and 0 to select none.    22     Press 'arrow keys' to move the robot.    23     Press 'space bar' to stop the robot.    24     Press 'm' to start a multi-robot algorithm action.    25     Press 's' to stop the action.    34         self.
_movement_list = {
'\x1b[A':(1,0), 
'\x1b[B':(-1,0), 
'\x1b[C':(0,-1), 
'\x1b[D':(0,1), 
' ':(0,0)}
    40         self.
_robot_position = [0, [0,0], [0,0], [0,0], [0,0], [0,0]]
    47         """ get one character from the terminal """    48         fd = sys.stdin.fileno()  
    49         old_settings = termios.tcgetattr(fd)  
    52             key = sys.stdin.read(1)  
    54             termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) 
    61             old_tty = commands.getoutput(
"ls /dev/pts").split(
'\n')
    62             self.
xterm = sp.Popen([
"xterm"])
    64             new_tty = commands.getoutput(
"ls /dev/pts").split(
'\n')
    65             num = list(set(new_tty).difference(set(old_tty)))[0]
    67             self.
fd = open(
"/dev/pts/"+str(num), 
'w')
    78         """ get commmands from the keyboard and send to robots """    79         pub_vel_1 = rospy.Publisher(
'/robot1/cmd_vel_hp', Vector3, queue_size=1)
    80         pub_vel_2 = rospy.Publisher(
'/robot2/cmd_vel_hp', Vector3, queue_size=1)
    81         pub_vel_3 = rospy.Publisher(
'/robot3/cmd_vel_hp', Vector3, queue_size=1)
    82         pub_vel_4 = rospy.Publisher(
'/robot4/cmd_vel_hp', Vector3, queue_size=1)
    83         pub_vel_5 = rospy.Publisher(
'/robot5/cmd_vel_hp', Vector3, queue_size=1)
    84         pub_vel = (pub_vel_1, pub_vel_2, pub_vel_3, pub_vel_4, pub_vel_5)
    91         client = (client_1, client_2, client_3, client_4, client_5)
    93         goal = pioneer_mrs.msg.FormationGoal(order=100)
    95         self.
plot_x = rospy.Publisher(
'plot/x', PointArray, queue_size=10)
    96         self.
plot_y = rospy.Publisher(
'plot/y', PointArray, queue_size=10)
    99             client[i].wait_for_server()
   106         while not rospy.is_shutdown():
   129                         pub_vel[i].publish(vel)
   136                     rospy.loginfo(
"start a multi-robot algorithm action")
   138                         client[i].wait_for_result()
   143                         client[i].cancel_all_goals()
   144                     rospy.loginfo(
"stop the action")
   155         index = int(feedback.name[-1])
   162                 rospy.loginfo(
"robot" + str(i) + 
" (% .4f,% .4f) ", \
   164             rospy.loginfo(
"--------------------------------")
   165             position_x = PointArray()
   166             position_y = PointArray()
   170             self.plot_x.publish(position_x)
   171             self.plot_y.publish(position_y)
   176             index = int(result.name[-1])
   183                     rospy.loginfo(
"robot" + str(i) + 
" (% .4f,% .4f) ", \
   185                 rospy.loginfo(
"action succeeded")
   187             rospy.loginfo(
"action failed")
   190 if __name__ == 
"__main__":
   191     rospy.init_node(
'teleop')
   194     except rospy.ROSInterruptException:
 
def action_done_cb(self, success, result)
def redirect_screen_output(self, status)
def action_feedback_cb(self, feedback)