Skip to content

Commit

Permalink
renaming package
Browse files Browse the repository at this point in the history
  • Loading branch information
danielrhuynh committed Feb 13, 2024
1 parent 3071625 commit 9f177c6
Show file tree
Hide file tree
Showing 16 changed files with 156 additions and 209 deletions.
Original file line number Diff line number Diff line change
@@ -1,55 +1,71 @@
ARG BASE_IMAGE=ghcr.io/watonomous/wato_monorepo/base:humble-ubuntu22.04

################################ Source ################################
FROM ${BASE_IMAGE} as source

WORKDIR ${AMENT_WS}/src

# Copy in source code
COPY src/perception/lidar_object_detection lidar_object_detection
COPY src/wato_msgs/sample_msgs sample_msgs

# Scan for rosdeps
RUN apt-get -qq update && rosdep update && \
rosdep install --from-paths . --ignore-src -r -s \
| grep 'apt-get install' \
| awk '{print $3}' \
| sort > /tmp/colcon_install_list

################################# Dependencies ################################
ARG BASE_IMAGE=ghcr.io/watonomous/wato_monorepo/base:cuda11.7-humble-ubuntu22.04-devel
FROM ${BASE_IMAGE} as dependencies

# 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)

# Copy in source code from source stage
WORKDIR ${AMENT_WS}
COPY --from=source ${AMENT_WS}/src src

# Dependency Cleanup
WORKDIR /
RUN apt-get -qq autoremove -y && apt-get -qq autoclean && apt-get -qq clean && \
rm -rf /root/* /root/.ros /tmp/* /var/lib/apt/lists/* /usr/share/doc/*

################################ Build ################################
################################# Dependencies ################################
RUN apt-get update && apt-get install -y \
git zip unzip libssl-dev libcairo2-dev lsb-release libgoogle-glog-dev libgflags-dev libatlas-base-dev libeigen3-dev software-properties-common \
build-essential cmake pkg-config libapr1-dev autoconf automake libtool curl libc6 libboost-all-dev debconf libomp5 libstdc++6 \
libqt5core5a libqt5xml5 libqt5gui5 libqt5widgets5 libqt5concurrent5 libqt5opengl5 libcap2 libusb-1.0-0 libatk-adaptor neovim \
python3-pip python3-setuptools \
&& apt-get -qq autoremove -y && apt-get -qq autoclean && apt-get -qq clean && \
rm -rf /var/lib/apt/lists/* /root/* /root/.ros /tmp/* /usr/share/doc
################################ INSTALL OpenCV with CUDA Support ##############
WORKDIR /opt
RUN git clone https://github.com/opencv/opencv.git && \
cd opencv && git checkout 4.5.5
RUN git clone https://github.com/opencv/opencv_contrib.git && \
cd opencv_contrib && git checkout 4.5.5
WORKDIR /opt/opencv/build
RUN cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D BUILD_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D INSTALL_C_EXAMPLES=OFF \
-D PYTHON_EXECUTABLE=$(which python3) \
-D PYTHON3_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
-D PYTHON3_PACKAGES_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") \
-D BUILD_opencv_python3=ON \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules/ \
-D WITH_GSTREAMER=ON \
-D WITH_CUDA=ON \
-D ENABLE_PRECOMPILED_HEADERS=OFF \
.. && make -j$(nproc) && make install && ldconfig
RUN rm -rf /opt/opencv /opt/opencv_contrib
# Set environment variables
ENV CUDA_HOME /usr/local/cuda
ENV LD_LIBRARY_PATH /usr/local/cuda/lib64:${LD_LIBRARY_PATH}
ENV PATH /usr/local/cuda/bin:${PATH}
ENV OpenCV_DIR=/usr/share/OpenCV
# Install Python dependencies
RUN pip3 install torch==1.13.1+cu116 torchvision==0.14.1+cu116 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu116
RUN pip3 install torch-scatter -f https://data.pyg.org/whl/torch-1.13.1+cu116.html
ENV TORCH_CUDA_ARCH_LIST="3.5;5.0;6.0;6.1;7.0;7.5;8.0;8.6+PTX"
RUN pip3 install spconv-cu113 pyquaternion numpy==1.23 pillow==8.4 mayavi open3d av2
WORKDIR /home/bolty
# RUN git clone https://github.com/WATonomous/OpenPCDet.git
COPY /OpenPCDet /home/bolty/OpenPCDet
WORKDIR /home/bolty
RUN cd OpenPCDet && pip3 install -r requirements.txt
RUN pip3 install kornia==0.6.8
RUN pip3 install nuscenes-devkit==1.0.5
################################ Source #######################################
FROM dependencies as build

# Build ROS2 packages
WORKDIR ${AMENT_WS}/src
COPY wato_monorepo/src/perception/lidar_object_detection lidar_object_detection
COPY wato_monorepo/src/wato_msgs/sample_msgs sample_msgs
RUN apt-get update && rosdep update && \
rosdep install --from-paths . --ignore-src -r -y
RUN apt install -y ros-${ROS_DISTRO}-foxglove-bridge
WORKDIR ${AMENT_WS}
RUN . /opt/ros/$ROS_DISTRO/setup.sh && \
colcon build \
--cmake-args -DCMAKE_BUILD_TYPE=Release

# Entrypoint will run before any CMD on launch. Sources ~/opt/<ROS_DISTRO>/setup.bash and ~/ament_ws/install/setup.bash
COPY docker/wato_ros_entrypoint.sh ${AMENT_WS}/wato_ros_entrypoint.sh
RUN . /opt/ros/$ROS_DISTRO/setup.sh && colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
# Entrypoint setup
COPY wato_monorepo/docker/wato_ros_entrypoint.sh ${AMENT_WS}/wato_ros_entrypoint.sh
ENTRYPOINT ["./wato_ros_entrypoint.sh"]

################################ Prod ################################
FROM build as deploy
################################ Prod #########################################
# FROM build as deploy

# Source Cleanup and Security Setup
RUN chown -R $USER:$USER ${AMENT_WS}
RUN rm -rf src/*
# RUN chown -R $USER:$USER ${AMENT_WS}
# RUN rm -rf src/*

USER ${USER}
# USER ${USER}

This file was deleted.

162 changes: 81 additions & 81 deletions modules/docker-compose.perception.yaml
Original file line number Diff line number Diff line change
@@ -1,98 +1,98 @@
version: "3.8"

services:
radar_object_detection:
build:
context: ..
dockerfile: docker/perception/radar_object_detection/radar_object_detection.Dockerfile
cache_from:
- "${PERCEPTION_RADAR_OBJECT_DETECTION_IMAGE:?}:${TAG}"
- "${PERCEPTION_RADAR_OBJECT_DETECTION_IMAGE:?}:main"
target: deploy
image: "${PERCEPTION_RADAR_OBJECT_DETECTION_IMAGE:?}:${TAG}"
command: /bin/bash -c "ros2 launch radar_object_detection radar_object_detection.launch.py"
# radar_object_detection:
# build:
# context: ..
# dockerfile: docker/perception/radar_object_detection/radar_object_detection.Dockerfile
# cache_from:
# - "${PERCEPTION_RADAR_OBJECT_DETECTION_IMAGE:?}:${TAG}"
# - "${PERCEPTION_RADAR_OBJECT_DETECTION_IMAGE:?}:main"
# target: deploy
# image: "${PERCEPTION_RADAR_OBJECT_DETECTION_IMAGE:?}:${TAG}"
# command: /bin/bash -c "ros2 launch radar_object_detection radar_object_detection.launch.py"

camera_object_detection:
build:
context: ..
dockerfile: docker/perception/camera_object_detection/camera_object_detection.Dockerfile
cache_from:
- "${PERCEPTION_CAMERA_OBJECT_DETECTION_IMAGE:?}:${TAG}"
- "${PERCEPTION_CAMERA_OBJECT_DETECTION_IMAGE:?}:main"
target: deploy
image: "${PERCEPTION_CAMERA_OBJECT_DETECTION_IMAGE:?}:${TAG}"
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [ gpu ]
command: /bin/bash -c "ros2 launch camera_object_detection nuscenes_launch.py"
volumes:
- /mnt/wato-drive2/perception_models/yolov8s.pt:/perception_models/yolov8s.pt
# camera_object_detection:
# build:
# context: ..
# dockerfile: docker/perception/camera_object_detection/camera_object_detection.Dockerfile
# cache_from:
# - "${PERCEPTION_CAMERA_OBJECT_DETECTION_IMAGE:?}:${TAG}"
# - "${PERCEPTION_CAMERA_OBJECT_DETECTION_IMAGE:?}:main"
# target: deploy
# image: "${PERCEPTION_CAMERA_OBJECT_DETECTION_IMAGE:?}:${TAG}"
# deploy:
# resources:
# reservations:
# devices:
# - driver: nvidia
# count: 1
# capabilities: [ gpu ]
# command: /bin/bash -c "ros2 launch camera_object_detection nuscenes_launch.py"
# volumes:
# - /mnt/wato-drive2/perception_models/yolov8s.pt:/perception_models/yolov8s.pt

lidar_object_detection:
build:
context: ..
context: ../
dockerfile: docker/perception/lidar_object_detection/lidar_object_detection.Dockerfile
cache_from:
- "${PERCEPTION_LIDAR_OBJECT_DETECTION_IMAGE}:${TAG}"
- "${PERCEPTION_LIDAR_OBJECT_DETECTION_IMAGE}:main"
target: deploy
# target: deploy
image: "${PERCEPTION_LIDAR_OBJECT_DETECTION_IMAGE}:${TAG}"
command: /bin/bash -c "ros2 launch lidar_object_detection lidar_object_detection.launch.py"
traffic_light_detection:
build:
context: ..
dockerfile: docker/perception/traffic_light_detection/traffic_light_detection.Dockerfile
cache_from:
- "${PERCEPTION_TRAFFIC_LIGHT_DETECTION_IMAGE}:${TAG}"
- "${PERCEPTION_TRAFFIC_LIGHT_DETECTION_IMAGE}:main"
target: deploy
image: "${PERCEPTION_TRAFFIC_LIGHT_DETECTION_IMAGE}:${TAG}"
command: /bin/bash -c "ros2 launch traffic_light_detection traffic_light_detection.launch.py"
# traffic_light_detection:
# build:
# context: ..
# dockerfile: docker/perception/traffic_light_detection/traffic_light_detection.Dockerfile
# cache_from:
# - "${PERCEPTION_TRAFFIC_LIGHT_DETECTION_IMAGE}:${TAG}"
# - "${PERCEPTION_TRAFFIC_LIGHT_DETECTION_IMAGE}:main"
# target: deploy
# image: "${PERCEPTION_TRAFFIC_LIGHT_DETECTION_IMAGE}:${TAG}"
# command: /bin/bash -c "ros2 launch traffic_light_detection traffic_light_detection.launch.py"

traffic_sign_detection:
build:
context: ..
dockerfile: docker/perception/traffic_sign_detection/traffic_sign_detection.Dockerfile
cache_from:
- "${PERCEPTION_TRAFFIC_SIGN_DETECTION_IMAGE}:${TAG}"
- "${PERCEPTION_TRAFFIC_SIGN_DETECTION_IMAGE}:main"
target: deploy
image: "${PERCEPTION_TRAFFIC_SIGN_DETECTION_IMAGE}:${TAG}"
command: /bin/bash -c "ros2 launch traffic_sign_detection traffic_sign_detection.launch.py"
# traffic_sign_detection:
# build:
# context: ..
# dockerfile: docker/perception/traffic_sign_detection/traffic_sign_detection.Dockerfile
# cache_from:
# - "${PERCEPTION_TRAFFIC_SIGN_DETECTION_IMAGE}:${TAG}"
# - "${PERCEPTION_TRAFFIC_SIGN_DETECTION_IMAGE}:main"
# target: deploy
# image: "${PERCEPTION_TRAFFIC_SIGN_DETECTION_IMAGE}:${TAG}"
# command: /bin/bash -c "ros2 launch traffic_sign_detection traffic_sign_detection.launch.py"

semantic_segmentation:
build:
context: ..
dockerfile: docker/perception/semantic_segmentation/semantic_segmentation.Dockerfile
cache_from:
- "${PERCEPTION_SEMANTIC_SEGMENTATION_IMAGE}:${TAG}"
- "${PERCEPTION_SEMANTIC_SEGMENTATION_IMAGE}:main"
target: deploy
image: "${PERCEPTION_SEMANTIC_SEGMENTATION_IMAGE}:${TAG}"
command: /bin/bash -c "ros2 launch semantic_segmentation semantic_segmentation.launch.py"
# semantic_segmentation:
# build:
# context: ..
# dockerfile: docker/perception/semantic_segmentation/semantic_segmentation.Dockerfile
# cache_from:
# - "${PERCEPTION_SEMANTIC_SEGMENTATION_IMAGE}:${TAG}"
# - "${PERCEPTION_SEMANTIC_SEGMENTATION_IMAGE}:main"
# target: deploy
# image: "${PERCEPTION_SEMANTIC_SEGMENTATION_IMAGE}:${TAG}"
# command: /bin/bash -c "ros2 launch semantic_segmentation semantic_segmentation.launch.py"

lane_detection:
build:
context: ..
dockerfile: docker/perception/lane_detection/lane_detection.Dockerfile
cache_from:
- "${PERCEPTION_LANE_DETECTION_IMAGE}:${TAG}"
- "${PERCEPTION_LANE_DETECTION_IMAGE}:main"
target: deploy
image: "${PERCEPTION_LANE_DETECTION_IMAGE}:${TAG}"
command: /bin/bash -c "ros2 launch lane_detection lane_detection.launch.py"
# lane_detection:
# build:
# context: ..
# dockerfile: docker/perception/lane_detection/lane_detection.Dockerfile
# cache_from:
# - "${PERCEPTION_LANE_DETECTION_IMAGE}:${TAG}"
# - "${PERCEPTION_LANE_DETECTION_IMAGE}:main"
# target: deploy
# image: "${PERCEPTION_LANE_DETECTION_IMAGE}:${TAG}"
# command: /bin/bash -c "ros2 launch lane_detection lane_detection.launch.py"

tracking:
build:
context: ..
dockerfile: docker/perception/tracking/tracking.Dockerfile
cache_from:
- "${PERCEPTION_TRACKING_IMAGE}:${TAG}"
- "${PERCEPTION_TRACKING_IMAGE}:main"
target: deploy
image: "${PERCEPTION_TRACKING_IMAGE}:${TAG}"
command: /bin/bash -c "ros2 launch tracking tracking.launch.py"
# tracking:
# build:
# context: ..
# dockerfile: docker/perception/tracking/tracking.Dockerfile
# cache_from:
# - "${PERCEPTION_TRACKING_IMAGE}:${TAG}"
# - "${PERCEPTION_TRACKING_IMAGE}:main"
# target: deploy
# image: "${PERCEPTION_TRACKING_IMAGE}:${TAG}"
# command: /bin/bash -c "ros2 launch tracking tracking.launch.py"
4 changes: 0 additions & 4 deletions src/perception/lidar_object_detection/lidar_det_py/setup.cfg

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
def generate_launch_description():
return LaunchDescription([
Node(

Check failure on line 7 in src/perception/lidar_object_detection/lidar_object_detection/launch/3d_object_detector.py

View workflow job for this annotation

GitHub Actions / Autopep8

src/perception/lidar_object_detection/lidar_object_detection/launch/3d_object_detector.py#L1-L7

#!/usr/bin/env python3 from launch import LaunchDescription from launch_ros.actions import Node + def generate_launch_description(): return LaunchDescription([
package='lidar_det_py',
package='lidar_object_detection',
executable='inference',
name='inference',
output='screen',
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>lidar_det_py</name>
<name>lidar_object_detection</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<maintainer email="[email protected]">bolty</maintainer>
Expand Down
Loading

0 comments on commit 9f177c6

Please sign in to comment.