Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Before developing please read these documents.


## CAN Setup
If trying to stimulate robot using canable, you will need to set up the CAN interface.
If you are stimulating the robot using canable, you will need to set up the CAN interface.

Run the setup script:
```bash
Expand Down
15 changes: 15 additions & 0 deletions autonomy/perception/launch/perception.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,20 @@ def generate_launch_description():
remappings=[
# Add any topic remappings here if needed
]
),
Node(
package='realsense2_camera',
executable='realsense2_camera_node',
name='realsense_node',
output='screen',
parameters=[{
'depth_module.depth_profile': '640x480x30',
'pointcloud.enable': True,
'enable_rgbd': True,
'enable_sync': True,
'align_depth.enable': True,
'enable_color': True,
'enable_depth': True
}]
)
])
1 change: 0 additions & 1 deletion autonomy/perception/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<!-- <depend>sensor_msgs</depend>
<depend>geometry_msgs</depend>
<depend>std_msgs</depend>
<depend>cv_bridge</depend>
<depend>image_transport</depend> -->

<test_depend>ament_copyright</test_depend>
Expand Down
65 changes: 38 additions & 27 deletions docker/perception/perception.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,44 @@ ARG BASE_IMAGE=ghcr.io/watonomous/robot_base/base:humble-ubuntu22.04
################################ Source ################################
FROM ${BASE_IMAGE} AS source

ARG AMENT_WS=/root/ament_ws
WORKDIR ${AMENT_WS}/src

# Copy in source code
COPY autonomy/perception perception
COPY autonomy/wato_msgs/common_msgs wato_msgs/common_msgs

# Scan for rosdeps
# RUN apt-get -qq update
# RUN rosdep update
# RUN rosdep install --from-paths . --ignore-src -r -s \
# | grep 'apt-get install' \
# | awk '{print $3}' \
# | sort > /tmp/colcon_install_list
# Install rosdep if not present, update package lists
RUN apt-get update && \
apt-get install -y --no-install-recommends python3-rosdep && \
rm -rf /var/lib/apt/lists/*

RUN apt-get -qq update
# Update rosdep database (safe in containers)
RUN rosdep update
RUN echo "" > /tmp/colcon_install_list

# Generate dependency list (simulated install → extract apt packages)
RUN rosdep install \
--from-paths . \
--ignore-src \
--rosdistro $ROS_DISTRO \
-y \
--simulate | \
grep "apt-get install" | \
sed 's/apt-get install -y //' > /tmp/colcon_install_list || true

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

RUN apt-get update && \
apt-fast install -qq -y --no-install-recommends $(cat /tmp/colcon_install_list)

# 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/*

# Avoid interactive package prompts
ENV DEBIAN_FRONTEND=noninteractive \
TZ=Etc/UTC \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8

# Essential build & Python tooling
RUN apt-get update && \
apt-get install -y --no-install-recommends \
Expand All @@ -55,39 +56,49 @@ RUN apt-get update && \
ca-certificates \
gnupg2 \
libgl1-mesa-glx \
lsb-release && \
rm -rf /var/lib/apt/lists/*
lsb-release \
libssl-dev \
usbutils \
libusb-1.0-0-dev \
pkg-config \
libgtk-3-dev

RUN apt-get update && \
apt-get install -y --no-install-recommends \
ros-$ROS_DISTRO-librealsense2* \
ros-$ROS_DISTRO-realsense2-camera* && \
rm -rf /var/lib/apt/lists/*

RUN python3 -m pip install --upgrade pip

RUN python3 -m pip install --no-cache-dir \
pccm>=0.4.16 \
ccimport>=0.4.4 \
pybind11>=2.6.0 \
cv_bridge \
numpy \
fire \
cv_bridge \
opencv-python

# Install prebuilt spconv-cu120 (compatible with CUDA 12.2 due to minor version compatibility)
RUN python3 -m pip install --no-cache-dir spconv-cu120

# 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/*
rm -rf /root/.ros /tmp/* /var/lib/apt/lists/* /usr/share/doc/*

################################ Build ################################
FROM dependencies AS build
ARG AMENT_WS=/root/ament_ws
COPY --from=source ${AMENT_WS}/src ${AMENT_WS}/src

# Build ROS2 packages
WORKDIR ${AMENT_WS}

RUN . /opt/ros/$ROS_DISTRO/setup.sh && \
colcon build \
--cmake-args -DCMAKE_BUILD_TYPE=Release --install-base ${WATONOMOUS_INSTALL}
--cmake-args -DCMAKE_BUILD_TYPE=Release \
--install-base ${WATONOMOUS_INSTALL}

# Source and Build Artifact Cleanup
RUN rm -rf src/* build/* devel/* install/* log/*
RUN rm -rf build/* devel/* install/* log/*

# 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
Expand Down
11 changes: 9 additions & 2 deletions modules/docker-compose.perception.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@ services:
devices:
- driver: nvidia
capabilities: [gpu]
devices:
- /dev/bus/usb:/dev/bus/usb
privileged: true
volumes:
- ${MONO_DIR}/autonomy/perception:/root/ament_ws/src/perception
command: tail -F anything
command: /bin/bash -c "ros2 launch perception perception.launch.py"

perception_dev:
build: *perception_build
Expand All @@ -34,6 +37,10 @@ services:
- NVIDIA_VISIBLE_DEVICES=all
- NVIDIA_DRIVER_CAPABILITIES=compute,utility
profiles: [develop]
privileged: true
devices:
- /dev/bus/usb:/dev/bus/usb
volumes:
- ${MONO_DIR}/autonomy/perception:/root/ament_ws/src/perception
command: tail -F anything
command: /bin/bash -c "ros2 launch perception perception.launch.py"
# command: tail -f /dev/null
1 change: 0 additions & 1 deletion watod-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
## - infrastructure : starts visualization tools
## - interfacing : starts interfacing nodes
## - perception : starts perception nodes
## - controller : starts controller nodes
## - simulation : starts simulation
## - behaviour : starts behaviour nodes
## - samples : starts sample ROS2 pubsub nodes
Expand Down
Loading