diff --git a/README.md b/README.md index 31f1353..6127517 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Extending the base development environments is done by adding a branch to the re The latest images corresponding to each of the three distributions above are stored in the [`npslearninglab/watery_robots` repository on Dockerhub](https://hub.docker.com/r/npslearninglab/watery_robots). ## Build Instructions -Build the base image with the `build.bash` script. +Build the base image with the `build.bash` script. ``` DIST=(jazzy | humble | galactic | noetic | melodic | kinetic) ./build.bash ${DIST} diff --git a/noetic/Dockerfile b/noetic/Dockerfile index 7ebb32a..4ba80a3 100644 --- a/noetic/Dockerfile +++ b/noetic/Dockerfile @@ -57,6 +57,7 @@ RUN /bin/sh -c 'echo "deb http://packages.ros.org/ros/ubuntu ${RELEASE} main" > python3-rosinstall \ python3-rosinstall-generator \ python3-vcstool \ + python3-colcon-common-extensions \ ros-${DIST}-gazebo-plugins \ ros-${DIST}-gazebo-ros \ ros-${DIST}-gazebo-ros-control \ diff --git a/run.bash b/run.bash index 4449d83..558bc6c 100755 --- a/run.bash +++ b/run.bash @@ -29,28 +29,39 @@ ############################################################ Help() { - # Display Help - echo "Runs a docker container with the image created by build.bash." - echo - echo "Syntax: scriptTemplate [-c|s|t|h]" - echo "options:" - echo "c Add cuda library support." - echo "s Create an image with novnc for use with cloudsim." - echo "t Create a test image for use with CI pipelines." - echo "x Create base image for the VRX competition server." - echo "h Print this help message and exit." - echo + # Display Help + echo "Runs a docker container with the image created by build.bash." + echo + echo "Syntax: $(basename $0) [-p ] [-c|i|r|s|t|h] " + echo "options:" + echo "r With internal graphics card (without nvidia) and with RDP. The default user in container is 'docker' due to RDP constraints (custom host port can be set via the -p option)" + echo "c Add cuda library support." + echo "i With internal graphics card (without nvidia)" + echo "p Override host RDP port (follow syntax for usage, only affects -r option)" + echo "s Create an image with novnc for use with cloudsim." + echo "t Create a test image for use with CI pipelines." + echo "x Create base image for the VRX competition server." + echo "h Print this help message and exit." + + echo } JOY=/dev/input/js0 CUDA="" -ROCKER_ARGS="--devices $JOY --dev-helpers --nvidia --x11 --user --home --git --persist-image" +HOST_RDP_PORT=3389 +ROCKER_ARGS="--devices /dev/dri --devices $JOY --dev-helpers --nvidia --x11 --git --persist-image --volume $(echo ~):/docker/HOST" -while getopts ":cstxh" option; do +while getopts ":cstxhirp:" option; do case $option in c) # enable cuda library support - CUDA="--cuda ";; + CUDA="--cuda";; + i) # With internal graphics card (without nvidia) + ROCKER_ARGS="--devices /dev/dri --devices $JOY --x11 --git --persist-image --volume "$HOME":/root/HOST";; + r) # With internal graphics card (without nvidia) and with RDP. + # The default user in container is 'docker' due to RDP constraints (custom host port can be set via the -p option) + # shellcheck disable=SC2116 + ROCKER_ARGS="--devices /dev/dri --devices $JOY --x11 --git --persist-image --port "$HOST_RDP_PORT":3389 --volume "$HOME":/home/docker/HOST --device /dev/fuse --privileged";; s) # Build cloudsim image ROCKER_ARGS="--nvidia --novnc --turbovnc --user --user-override-name=developer";; t) # Build test image for Continuous Integration @@ -62,6 +73,14 @@ while getopts ":cstxh" option; do h) # print this help message and exit Help exit;; + p) # Override host RDP port + HOST_RDP_PORT=$OPTARG;; + :) #handle missing arguments + echo "Error: Option -$OPTARG requires an argument." >&2 + exit 1;; + \?) # handle unrecognized options + echo "Invalid option: -$OPTARG" >&2 + exit 1;; esac done @@ -73,4 +92,4 @@ CONTAINER_NAME="$(tr ':' '_' <<< "$IMG_NAME")_runtime" ROCKER_ARGS="${ROCKER_ARGS} --name $CONTAINER_NAME" echo "Using image <$IMG_NAME> to start container <$CONTAINER_NAME>" -rocker ${CUDA} ${ROCKER_ARGS} $IMG_NAME +rocker ${CUDA} ${ROCKER_ARGS} $IMG_NAME \ No newline at end of file