forked from osrf/vrx-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepare_task_trials.bash
executable file
·52 lines (40 loc) · 1.31 KB
/
prepare_task_trials.bash
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
#!/bin/bash
# prepare_task_trials.bash: A bash script to generate single tasks's world files, one for each task.
#
# E.g.: ./prepare_task_trials.bash station_keeping
set -e
# Constants.
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NOCOLOR='\033[0m'
# Define usage function.
usage()
{
echo "Usage: $0 <task>"
exit 1
}
# Call usage() function if arguments not supplied.
[[ $# -ne 1 ]] && usage
TASK_NAME=$1
echo -e "${GREEN}Preparing all trial worlds for task: ${TASK_NAME}${NOCOLOR}"
# Get directory of this file
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Find task yaml
echo "Looking for config files"
TASK_CONFIG_DIR=${DIR}/task_config
TASK_CONFIG=${TASK_CONFIG_DIR}/${TASK_NAME}.yaml
if [ -f "${TASK_CONFIG}" ]; then
echo -e "Successfully found: ${TASK_CONFIG}\n"
else
echo -e "${RED}Err: ${TASK_CONFIG} not found."; exit 1;
fi
# Create directories to store generated files
world_xacro_target=${DIR}/generated/task_generated/${TASK_NAME}/world_xacros/
world_target=${DIR}/generated/task_generated/${TASK_NAME}/worlds/
mkdir -p ${world_xacro_target}
mkdir -p ${world_target}
# Generate worlds
echo "Generating worlds..."
roslaunch vrx_gazebo generate_worlds.launch requested:=$TASK_CONFIG world_xacro_target:=$world_xacro_target world_target:=$world_target
echo -e "${GREEN}OK${NOCOLOR}\n"