forked from clydemcqueen/bluerov2_gz
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'clyde_remote/main'
- Loading branch information
Showing
21 changed files
with
310 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.idea/ | ||
cmake-build-* | ||
.cmake-build-* |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
FROM ubuntu:22.04 AS base | ||
|
||
ARG USERNAME=bluerov2 | ||
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update && apt-get upgrade -y | ||
|
||
# Install language | ||
RUN apt-get update \ | ||
&& apt-get -y --quiet --no-install-recommends install \ | ||
locales \ | ||
&& locale-gen en_US.UTF-8 \ | ||
&& update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
ENV LANG=en_US.UTF-8 | ||
|
||
# Install timezone | ||
RUN ln -fs /usr/share/zoneinfo/UTC /etc/localtime \ | ||
&& apt-get update \ | ||
&& apt-get -y --quiet --no-install-recommends install \ | ||
tzdata \ | ||
&& dpkg-reconfigure --frontend noninteractive tzdata \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install a few handy tools | ||
RUN apt-get update \ | ||
&& apt-get -y --quiet --no-install-recommends install \ | ||
bash-completion \ | ||
build-essential \ | ||
git \ | ||
glmark2 \ | ||
gnupg \ | ||
iputils-ping \ | ||
lsb-release \ | ||
mlocate \ | ||
software-properties-common \ | ||
sudo \ | ||
wget \ | ||
vim \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Gazebo Garden | ||
RUN wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg | ||
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null | ||
RUN apt-get update \ | ||
&& apt-get -y --quiet --no-install-recommends install \ | ||
gz-garden \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install NVIDIA software | ||
RUN apt-get update \ | ||
&& apt-get -y --quiet --no-install-recommends install \ | ||
libglvnd0 \ | ||
libgl1 \ | ||
libglx0 \ | ||
libegl1 \ | ||
libxext6 \ | ||
libx11-6 \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
ENV NVIDIA_VISIBLE_DEVICES=all | ||
ENV NVIDIA_DRIVER_CAPABILITIES=graphics,utility,compute | ||
ENV QT_X11_NO_MITSHM=1 | ||
|
||
# Install some ardupilot and ardupilot_gazebo prereqs | ||
RUN apt-get update \ | ||
&& apt-get -y --quiet --no-install-recommends install \ | ||
python3-wxgtk4.0 \ | ||
rapidjson-dev \ | ||
xterm \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Create a non-root user | ||
# Required for ArduSub install, but generally a good idea | ||
RUN groupadd --gid $USER_GID $USERNAME \ | ||
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \ | ||
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ | ||
&& chmod 0440 /etc/sudoers.d/$USERNAME \ | ||
&& echo "\n# Added by bluerov2_ignition Dockerfile:" >> /home/$USERNAME/.bashrc \ | ||
&& echo "source /usr/share/bash-completion/completions/git" >> /home/$USERNAME/.bashrc | ||
|
||
# Switch to our new user | ||
USER $USERNAME | ||
ENV USER=$USERNAME | ||
|
||
# Clone ArduSub code | ||
WORKDIR /home/$USERNAME | ||
RUN git clone https://github.com/ArduPilot/ardupilot.git --recurse-submodules | ||
|
||
# Install ArduSub prereqs (this also appends to .bashrc) | ||
WORKDIR /home/$USERNAME/ardupilot | ||
ENV SKIP_AP_EXT_ENV=1 SKIP_AP_GRAPHIC_ENV=1 SKIP_AP_COV_ENV=1 SKIP_AP_GIT_CHECK=1 | ||
RUN Tools/environment_install/install-prereqs-ubuntu.sh -y | ||
|
||
# Build ArduSub | ||
# Note: waf will capture all of the environment variables in ardupilot/.lock-waf_linux_build. | ||
# Any change to enviroment variables will cause a re-build. | ||
# To avoid this call sim_vehicle.py with the "--no-rebuild" option. | ||
WORKDIR /home/$USERNAME/ardupilot | ||
RUN modules/waf/waf-light configure --board sitl \ | ||
&& modules/waf/waf-light build --target bin/ardusub | ||
|
||
# Clone ardupilot_gazebo code | ||
WORKDIR /home/$USERNAME | ||
RUN git clone https://github.com/ArduPilot/ardupilot_gazebo.git | ||
|
||
# Build ardupilot_gazebo | ||
RUN [ "/bin/bash" , "-c" , " \ | ||
cd ardupilot_gazebo \ | ||
&& mkdir build \ | ||
&& cd build \ | ||
&& cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo \ | ||
&& make -j4" ] | ||
|
||
# Copy bluerov2_ignition code | ||
WORKDIR /home/$USERNAME/bluerov2_ignition | ||
COPY --chown=$USER_UID:$USER_GID . . | ||
|
||
# Set up the environment | ||
WORKDIR /home/$USERNAME | ||
RUN echo "export PATH=/home/$USERNAME/.local/bin:\$PATH" >> /home/$USERNAME/.bashrc \ | ||
&& echo "export PATH=/home/$USERNAME/.local/lib/python3.10/site-packages:\$PATH" >> /home/$USERNAME/.bashrc \ | ||
&& echo "export GZ_SIM_SYSTEM_PLUGIN_PATH=/home/$USERNAME/ardupilot_gazebo/build" >> /home/$USERNAME/.bashrc \ | ||
&& echo "export GZ_SIM_RESOURCE_PATH=/home/$USERNAME/bluerov2_ignition/models:/home/$USERNAME/bluerov2_ignition/worlds" >> /home/$USERNAME/.bashrc | ||
|
||
# Required to use the --console option on sim_vehicle.py | ||
# RUN pip3 install matplotlib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
To build the docker image: | ||
~~~ | ||
./build.sh | ||
~~~ | ||
|
||
To run the demo, start the container in the 1st terminal, and start ArduSub: | ||
~~~ | ||
./run.sh | ||
sim_vehicle.py -L RATBeach -v ArduSub --model=JSON --out=udp:0.0.0.0:14550 --no-rebuild | ||
~~~ | ||
|
||
In the 2nd terminal start Gazebo: | ||
~~~ | ||
docker exec -it bluerov2_ignition /bin/bash | ||
gz sim -v 3 -r underwater.world | ||
~~~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
|
||
cd $DIR | ||
|
||
docker build -f $DIR/Dockerfile -t bluerov2_ignition:latest .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env bash | ||
|
||
XAUTH=/tmp/.docker.xauth | ||
if [ ! -f $XAUTH ] | ||
then | ||
xauth_list=$(xauth nlist $DISPLAY) | ||
xauth_list=$(sed -e 's/^..../ffff/' <<< "$xauth_list") | ||
if [ ! -z "$xauth_list" ] | ||
then | ||
echo "$xauth_list" | xauth -f $XAUTH nmerge - | ||
else | ||
touch $XAUTH | ||
fi | ||
chmod a+r $XAUTH | ||
fi | ||
|
||
# Specific for NVIDIA drivers, required for OpenGL >= 3.3 | ||
docker run -it \ | ||
--rm \ | ||
--name bluerov2_ignition \ | ||
-e DISPLAY \ | ||
-e QT_X11_NO_MITSHM=1 \ | ||
-e XAUTHORITY=$XAUTH \ | ||
-e NVIDIA_VISIBLE_DEVICES=all \ | ||
-e NVIDIA_DRIVER_CAPABILITIES=all \ | ||
-v "$XAUTH:$XAUTH" \ | ||
-v "/tmp/.X11-unix:/tmp/.X11-unix" \ | ||
-v "/etc/localtime:/etc/localtime:ro" \ | ||
-v "/dev/input:/dev/input" \ | ||
--privileged \ | ||
--security-opt seccomp=unconfined \ | ||
--gpus all \ | ||
bluerov2_ignition:latest |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.