diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..8848192 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +.vscode/* +html/* +build/* +install/* +log/* +LICENSE diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cf74634 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +# Use the official ROS 2 humble base image +ARG ROS_DISTRO=humble +FROM ros:${ROS_DISTRO} as deps + +# Set the working directory +WORKDIR /root/ros2_ws + +SHELL ["/bin/bash", "-c"] + +RUN source /opt/ros/${ROS_DISTRO}/setup.bash +RUN --mount=type=bind,source=package.xml,target=src/grid_map_geo/package.xml \ + apt update && \ + rosdep update && \ + rosdep install --from-paths src --ignore-src -y + +# Run a default command, e.g., starting a bash shell +CMD ["bash"] + +FROM deps as builder +ARG CMAKE_BUILD_TYPE=Release + +RUN source /opt/ros/${ROS_DISTRO}/setup.bash +COPY . . +RUN source /opt/ros/${ROS_DISTRO}/setup.bash && \ + colcon build --cmake-args -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} --packages-up-to grid_map_geo + +# Source the ROS2 setup file +RUN echo "source /root/ros2_ws/install/setup.bash" >> ~/.bashrc + +# Run a default command, e.g., starting a bash shell +CMD ["bash"] + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0491396 --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +.PHONY : docker_build +docker_build: + docker build -t gmg . + +.PHONY : docker_run +docker_run: + docker run -it --net=host --ipc=host --privileged --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" --volume="${XAUTHORITY}:/root/.Xauthority" --entrypoint /bin/bash gmg diff --git a/package.xml b/package.xml index 2654b18..70102a3 100644 --- a/package.xml +++ b/package.xml @@ -20,8 +20,10 @@ libgdal-dev rclcpp yaml_cpp_vendor - ros2launch + grid_map_rviz_plugin + ros2launch + rviz2 ament_cmake