-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_one_scenario.sh
executable file
·45 lines (35 loc) · 1.19 KB
/
run_one_scenario.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
#!/bin/bash
cd ~/.ros
# Create a unique ID for the scenario
SCENARIO_FOLDER=`/bin/date +%s`
mkdir -p results/$SCENARIO_FOLDER
echo "Storing results in results/$SCENARIO_FOLDER"
# Execute control
echo "Executing control scenario"
RESULTS_FOLDER=results/$SCENARIO_FOLDER/control
echo "Creating folder for control results: $RESULTS_FOLDER"
mkdir -p $RESULTS_FOLDER
export RESULTS_FOLDER=$RESULTS_FOLDER
echo "Executing scenario: $1"
export i=$1
i=$1
# Launch gazebo
roslaunch pr2_gazebo pr2_empty_world.launch gui:=true &
echo "PR2 launched. Waiting 5 seconds for stability"
sleep 5
echo "Running set arm positions"
rosrun gazebo_utils set_arm_positions
echo "Completed setting arm positions"
echo "Lauching humanoid catching"
CPUPROFILE_FREQUENCY=1000 roslaunch humanoid_catching human_catching_simulated.launch &
echo "Starting fall"
rosrun gazebo_utils random_fall_generator
echo "Killing processes"
kill $(ps -ef | grep '/usr/bin/python /opt/ros/groovy/bin/roslaunch' | grep -v grep | awk '{print $2}')
echo "Waiting for processes to die"
# Now wait for the processes to clean up
while ps -ef | grep '/usr/bin/python /opt/ros/groovy/bin/roslaunch' | grep -v grep;
do
sleep 1;
echo "Waiting...";
done