diff --git a/.gitmodules b/.gitmodules index c5fc0a32..00572dc7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ [submodule "ouster-sdk"] path = ouster-ros/ouster-sdk url = https://github.com/ouster-lidar/ouster_example.git + ignore = untracked \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 7f13aae8..8df6e146 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,58 +1,69 @@ +# variable for distro name ARG ROS_DISTRO=rolling +# import image using distro name FROM ros:${ROS_DISTRO}-ros-core AS build-env + +# assign environment variables ENV DEBIAN_FRONTEND=noninteractive \ BUILD_HOME=/var/lib/build \ OUSTER_ROS_PATH=/opt/ros2_ws/src/ouster-ros +# install dependant packages RUN set -xue \ -# Turn off installing extra packages globally to slim down rosdep install -&& echo 'APT::Install-Recommends "0";' > /etc/apt/apt.conf.d/01norecommend \ -&& apt-get update \ -&& apt-get install -y \ - build-essential \ - cmake \ - fakeroot \ - dpkg-dev \ - debhelper \ - python3-rosdep \ - python3-rospkg \ - python3-bloom \ - python3-colcon-common-extensions + # Turn off installing extra packages globally to slim down rosdep install + && echo 'APT::Install-Recommends "0";' > /etc/apt/apt.conf.d/01norecommend \ + && apt-get update \ + && apt-get install -y \ + build-essential \ + cmake \ + fakeroot \ + dpkg-dev \ + debhelper \ + python3-rosdep \ + python3-rospkg \ + python3-bloom \ + python3-colcon-common-extensions # Set up non-root build user ARG BUILD_UID=1000 ARG BUILD_GID=${BUILD_UID} RUN set -xe \ -&& groupadd -o -g ${BUILD_GID} build \ -&& useradd -o -u ${BUILD_UID} -d ${BUILD_HOME} -rm -s /bin/bash -g build build + && groupadd -o -g ${BUILD_GID} build \ + && useradd -o -u ${BUILD_UID} -d ${BUILD_HOME} -rm -s /bin/bash -g build build # Set up build environment COPY --chown=build:build . $OUSTER_ROS_PATH -RUN set -xe \ -&& apt-get update \ -&& rosdep init \ -&& rosdep update --rosdistro=$ROS_DISTRO \ -&& rosdep install --from-paths $OUSTER_ROS_PATH -y --ignore-src +# rosdep install +RUN set -xe \ + && apt-get update \ + && rosdep init \ + && rosdep update --rosdistro=$ROS_DISTRO \ + && rosdep install --from-paths $OUSTER_ROS_PATH -y --ignore-src USER build:build WORKDIR ${BUILD_HOME} -RUN set -xe \ -&& mkdir src \ -&& cp -R $OUSTER_ROS_PATH ./src +# copy source files to src dir +RUN set -xe \ + && mkdir src \ + && cp -R $OUSTER_ROS_PATH ./src FROM build-env SHELL ["/bin/bash", "-c"] -RUN source /opt/ros/$ROS_DISTRO/setup.bash && colcon build \ - --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations" +RUN source /opt/ros/$ROS_DISTRO/setup.bash \ + && colcon build \ + --symlink-install \ + -executor sequential \ + --cmake-args \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_CXX_FLAGS="-Wno-deprecated-declarations" RUN source /opt/ros/$ROS_DISTRO/setup.bash && colcon test \ --ctest-args tests ouster_ros --rerun-failed --output-on-failure @@ -61,7 +72,7 @@ RUN source /opt/ros/$ROS_DISTRO/setup.bash && colcon test \ # # Usage: docker run --rm -it ouster-ros [sensor.launch parameters ..] # -ENTRYPOINT ["bash", "-c", "set -e \ -&& source ./install/setup.bash \ -&& ros2 launch ouster_ros sensor.launch.xml \"$@\" \ -", "ros-entrypoint"] +ENTRYPOINT ["bash", "-c", "set -e \ + && source ./install/setup.bash \ + && ros2 launch ouster_ros sensor.launch.xml \"$@\" \ + ", "ros-entrypoint"] \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 00000000..485f17e9 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,33 @@ +version: '3.8' + +services: + + freya-lidar: + # os1-122007000043 + container_name: ouster-lidar-freya + image: ghcr.io/vortexntnu/ouster-lidar-ros2-driver-humble:2023-10-09 + ports: + - 7502:7502/udp # lidar output port + entrypoint: ["bash", "-c", "set -e \ + && source ./install/setup.bash \ + && ros2 launch ouster_ros sensor.launch.xml \ + sensor_hostname:=169.254.154.82 \ + lidar_port:=7502 \ + viz:=false + ", "ros-entrypoint"] + + + + test-lidar: + # os1-122007000043 + container_name: ouster-lidar-test + image: ghcr.io/vortexntnu/ouster-lidar-ros2-driver-humble:2023-10-09 + ports: + - 7502:7502/udp # lidar output port + entrypoint: ["bash", "-c", "set -e \ + && source ./install/setup.bash \ + && ros2 launch ouster_ros sensor.launch.xml \ + sensor_hostname:=10.0.0.122 \ + lidar_port:=7502 \ + viz:=false + ", "ros-entrypoint"] diff --git a/ouster-ros/package.xml b/ouster-ros/package.xml index e7af89db..a8759d09 100644 --- a/ouster-ros/package.xml +++ b/ouster-ros/package.xml @@ -21,7 +21,7 @@ pcl_ros pcl_conversions std_srvs - libglfw3-dev + libglfw3-dev libjsoncpp-dev eigen