#!/bin/bash ################################################################################################################################################### # Author: Zhang Shuai # # Date: 2019-05-23 # # Description: launch a MPI Gazebo simulation task # # Usage: ./MPI_Gazebo_launch.sh [ros packdge's name] [launch file's name] [workspace's path] [world's path and name] [hostfile] [shell's path] # # Example: ./MPI_Gazebo_launch.sh rosplane_sim fixedwing_text_three_100_withoutfast_mpi.launch ~/zhangshuai/DA # # ~/zhangshuai/DA/src/da/rosplane/rosplane_sim/worlds/flying_mpi_100.world hostfile ~/Git/Gazebo_Distributed_MPI/mpi_run # ################################################################################################################################################### packdge_name=$1 launch_file_name=$2 workspace_path=$3 world_file=$4 host_file=$5 shell_path=$6 echo $packdge_name echo $launch_file_name echo $workspace_path echo $world_file echo $host_file echo $shell_path host_count=0 hosts=() #获取hostfile文件中的host名字 while read line do if [ -n "$line" ] then temp=${line% *} hosts[$host_count]=$temp let host_count=$host_count+1 fi done < $host_file echo "host_count:$host_count" for((i=0;i /dev/null 2>&1 "cd $shell_path; ./kill.sh; ./kill.sh; ./kill.sh; ./kill.sh; ./kill.sh; ./kill.sh; ./kill.sh; ./kill.sh; ./kill.sh; exit" echo "${hosts[$i]}:close_good" done echo simulation_done! exit 0