forked from clydemcqueen/orca4
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix a bug in install instructions: we must build ros_gz from source to use Gazebo Garden with Humble * Small fixes to launch file, docs * Add Dockerfile * Build mavros from src, works better in a docker container (?) * Remove exec_depend on mavros and ros_gz to avoiding building in CI * ardupilot_gazebo now defaults to Gazebo Garden * Add dependency on mavros_extras; use MAVROS binaries
- Loading branch information
1 parent
d809945
commit e0568aa
Showing
12 changed files
with
256 additions
and
13 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 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,158 @@ | ||
FROM osrf/ros:humble-desktop AS base | ||
|
||
ARG USERNAME=orca4 | ||
ARG USER_UID=1000 | ||
ARG USER_GID=$USER_UID | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update && apt-get upgrade -y | ||
|
||
# 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 orca4 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" ] | ||
|
||
# Break orca4 build into multiple stages to speed up 'docker build': | ||
# -- work that depends on workspace.repos | ||
# -- work that depends on orca4 package.xml files | ||
# -- everything else | ||
|
||
# Create colcon workspace and copy workspace.repos file | ||
WORKDIR /home/$USERNAME | ||
RUN mkdir -p colcon_ws/src/orca4 | ||
COPY --chown=$USER_UID:$USER_GID workspace.repos colcon_ws/src/orca4 | ||
|
||
# Get workspace repos | ||
WORKDIR /home/$USERNAME/colcon_ws/src | ||
RUN vcs import < orca4/workspace.repos | ||
|
||
# Run rosdep over workspace repos | ||
# Note: ros_gz asks for some Gazebo Garden keys which are not yet present in rosdistro. | ||
# This is fine, since Gazebo Garden has already been installed. | ||
WORKDIR /home/$USERNAME/colcon_ws | ||
RUN rosdep update \ | ||
&& rosdep install -y --from-paths . --ignore-src --skip-keys="gz-transport12 gz-sim7 gz-math7 gz-msgs9" | ||
|
||
# Build everything so far | ||
RUN [ "/bin/bash" , "-c" , "\ | ||
source /opt/ros/humble/setup.bash \ | ||
&& colcon build" ] | ||
|
||
# Copy orca4 package.xml files | ||
COPY --chown=$USER_UID:$USER_GID orca_base/package.xml src/orca4/orca_base/ | ||
COPY --chown=$USER_UID:$USER_GID orca_bringup/package.xml src/orca4/orca_bringup/ | ||
COPY --chown=$USER_UID:$USER_GID orca_description/package.xml src/orca4/orca_description/ | ||
COPY --chown=$USER_UID:$USER_GID orca_msgs/package.xml src/orca4/orca_msgs/ | ||
COPY --chown=$USER_UID:$USER_GID orca_nav2/package.xml src/orca4/orca_nav2/ | ||
COPY --chown=$USER_UID:$USER_GID orca_shared/package.xml src/orca4/orca_shared/ | ||
|
||
# Run rosdep over orca4 package.xml files | ||
RUN rosdep update \ | ||
&& rosdep install -y --from-paths . --ignore-src --skip-keys="gz-transport12 gz-sim7 gz-math7 gz-msgs9" | ||
|
||
# MAVROS depends on GeographicLib, and GeographicLib needs some datasets | ||
RUN [ "/bin/bash" , "-c" , "\ | ||
wget https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh \ | ||
&& chmod +x install_geographiclib_datasets.sh \ | ||
&& sudo ./install_geographiclib_datasets.sh" ] | ||
|
||
# Copy everything | ||
COPY --chown=$USER_UID:$USER_GID . src/orca4 | ||
|
||
# Build everything | ||
RUN [ "/bin/bash" , "-c" , "\ | ||
source /opt/ros/humble/setup.bash \ | ||
&& colcon build" ] | ||
|
||
# Set up the environment | ||
WORKDIR /home/$USERNAME/colcon_ws | ||
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 "source /home/$USERNAME/colcon_ws/src/orca4/setup.bash" >> /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 launch Gazebo, RViz, all nodes: | ||
~~~ | ||
./run.sh | ||
ros2 launch orca_bringup sim_launch.py | ||
~~~ | ||
|
||
To execute a mission: | ||
~~~ | ||
docker exec -it orca4 /bin/bash | ||
ros2 run orca_bringup mission_runner.py | ||
~~~ |
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 orca4: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 orca4 \ | ||
-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 \ | ||
orca4: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
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
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
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 |
---|---|---|
@@ -1,13 +1,22 @@ | ||
repositories: | ||
|
||
bluerov2_ignition: | ||
type: git | ||
url: https://github.com/clydemcqueen/bluerov2_ignition | ||
version: main | ||
|
||
orb_slam_2_ros: | ||
type: git | ||
url: https://github.com/clydemcqueen/orb_slam_2_ros | ||
version: orca4_humble | ||
|
||
ros2_shared: | ||
type: git | ||
url: https://github.com/ptrmu/ros2_shared | ||
version: master | ||
|
||
# ros_gz supports Humble + Garden only if built from source on the ros2 branch | ||
ros_gz: | ||
type: git | ||
url: https://github.com/gazebosim/ros_gz | ||
version: ros2 |