Skip to content

Commit

Permalink
Merge pull request #138 from UOA-FSAE/cone_detection_test
Browse files Browse the repository at this point in the history
Cone detection test
  • Loading branch information
Tanish29 authored Sep 24, 2024
2 parents 47bd0de + 9fdde25 commit 608778f
Show file tree
Hide file tree
Showing 139 changed files with 3,444 additions and 862 deletions.
9 changes: 5 additions & 4 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
context: ..
dockerfile: .devcontainer/ros2_ws.Dockerfile
environment:
- DISPLAY
- DISPLAY=host.docker.internal
- NVIDIA_VISIBLE_DEVICES=all
- NVIDIA_DRIVER_CAPABILITIES=all
- ROS_DOMAIN_ID=47
Expand Down Expand Up @@ -35,25 +35,26 @@ services:
context: ..
dockerfile: .devcontainer/zed.Dockerfile
environment:
- DISPLAY
- DISPLAY=host.docker.internal
- NVIDIA_VISIBLE_DEVICES=all
- NVIDIA_DRIVER_CAPABILITIES=all
- ROS_DOMAIN_ID=47
volumes:
- ../bringup:/ws/bringup
- ../src/perception/:/ws/src/perception/
- ../src/visualization/:/ws/src/visualization/
- ../src/moa/moa_description:/ws/src/moa/moa_description
- ../src/moa/moa_msgs:/ws/src/moa/moa_msgs
- ../ros_entrypoint.sh:/ws/ros_entrypoint.sh
- /tmp/.X11-unix:/tmp/.X11-unix
- /dev:/dev

command: bash -c ". /ws/ros_entrypoint.sh && ros2 launch zed_wrapper zed_camera.launch.py camera_model:='zed2i'"
network_mode: host
ipc: host
stdin_open: true
tty: true
runtime: nvidia
# runtime: nvidia
deploy:
resources:
reservations:
Expand Down
69 changes: 54 additions & 15 deletions .devcontainer/ros2_ws.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,73 @@
FROM osrf/ros:humble-desktop
FROM nvcr.io/nvidia/l4t-base:35.4.1
LABEL Name=autonomous Version=0.0.1

SHELL [ "/bin/bash", "-c" ]

WORKDIR /ws

RUN apt-get update && apt-get install --no-install-recommends -y \
python3-pip \
ros-humble-foxglove-bridge && \
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libopenblas-dev \
libopenmpi-dev \
openmpi-bin \
openmpi-common \
gfortran \
libomp-dev \
nvidia-cuda-dev \
nvidia-cudnn8-dev && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean

RUN apt update && apt install locales && \
locale-gen en_US en_US.UTF-8 && \
update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8

RUN apt update && apt install -y gnupg wget software-properties-common && \
add-apt-repository universe

RUN wget -qO - https://isaac.download.nvidia.com/isaac-ros/repos.key | \
apt-key add - && \
echo 'deb https://isaac.download.nvidia.com/isaac-ros/ubuntu/main focal main' | \
tee -a "/etc/apt/sources.list"

RUN apt update && apt install curl -y && \
curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu focal main" | \
tee /etc/apt/sources.list.d/ros2.list > /dev/null

ENV ROS_DISTRO humble

RUN apt update && apt install --no-install-recommends -y \
ros-humble-ros-base \
ros-dev-tools \
build-essential \
python3-colcon-common-extensions \
python3-colcon-mixin \
python3-rosdep \
python3-vcstool \
python3-pip \
ros-humble-foxglove-bridge && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean && \
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc

COPY . .

RUN source /opt/ros/humble/setup.bash && \
rosdep update --rosdistro $ROS_DISTRO && apt-get update && \
RUN rosdep init && rosdep update --rosdistro $ROS_DISTRO && apt-get update && \
cd /ws && \
rosdep install --from-paths src -y -r --ignore-src --rosdistro=$ROS_DISTRO --os=ubuntu:jammy && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean
rm -rf /var/lib/apt/lists/*

ENV PYTORCH_URL=https://developer.download.nvidia.com/compute/redist/jp/v512/pytorch/torch-2.1.0a0+41361538.nv23.06-cp38-cp38-linux_aarch64.whl PYTORCH_WHL=torch-2.1.0a0+41361538.nv23.06-cp38-cp38-linux_aarch64.whl

RUN cd /opt && \
wget --quiet --show-progress --progress=bar:force:noscroll --no-check-certificate ${PYTORCH_URL} -O ${PYTORCH_WHL} && \
pip3 install --verbose ${PYTORCH_WHL}

RUN python3 -c 'import torch; print(f"PyTorch version: {torch.__version__}"); print(f"CUDA available: {torch.cuda.is_available()}"); print(f"cuDNN version: {torch.backends.cudnn.version()}"); print(torch.__config__.show());'

RUN source /opt/ros/humble/setup.bash && \
colcon build --parallel-workers $(nproc) --symlink-install \
--event-handlers console_direct+ --base-paths src \
--cmake-args ' -DCMAKE_BUILD_TYPE=Release' \
' -DCMAKE_LIBRARY_PATH=/usr/local/cuda/lib64/stubs' \
' -DCMAKE_CXX_FLAGS="-Wl,--allow-shlib-undefined"'

RUN echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc && \
echo "source /ws/install/setup.bash" >> ~/.bashrc
--event-handlers console_direct+ --base-paths src

CMD [ "bash" ]
110 changes: 71 additions & 39 deletions .devcontainer/zed.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,46 @@
FROM stereolabs/zed:4.1-devel-cuda12.1-ubuntu22.04
FROM stereolabs/zed:4.1-tools-devel-l4t-r35.4
LABEL Name=zed_sdk Version=0.0.1

SHELL [ "/bin/bash", "-c" ]
SHELL [ "/bin/bash", "-c"]

SHELL [ "/bin/bash", "-c"]


WORKDIR /ws

# setup sources.list and keys
RUN echo "deb http://packages.ros.org/ros2/ubuntu jammy main" > /etc/apt/sources.list.d/ros2-latest.list && \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8

RUN apt update && apt install -y gnupg wget software-properties-common && \
add-apt-repository universe

RUN wget -qO - https://isaac.download.nvidia.com/isaac-ros/repos.key | \
apt-key add - && \
echo 'deb https://isaac.download.nvidia.com/isaac-ros/ubuntu/main focal main' | \
tee -a "/etc/apt/sources.list"

RUN apt update && apt install curl -y && \
curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu focal main" | \
tee /etc/apt/sources.list.d/ros2.list > /dev/null

# setup timezone & install packages
RUN apt-get update && apt-get install -q -y --no-install-recommends \
RUN apt-get update
RUN sudo apt-get upgrade -y
RUN apt-get update


RUN sudo apt-get install ros-humble-desktop -y

RUN apt-get install -q -y --no-install-recommends \
RUN apt-get update
RUN sudo apt-get upgrade -y
RUN apt-get update


RUN sudo apt-get install ros-humble-desktop -y

RUN apt-get install -q -y --no-install-recommends \
tzdata \
dirmngr \
gnupg2 \
Expand All @@ -20,56 +50,58 @@ RUN apt-get update && apt-get install -q -y --no-install-recommends \
python3-colcon-common-extensions \
python3-colcon-mixin \
python3-rosdep \
python3-vcstool && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean
python3-vcstool
RUN rm -rf /var/lib/apt/lists/*
RUN apt-get clean

# setup environment
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV ROS_DISTRO humble

ENV ROS_DISTRO humble
# install ros2 packages
RUN cd /ws/src/
RUN git clone --recursive https://github.com/stereolabs/zed-ros2-wrapper.git

# setup colcon mixin and metadata
RUN rosdep init && \
rosdep update --rosdistro $ROS_DISTRO && \
colcon mixin add default \
https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml && \
colcon mixin update && \
colcon metadata add default \
https://raw.githubusercontent.com/colcon/colcon-metadata-repository/master/index.yaml && \
colcon metadata update

COPY ./src/perception/ /ws/src/perception/
COPY ./src/moa/moa_description /ws/src/moa/moa_description
COPY ./src/moa/moa_msgs /ws/src/moa/moa_msgs
RUN rosdep init
RUN rosdep update --rosdistro $ROS_DISTRO
RUN colcon mixin add default \
https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml
RUN colcon mixin update
RUN colcon metadata add default \
https://raw.githubusercontent.com/colcon/colcon-metadata-repository/master/index.yaml
RUN colcon metadata update

# install ros2 packages
RUN cd /ws/src/ && \
RUN mkdir src && \
cd /ws/src/ && \
git clone --recursive https://github.com/stereolabs/zed-ros2-wrapper.git && \
cd .. && \
source /opt/ros/humble/setup.bash && \
apt-get update && rosdep update && \
rosdep install --from-paths src --ignore-src -r -y && \
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc && \
rosdep update && \
apt-get update && \
rosdep install --from-paths src -y -r --ignore-src --rosdistro=$ROS_DISTRO --os=ubuntu:jammy --skip-keys="point_cloud_transport_plugins draco_point_cloud_transport" || true && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean

RUN cd /usr/local/zed && \
pip install requests && \
python3 get_python_api.py \
pip3 install ultralytics \
pip3 install torch \
pip3 install pyopengl \
pip3 install pyzed

RUN source /opt/ros/humble/setup.bash && \
pip install requests
# python3 get_python_api.py \
# pip3 install ultralytics \
# pip3 install torch \
# pip3 install pyopengl \
# pip3 install pyzed

RUN source /opt/ros/humble/setup.bash && \
colcon build --parallel-workers $(nproc) --symlink-install \
--event-handlers console_direct+ --base-paths src \
--cmake-args ' -DCMAKE_BUILD_TYPE=Release' \
' -DCMAKE_LIBRARY_PATH=/usr/local/cuda/lib64/stubs' \
' -DCMAKE_CXX_FLAGS="-Wl,--allow-shlib-undefined"'
' -DCMAKE_CXX_FLAGS="-Wl,--allow-shlib-undefined"' || true

RUN echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc && \
echo "source /ws/install/setup.bash" >> ~/.bashrc

RUN . ~/.bashrc

RUN echo "source /ws/install/setup.bash" >> ~/.bashrc
COPY ./.devcontainer/SN31421864.conf /usr/local/zed/settings/SN31421864.conf

CMD ["bash"]
28 changes: 13 additions & 15 deletions .docker_templates/zed.Jetson.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM stereolabs/zed:4.0-tools-devel-l4t-r35.4
FROM stereolabs/zed:4.1-tools-devel-l4t-r35.4
LABEL Name=zed_sdk Version=0.0.1

SHELL [ "/bin/bash", "-c" ]
Expand Down Expand Up @@ -48,34 +48,32 @@ RUN rosdep init && \
https://raw.githubusercontent.com/colcon/colcon-metadata-repository/master/index.yaml && \
colcon metadata update

COPY ./src/perception/ /ws/src/perception/
COPY ./src/moa/moa_description /ws/src/moa/moa_description
COPY ./src/moa/moa_msgs /ws/src/moa/moa_msgs

# install ros2 packages
RUN cd /ws/src/ && \
RUN mkdir src && \
cd /ws/src/ && \
git clone --recursive https://github.com/stereolabs/zed-ros2-wrapper.git && \
cd .. && \
source /opt/ros/humble/setup.bash && \
rosdep update && apt-get update && \
rosdep install --from-paths src -y -r --ignore-src --rosdistro=$ROS_DISTRO --os=ubuntu:jammy && \
rosdep update && \
apt-get update && \
rosdep install --from-paths src -y -r --ignore-src --rosdistro=$ROS_DISTRO --os=ubuntu:jammy --skip-keys="point_cloud_transport_plugins draco_point_cloud_transport" || true && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean

RUN cd /usr/local/zed && \
pip install requests && \
python3 get_python_api.py \
pip3 install ultralytics \
pip3 install torch \
pip3 install pyopengl \
pip3 install pyzed
pip install requests
# python3 get_python_api.py \
# pip3 install ultralytics \
# pip3 install torch \
# pip3 install pyopengl \
# pip3 install pyzed

RUN source /opt/ros/humble/setup.bash && \
colcon build --parallel-workers $(nproc) --symlink-install \
--event-handlers console_direct+ --base-paths src \
--cmake-args ' -DCMAKE_BUILD_TYPE=Release' \
' -DCMAKE_LIBRARY_PATH=/usr/local/cuda/lib64/stubs' \
' -DCMAKE_CXX_FLAGS="-Wl,--allow-shlib-undefined"'
' -DCMAKE_CXX_FLAGS="-Wl,--allow-shlib-undefined"' || true

RUN echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc && \
echo "source /ws/install/setup.bash" >> ~/.bashrc
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ kaggle.json
.devcontainer/zed.Dockerfile
.devcontainer/ros2_ws.Dockerfile
.vscode/settings.json
.gitignore
.vscode/c_cpp_properties.json
**/__pycache__/
*.msg
*.srv
wandb/
*.engine
*.onnx
*.svo2
*.pt
2 changes: 2 additions & 0 deletions bringup/main_system_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,5 @@ def generate_launch_description():
),

])

# TO DO: add correct nodes to the launch file
2 changes: 2 additions & 0 deletions bringup/visualization_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ def generate_launch_description():
),

])

# TO DO: Add the visualization nodes to the launch file
Loading

0 comments on commit 608778f

Please sign in to comment.