-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlaunch_all_LC.sh
83 lines (63 loc) · 3.15 KB
/
launch_all_LC.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
scenario_name="LaneChangeSimple"
scenario_config="LaneChangeSimple"
temp_folder="all_temp_data/temp_data1"
result_txt="result_txt/FollowLeadingVehicle/dist5/result_FollowLeadingVehicle1_dist5_speed2_10.txt"
config_folder_path="FollowLeadingVehicle/dist5"
port=2025
tm_port=8025
graphics_num=1
count=0
launch_carla(){
sh ../carla/CarlaUE4.sh -windowed -carla-port=$port -graphicsadapter=$graphics_num
}
launch_sr_init(){
sleep 20
python scenario_runner.py --openscenario srunner/examples/$scenario_name.xosc --record $temp_folder --port=$port --trafficManagerPort=$tm_port
}
launch_ego_vehicle_init(){
sleep 40
python ego_vehicle.py $scenario_name $init_speed $init_direction_x $init_direction_y $distance $speed $d_x $d_y $count $temp_folder $result_txt $port
}
launch_sr(){
sleep 10
python scenario_runner.py --openscenario srunner/examples/$scenario_name.xosc --record $temp_folder --port=$port --trafficManagerPort=$tm_port
}
launch_ego_vehicle(){
sleep 20
python ego_vehicle.py $scenario_name $init_speed $init_direction_x $init_direction_y $distance $speed $d_x $d_y $count $temp_folder $result_txt $port
}
json=$(cat srunner/fuzzing_config/$scenario_config.json)
init_speed=$(echo $json | jq -r '.'$scenario_name'.maneuver_parameter.init_speed')
init_direction_x=$(echo $json | jq -r '.'$scenario_name'.maneuver_parameter.init_direction_x')
init_direction_y=$(echo $json | jq -r '.'$scenario_name'.maneuver_parameter.init_direction_y')
new_speed_scope=$(echo $json | jq -r '.'$scenario_name'.testing_scope.new_speed | map(tostring) | join(" ")')
change_distance_scope=$(echo $json | jq -r '.'$scenario_name'.testing_scope.change_distance | map(tostring) | join(" ")')
new_direction_x_scope=$(echo $json | jq -r '.'$scenario_name'.testing_scope.new_direction_x | map(tostring) | join(" ")')
new_direction_y_scope=$(echo $json | jq -r '.'$scenario_name'.testing_scope.new_direction_y | map(tostring) | join(" ")')
for distance in $(seq $change_distance_scope)
do
for speed in $(seq $new_speed_scope)
do
for d_x in $(seq $new_direction_x_scope)
do
for d_y in $(seq $new_direction_y_scope)
do
if [ $(($count % 10)) -eq 0 ]
then
kill -9 $(lsof -i:$port -t) 2> /dev/null
kill -9 $(lsof -i:$tm_port -t) 2> /dev/null
echo "-------------------------------------------------------------"
launch_carla & launch_sr_init & launch_ego_vehicle_init $scenario_name $init_speed $init_direction_x $init_direction_y $distance $speed $d_x $d_y $count $temp_folder $result_txt $port
count=$((count+1))
else
# pkill -9 scenario_runner.py
# pkill -9 ego_vehicle.py
echo "-------------------------------------------------------------"
launch_sr & launch_ego_vehicle $scenario_name $init_speed $init_direction_x $init_direction_y $distance $speed $d_x $d_y $count $temp_folder $result_txt $port
count=$((count+1))
fi
done
done
done
done