Skip to content

Commit

Permalink
Merge branch 'lereljic/segformer-semantic-segmentation' of github.com…
Browse files Browse the repository at this point in the history
…:WATonomous/wato_monorepo into lereljic/segformer-semantic-segmentation
  • Loading branch information
lucasreljic committed Jun 14, 2024
2 parents 6c0de4e + ae75333 commit d115d94
Show file tree
Hide file tree
Showing 106 changed files with 2,519 additions and 358 deletions.
11 changes: 11 additions & 0 deletions .github/templates/docker_context/docker_context.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,24 @@ while read -r module; do
services=$(docker-compose -f "$module" config --services)
module_out=$(echo "$module" | sed -n 's/modules\/docker-compose\.\(.*\)\.yaml/\1/p')

# Skip simulation module
if [[ 'simulation' = $module_out ]]; then
continue
fi

# Only work with modules that are modified
if [[ $MODIFIED_MODULES != *$module_out* && $TEST_ALL = "false" ]]; then
continue
fi

# Loop through each service
while read -r service_out; do
# Temporarily skip perception services that have too large image size
if [[ "$service_out" == "lane_detection" ]] || \
[[ "$service_out" == "camera_object_detection" ]] || \
[[ "$service_out" == "semantic_segmentation" ]]; then
continue
fi
# Construct JSON object for each service with module and service name
json_object=$(jq -nc --arg module_out "$module_out" --arg service_out "$service_out" \
'{module: $module_out, service: $service_out}')
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/build_and_unitest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:

jobs:
setup-environment:
name: Setup environment
name: Setup Environment
runs-on: ubuntu-latest

outputs:
Expand All @@ -29,7 +29,9 @@ jobs:
uses: "./.github/templates/check_src_changes"

- name: Setup Watod Environment
run: ./watod_scripts/watod-setup-env.sh
run: |
MODULES_DIR="$GITHUB_WORKSPACE/modules"
. ./watod_scripts/watod-setup-env.sh
shell: bash

- name: Generate Docker Environment
Expand All @@ -43,7 +45,7 @@ jobs:
uses: "./.github/templates/github_context"

build-and-unittest:
name: Build Image and Run Unit Testing Suite
name: Build/Test
runs-on: ubuntu-latest
needs: setup-environment

Expand Down Expand Up @@ -124,9 +126,7 @@ jobs:
${{ steps.construct-registry-url.outputs.url }}:${{ env.SOURCE_BRANCH }}
cache-from: |
${{ steps.construct-registry-url.outputs.url }}:build_${{ env.SOURCE_BRANCH }}
${{ steps.construct-registry-url.outputs.url }}:${{ env.SOURCE_BRANCH }}
${{ steps.construct-registry-url.outputs.url }}:${{ env.TARGET_BRANCH }}
cache-to: type=inline
${{ steps.construct-registry-url.outputs.url }}:build_${{ env.TARGET_BRANCH }}
builder: ${{ steps.buildx.outputs.name }}
target: deploy

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/build_base_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ jobs:
uses: actions/checkout@v4

- name: Setup Watod Environment
run: ./watod_scripts/watod-setup-env.sh
run: |
MODULES_DIR="$GITHUB_WORKSPACE/modules"
. ./watod_scripts/watod-setup-env.sh
shell: bash

- name: Generate Docker Environment
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/linting_auto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
branches:
- main
types:
- unlabeled
- labeled
- synchronize

Expand Down Expand Up @@ -51,4 +52,4 @@ jobs:
repo: context.repo.repo,
issue_number: context.issue.number,
name: 'auto-lint'
});
});
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ code_server_config/*/start_code_server.sh
.env
.vscode/
ssh_config/

watod-config.local.sh
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "src/perception/lane_detection/src/lane_detection_tensorrt"]
path = src/perception/lane_detection/src/lane_detection_tensorrt
url = [email protected]:WATonomous/lane_detection_tensorrt.git
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# WATonomous Monorepo v2

Dockerized ROS2 setup for the WATonomous Autonomous Driving Software Pipeline
Dockerized ROS2 setup for the WATonomous Autonomous Vehicle Software Pipeline

- [WATonomous Monorepo](#watonomous-monorepo)
- [Getting Started](#getting-started)
Expand Down Expand Up @@ -88,7 +88,7 @@ wato_monorepo_v2
### Using Foxglove
[Foxglove](https://foxglove.dev/) is used to visualize ROS messages on a local machine.

Add `data_stream` as an `ACTIVE_MODULES` and `watod up`.
Add `infrastructure` as an `ACTIVE_MODULES` and `watod up`.

It exposes the port specified by the `FOXGLOVE_BRIDGE_PORT` variable, which you will need to forward to your local machine. This can either be done in the `ports` section of VS Code or by running the command `ssh -L 8765:localhost:8765 <username>@<machine>-ubuntu1.watocluster.local` on your local machine.

Expand Down
11 changes: 7 additions & 4 deletions docker/base/inject_wato_base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ ARG GENERIC_IMAGE
# for the wato_monorepo.
FROM ${GENERIC_IMAGE} as wato_base

ENV DEBIAN_FRONTEND noninteractive
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
apt-get install -y curl sudo && \
rm -rf /var/lib/apt/lists/*

ENV USER="bolty"
ENV AMENT_WS=/home/${USER}/ament_ws

# User Setup
RUN apt-get update && apt-get install -y curl sudo && \
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y curl sudo && \
rm -rf /var/lib/apt/lists/*

# Add a user so that created files in the docker container are owned by a non-root user (for prod)
Expand All @@ -19,14 +22,14 @@ RUN addgroup --gid 1000 ${USER} && \
useradd -rm -d /home/${USER} -s /bin/bash -g ${USER} -G sudo -u 1000 ${USER} -p "$(openssl passwd -6 $USER_PASSWD)"

# install apt-fast
RUN apt-get -qq update && \
RUN DEBIAN_FRONTEND=noninteractive apt-get -qq update && \
apt-get install -qq -y wget && \
mkdir -p /etc/apt/keyrings && \
wget -O - "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA2166B8DE8BDC3367D1901C11EE2FF37CA8DA16B" \
| gpg --dearmor -o /etc/apt/keyrings/apt-fast.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/apt-fast.gpg] \
http://ppa.launchpad.net/apt-fast/stable/ubuntu focal main" > /etc/apt/sources.list.d/apt-fast.list && \
apt-get update -qq && apt-get install -qq -y apt-fast && \
DEBIAN_FRONTEND=noninteractive apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get install -qq -y apt-fast && \
echo debconf apt-fast/maxdownloads string 16 | debconf-set-selections && \
echo debconf apt-fast/dlflag boolean true | debconf-set-selections && \
echo debconf apt-fast/aptmanager string apt-get | debconf-set-selections
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ RUN rm requirements.txt

# Install Rosdep requirements
COPY --from=source /tmp/colcon_install_list /tmp/colcon_install_list
RUN apt-fast install -qq -y --no-install-recommends $(cat /tmp/colcon_install_list)
RUN apt-get update && apt-fast install -qq -y --no-install-recommends $(cat /tmp/colcon_install_list)

# Copy in source code from source stage
WORKDIR ${AMENT_WS}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ FROM ${BASE_IMAGE} as source
WORKDIR ${AMENT_WS}/src

# Copy in source code
COPY src/simulation/carla_sim carla_sim
COPY src/wato_msgs/sample_msgs sample_msgs
COPY src/perception/depth_estimation depth_estimation

# Scan for rosdeps
RUN apt-get -qq update && rosdep update && \
Expand Down
29 changes: 25 additions & 4 deletions docker/perception/lane_detection/lane_detection.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ARG BASE_IMAGE=ghcr.io/watonomous/wato_monorepo/base:humble-ubuntu22.04

ARG BASE_IMAGE=ghcr.io/watonomous/wato_monorepo/base:cuda12.2-humble-ubuntu22.04-devel
ARG RUNTIME_IMAGE=ghcr.io/watonomous/wato_monorepo/base:cuda12.2-humble-ubuntu22.04
################################ Source ################################
FROM ${BASE_IMAGE} as source

WORKDIR ${AMENT_WS}/src

# Copy in source code
COPY src/perception/lane_detection lane_detection
COPY src/wato_msgs/sample_msgs sample_msgs
COPY src/wato_msgs/perception_msgs/lane_detection_msgs lane_detection_msgs

# Scan for rosdeps
RUN apt-get -qq update && rosdep update && \
Expand All @@ -19,6 +19,13 @@ RUN apt-get -qq update && rosdep update && \
################################# Dependencies ################################
FROM ${BASE_IMAGE} as dependencies

RUN apt-get update && apt-get install -y libopencv-dev \
python3-opencv \
tensorrt \
cuda-toolkit

RUN export OpenCV_DIR=/usr/lib/x86_64-linux-gnu/cmake/opencv4/OpenCVConfig.cmake

# Install Rosdep requirements
COPY --from=source /tmp/colcon_install_list /tmp/colcon_install_list
RUN apt-fast install -qq -y --no-install-recommends $(cat /tmp/colcon_install_list)
Expand Down Expand Up @@ -46,7 +53,21 @@ COPY docker/wato_ros_entrypoint.sh ${AMENT_WS}/wato_ros_entrypoint.sh
ENTRYPOINT ["./wato_ros_entrypoint.sh"]

################################ Prod ################################
FROM build as deploy
# Use a different runtime image for a smaller image size
FROM ${RUNTIME_IMAGE} as deploy

# Install runtime libs
RUN apt-get update && apt-get install -y \
ros-humble-cv-bridge \
tensorrt

# Copy the compiled binary to the runtime image
COPY --from=build ${AMENT_WS} ${AMENT_WS}

WORKDIR ${AMENT_WS}

COPY docker/wato_ros_entrypoint.sh ${AMENT_WS}/wato_ros_entrypoint.sh
ENTRYPOINT ["./wato_ros_entrypoint.sh"]

# Source Cleanup and Security Setup
RUN chown -R $USER:$USER ${AMENT_WS}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ WORKDIR ${AMENT_WS}/src

# Copy in source code
COPY src/perception/radar_object_detection radar_object_detection
COPY src/wato_msgs/radar_msgs radar_msgs
COPY src/wato_msgs/perception_msgs/radar_msgs radar_msgs

# Scan for rosdeps
RUN apt-get -qq update && rosdep update && \
Expand Down

This file was deleted.

23 changes: 23 additions & 0 deletions docker/simulation/carla_notebooks/carla_notebooks.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
ARG CARLA_VERSION=0.9.13
FROM carlasim/carla:${CARLA_VERSION} AS wato_carla_api

FROM python:3.8.16-slim-bullseye
ARG CARLA_VERSION=0.9.13

RUN pip3 install carla==${CARLA_VERSION} jupyter tensorflow-probability
RUN apt-get update && apt-get install -y curl git wget unzip && apt remove python3-networkx

COPY --from=wato_carla_api --chown=root /home/carla/PythonAPI/carla/agents /usr/local/lib/python3.8/site-packages/agents

WORKDIR /home/bolty/carla_notebooks
COPY src/simulation/carla_notebooks /home/bolty/carla_notebooks

WORKDIR /home/bolty
# Setup CARLA Scenario Runner
# The last sed command replaces hero (default ego vehicle name) with another ego vehicle name
RUN git clone https://github.com/carla-simulator/scenario_runner.git && \
cd scenario_runner && pip3 install -r requirements.txt && \
sed -i s/hero/ego/g /home/bolty/scenario_runner/srunner/tools/scenario_parser.py
WORKDIR /home/bolty

WORKDIR /home/bolty/carla_notebooks
Loading

0 comments on commit d115d94

Please sign in to comment.