Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
btalb committed Feb 17, 2022
2 parents 8dcc67b + 6963f3d commit f473fac
Show file tree
Hide file tree
Showing 9 changed files with 377 additions and 206 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.sw*
__pycache__/
.cache/

# We never want to track BenchBot components
addons/
Expand Down
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<p align=center><strong>~Access our Benchbot Environments for Active Robotics (BEAR) through our <a href="https://github.com/benchbot-addons/envs_isaac_challenge"> challenge </a> and <a href="https://github.com/benchbot-addons/envs_isaac_develop">development </a> environment addons (installed by default)~</strong></p>
<p align=center><strong>~ Our <a href="https://eval.ai/web/challenges/challenge-page/1614/overview">Robotic Vision Scene Understanding (RVSU) Challenge is live on EvalAI</a> ~<br>(prizes include $2,500USD cash)</strong></p>
<p align=center><strong>~ BenchBot is now powered by <a href="https://developer.nvidia.com/nvidia-omniverse-platform">NVIDIA Omniverse</a> and <a href="https://developer.nvidia.com/isaac-sim">Isaac Sim</a>. We are aware of some issues, please <a href="https://github.com/qcr/benchbot/issues">report any you do encounter</a>. ~</strong></p>
<p align=center><strong>~ Our <a href="https://github.com/qcr/benchbot/wiki/Tutorial:-Performing-Semantic-SLAM-with-Votenet">BenchBot tutorial</a> is the best place to get started developing with BenchBot ~</strong></p>

# BenchBot Software Stack
Expand All @@ -22,20 +23,20 @@ This repository contains the software stack needed to develop solutions for Benc

## System recommendations and requirements

The BenchBot software stack is designed to run seamlessly on a wide number of system configurations (currently limited to Ubuntu 18.04+). System hardware requirements are relatively high due to the software run for 3D simulation (Unreal Engine, Nvidia Isaac, Vulkan, etc.):
The BenchBot software stack is designed to run seamlessly on a wide number of system configurations (currently limited to Ubuntu 18.04+). System hardware requirements are relatively high due to the software run for 3D simulation (e.g. NVIDIA Omniverse-powered Isaac Sim):

- Nvidia Graphics card (GeForce GTX 1080 minimum, Titan XP+ / GeForce RTX 2070+ recommended)
- CPU with multiple cores (Intel i7-6800K minimum)
- Nvidia Graphics card (GeForce RTX 2070 minimum, GeForce GTX 3080+ / RTX A6000+ recommended)
- CPU with multiple cores (Intel i7-6800K 7th Generation minimum)
- 32GB+ RAM
- 64GB+ spare storage (an SSD storage device is **strongly** recommended)

Having a system that meets the above hardware requirements is all that is required to begin installing the BenchBot software stack. The install script analyses your system configuration and offers to install any missing software components interactively. The list of 3rd party software components involved includes:

- Nvidia Driver (4.18+ required, 4.50+ recommended)
- NVIDIA GPU Driver (470.57+ recommended)
- CUDA with GPU support (10.0+ required, 10.1+ recommended)
- Docker Engine - Community Edition (19.03+ required, 19.03.2+ recommended)
- Nvidia Container Toolkit (1.0+ required, 1.0.5+ recommended)
- ISAAC 2019.2 SDK (requires an Nvidia developer login)
- NVIDIA Container Toolkit (1.0+ required, 1.0.5+ recommended)
- Isaac 2021.2 Omniverse simulator (when installing `sim_omni`)

## Managing your installation

Expand All @@ -48,10 +49,10 @@ u@pc:~$ ./install

Any missing software components, or configuration issues with your system, should be detected by the install script and resolved interactively. The installation asks if you want to add BenchBot helper scripts to your `PATH`. Choosing yes will make the following commands available from any directory: `benchbot_install` (same as `./install` above), `benchbot_run`, `benchbot_submit`, `benchbot_eval`, and `benchbot_batch`.

BenchBot installs a default set of add-ons (currently `'benchbot-addons/ssu'`), but this can be changed based on how you want to use BenchBot. For example, the following will also install the `'benchbot-addons/sqa'` add-ons:
BenchBot installs a default set of add-ons (currently `'benchbot-addons/ssu'`), but this can be changed based on how you want to use BenchBot. For example, the following will also install the `'benchbot-addons/data_collect'` add-ons:

```
u@pc:~$ benchbot_install --addons benchbot-addons/ssu,benchbot-addons/sqa
u@pc:~$ benchbot_install --addons benchbot-addons/ssu,benchbot-addons/data_collect
```

See the [BenchBot Add-ons Manager's documentation](https://github.com/qcr/benchbot_addons) for more information on using add-ons.
Expand Down Expand Up @@ -175,7 +176,7 @@ The BenchBot software stack is split into a number of standalone components, eac
- **[benchbot_addons](https://github.com/qcr/benchbot_addons):** a Python manager for add-ons to a BenchBot system, with full documentation on how to create and add your own add-ons
- **[benchbot_supervisor](https://github.com/qcr/benchbot_supervisor):** a HTTP server facilitating communication between user-facing interfaces and the underlying robot controller
- **[benchbot_robot_controller](https://github.com/qcr/benchbot_robot_controller):** a wrapping script which controls the low-level ROS functionality of a simulator or real robot, handles automated subprocess management, and exposes interaction via a HTTP server
- **[benchbot_simulator](https://github.com/qcr/benchbot_simulator):** a realistic 3D simulator employing Nvidia's Isaac framework, in combination with Unreal Engine environments
- **[benchbot_sim_omni](https://github.com/qcr/benchbot_sim_omni):** wrappers around NVIDIA's Omniverse powered Isaac Simulator, providing realistic 3D simulation and lighting (replaces our old Unreal Engine-based [benchbot_sim_unreal](https://github.com/qcr/benchbot_sim_unreal) wrappers)
- **[benchbot_eval](https://github.com/qcr/benchbot_eval):** Python library for evaluating the performance in a task, based on the results produced by a submission

## Further information
Expand All @@ -187,4 +188,4 @@ The BenchBot software stack is split into a number of standalone components, eac

Development of the BenchBot software stack was directly supported by:

[![Australian Centre for Robotic Vision](./docs/acrv_logo_small.png)](https://www.roboticvision.org/)&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;[![QUT Centre for Robotics](./docs/qcr_logo_small.png)](https://research.qut.edu.au/qcr/)
[![QUT Centre for Robotics](./docs/qcr_logo_small.png)](https://research.qut.edu.au/qcr/)&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;&emsp;[![Australian Centre for Robotic Vision](./docs/acrv_logo_small.png)](https://www.roboticvision.org/)
147 changes: 120 additions & 27 deletions bin/.helpers
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ BRANCH_DEFAULT="master"

DOCKER_TAG_CORE="benchbot/core:base"
DOCKER_TAG_BACKEND="benchbot/backend:base"
DOCKER_TAG_SIM_PREFIX="benchbot/simulator:"
DOCKER_TAG_SUBMISSION="benchbot/submission:base"
DOCKER_NETWORK="benchbot_network"

Expand All @@ -23,7 +24,7 @@ GIT_BENCHBOT="https://github.com/qcr/benchbot"
GIT_CONTROLLER="https://github.com/qcr/benchbot_robot_controller"
GIT_EVAL="https://github.com/qcr/benchbot_eval"
GIT_MSGS="https://github.com/qcr/benchbot_msgs"
GIT_SIMULATOR="https://github.com/qcr/benchbot_simulator"
GIT_SIMULATOR_PREFIX="https://github.com/qcr/benchbot_"
GIT_SUPERVISOR="https://github.com/qcr/benchbot_supervisor"

HOSTNAME_DEBUG="benchbot_debug"
Expand All @@ -38,18 +39,31 @@ PATH_ROOT="$(realpath ..)"
PATH_API="$PATH_ROOT/api"
PATH_ADDONS="$PATH_ROOT/addons"
PATH_ADDONS_INTERNAL="/benchbot/addons"
PATH_DOCKERFILE_CORE="$PATH_ROOT/docker/core.Dockerfile"
PATH_CACHE="$PATH_ROOT/.cache"
PATH_DOCKERFILE_BACKEND="$PATH_ROOT/docker/backend.Dockerfile"
PATH_DOCKERFILE_CORE="$PATH_ROOT/docker/core.Dockerfile"
PATH_DOCKERFILE_SHARED="$PATH_ROOT/docker/shared_tools.Dockerfile"
PATH_DOCKERFILE_SIM_PREFIX="$PATH_ROOT/docker/"
PATH_DOCKERFILE_SUBMISSION="$PATH_ROOT/docker/submission.Dockerfile"
PATH_EVAL="$PATH_ROOT/eval"
PATH_ISAAC_SRCS="$PATH_ROOT/isaac"
PATH_LICENSES="$PATH_ROOT/.cache/licenses"
PATH_SYMLINKS="/usr/local/bin"
PATH_TEMP_FILE="/tmp/benchbot_scratch"

PORT_ROBOT=10000
PORT_SUPERVISOR=10000

RETIRED_SIMULATORS=(
"sim_unreal:Isaac Sim 2019.2, powered by Unreal engine"
)

SIZE_GB_FULL=64
SIZE_GB_LITE=32

SUPPORTED_SIMULATORS=(
"sim_omni:The latest Isaac Sim, powered by Omniverse"
)

URL_DEBUG="172.20.0.200"
URL_DOCKER_SUBNET="172.20.0.0/24"
Expand Down Expand Up @@ -119,14 +133,14 @@ function kill_benchbot() {
fi

targets=$(pgrep -f "docker attach benchbot" || true)
if [ $(echo -n "$targets" | wc -l) -gt 0 ]; then
if [ -n "$targets" ]; then
echo -e "${colour_blue}Detached from the following containers:${colour_nc}"
echo "$targets"
for pid in "$targets"; do kill -9 $pid; done
fi

targets=$(docker ps -q -f name='benchbot*' || true)
if [ $(echo -n "$targets" | wc -l) -gt 0 ]; then
if [ -n "$targets" ]; then
echo -e "\n${colour_blue}Stopped the following containers:${colour_nc}"
docker stop $targets
fi
Expand All @@ -153,11 +167,26 @@ function print_version_info() {
printf "(%s)\n" "$hash"
}

function simulator_type() {
function simulator_installed() {
# $1 query simulator, $2 string returned by simulators_installed
[[ "$2" == "$1" ]] || [[ "$2" == *",$1"* ]] || [[ "$2" == *"$1,"* ]]
return $?
}

function simulators_installed() {
# TODO overall this to work with simulator-specific Docker images
echo "$(docker inspect "$DOCKER_TAG_BACKEND" > /dev/null 2>&1 && \
docker run --rm -t "$DOCKER_TAG_BACKEND" /bin/bash -c \
'echo "$BENCHBOT_SIMULATORS"' | tr -d '[:space:]')"
return
}

function simulator_supported() {
# $1 simulator name
local s
for s in "${SUPPORTED_SIMULATORS[@]}"; do
if [ "$(echo "$s" | sed 's/:.*//')" = "$1" ]; then return 0; fi
done
return 1;
}

################################################################################
Expand Down Expand Up @@ -217,12 +246,13 @@ function is_latest_benchbot_msgs() {
}

function is_latest_benchbot_simulator() {
current_hash=$(docker inspect "$DOCKER_TAG_BACKEND" > /dev/null 2>&1 && \
docker run --rm -t "$DOCKER_TAG_BACKEND" /bin/bash -c \
# $1 = simulator name, $2 = branch name
current_hash=$(docker inspect "$DOCKER_TAG_SIM_PREFIX$1" > /dev/null 2>&1 && \
docker run --rm -t "$DOCKER_TAG_SIM_PREFIX$1" /bin/bash -c \
'cd $BENCHBOT_SIMULATOR_PATH && git rev-parse HEAD' | tr -d '[:space:]')
latest_hash=$(git ls-remote "$GIT_SIMULATOR" "$1" | awk '{print $1}')
echo "Current BenchBot Simulator: $current_hash"
echo "Latest BenchBot Simulator: $latest_hash"
latest_hash=$(git ls-remote "$GIT_SIMULATOR_PREFIX$1" "$2" | awk '{print $1}')
echo "Current BenchBot Simulator '$1': $current_hash"
echo "Latest BenchBot Simulator '$1': $latest_hash"
[ "$current_hash" == "$latest_hash" ]
return
}
Expand Down Expand Up @@ -266,10 +296,11 @@ updates."
is_latest_benchbot_eval "$1" > /dev/null
eval_valid=$?
[ $eval_valid -eq 0 ] && echo "$_valid_str." || echo "$_invalid_str."
echo -ne "Checking BenchBot Simulator version ...\t\t\t"
is_latest_benchbot_simulator "$1" > /dev/null
simulator_valid=$?
[ $simulator_valid -eq 0 ] && echo "$_valid_str." || echo "$_invalid_str."
# echo -ne "Checking BenchBot Simulator version ...\t\t\t"
# is_latest_benchbot_simulator "$1" > /dev/null
# simulator_valid=$?
# [ $simulator_valid -eq 0 ] && echo "$_valid_str." || echo "$_invalid_str."
simulator_valid=0
echo -ne "Checking BenchBot Supervisor version ...\t\t"
is_latest_benchbot_supervisor "$1" > /dev/null
supervisor_valid=$?
Expand Down Expand Up @@ -347,14 +378,23 @@ function install_addons() {
"Installing external add-on dependencies:"
run_manager_cmd 'install_external_deps()' '\n' '\n'

printf "\n${colour_blue}%s${colour_nc}\n\n" \
"Baking external add-on dependencies into the Docker backend:"
docker run --name tmp --detach -it "$DOCKER_TAG_BACKEND"
docker exec -it tmp /bin/bash -c \
"$(run_manager_cmd 'print(install_external_deps(True))')"
docker commit tmp "$DOCKER_TAG_BACKEND"
docker rm -f tmp
printf "\n"
containers=( $(docker images \
--filter "reference=$DOCKER_TAG_BACKEND" \
--filter "reference=$DOCKER_TAG_SIM_PREFIX*" \
--format "{{.Repository}}:{{.Tag}}"
) )
for c in "${containers[@]}"; do
printf "\n${colour_blue}%s${colour_nc}\n\n" \
"Baking external add-on dependencies into '$c' container:"
docker run --name tmp --detach -it "$c" /bin/bash
py="$(docker exec -it tmp /bin/bash -c \ "which pip3 || which pip2" | \
tr -d '[:space:]')"
docker exec -it tmp /bin/bash -c "$(run_manager_cmd \
'print(install_external_deps(True))' | sed "s|pip3|$py|")"
docker commit tmp "$c"
docker rm -f tmp
printf "\n"
done
}

function list_addons() {
Expand Down Expand Up @@ -394,6 +434,32 @@ missing "${2:-a}" "${singular}".
"
}

function list_simulators() {
simulators="$(simulators_installed)"
printf "\nThe following simulator options are supported by BenchBot:\n"
for s in "${SUPPORTED_SIMULATORS[@]}"; do
n="$(echo "$s" | sed 's/:.*//')"
d="$(echo "$s" | sed 's/^[^:]*://')"
if simulator_installed "$n" "$simulators"; then
printf "${colour_green}\t%-16s$d (installed)${colour_nc}\n" "$n"
else
printf "\t%-16s$d (available)\n" "$n"
fi
done

printf "\nSupport is retired for the following simulator options:\n"
for s in "${RETIRED_SIMULATORS[@]}"; do
n="$(echo "$s" | sed 's/:.*//')"
d="$(echo "$s" | sed 's/^[^:]*://')"
if simulator_installed "$n" "$simulators"; then
printf "${colour_yellow}\t%-16s$d (installed)${colour_nc}\n" "$n"
else
printf "\t$n\t$d\n"
fi
done
printf "\n"
}

function remove_addons() {
run_manager_cmd 'remove_addons("'$1'")' '\n' '\n\n'
}
Expand Down Expand Up @@ -667,6 +733,26 @@ function _validate_results_possible() {
fi
}

function _validate_simulators() {
# Validate whether simulator selection is supported
# $1 comma-separated simulator list
err=
sims=($(echo "$1" | sed 's/,/\n/g'))
local s
for s in "${sims[@]}"; do
if ! simulator_supported "$s"; then
err="Simulator '$s' is not a supported simulator."
fi
done

if [ -n "$err" ]; then
printf "$err\n"
printf "\n${colour_red}%s%s${colour_nc}" \
"ERROR: Simulator selection was invalid. " \
"See errors above & --list-simulators."
fi
}

function _validate_submission_mode() {
# $1 example name, $2 example_containerised, $3 mode, $4 mode (numeric),
# $5 duplicate mode flag, $6 mode_details, $7 args
Expand Down Expand Up @@ -724,9 +810,8 @@ function _validate_type() {
return
fi

simulators="$(simulator_type)"
if [ "$simulators" != "$1" ] && [ "$simulators" != *",$1" ] && \
[ "$simulators" != *"$1,"* ]; then
simulators="$(simulators_installed)"
if ! simulators_installed "$1" "$simulators"; then
printf "\n${colour_red}%s\n %s${colour_nc}\n" \
"ERROR: Requested running with '$1', but that simulator isn't installed." \
"Installed simulator/s are: '$simulators'"
Expand Down Expand Up @@ -764,7 +849,7 @@ function _validate_types() {
fi
done
printf "\n${colour_red}%s${colour_nc}\n" \
"ERROR: Inconsistent types selected (robot = '$1', environment = '$3')"
"ERROR: Inconsistent types selected (robot = '$1', environment = '$env')"
fi
}

Expand Down Expand Up @@ -853,6 +938,14 @@ function validate_eval_args() {
if [ -n "$err" ]; then echo "$err"; exit 1; fi
}

function validate_install_args() {
# $1 simulator selection
simulators="$1"

err="$(_validate_simulators "$simulators")"
if [ -n "$err" ]; then echo "$err"; exit 1; fi
}

function validate_run_args() {
# $1 robot, $2 task, $3 type of run, $4 environments_string,
# $5... environments list
Expand Down
Loading

0 comments on commit f473fac

Please sign in to comment.