Skip to content

Commit

Permalink
Update for fw 2.1. See changelog for details. (ouster-lidar#259)
Browse files Browse the repository at this point in the history
* Add support for the new signal_multiplier config parameter
* Add support for the new 8-bit reflectivity format in simple_viz
* Update Python ouster-sdk package to version 0.2.1, bugfix release
* Remove viz_node and graphics packages from ROS build dependencies
* Ensure ouster_ros dependencies can be satisfied using rosdep
* Various improvements to the ROS img node output
  • Loading branch information
dmitrig authored and Tobias Holmer committed Dec 26, 2023
1 parent 4abd514 commit 752e78f
Show file tree
Hide file tree
Showing 9 changed files with 232 additions and 228 deletions.
26 changes: 9 additions & 17 deletions drivers/ouster-ros/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,19 @@ project(ouster_ros)

# ==== Requirements ====
find_package(Eigen3 REQUIRED)
find_package(GLEW REQUIRED)
find_package(glfw3 REQUIRED)
find_package(PCL REQUIRED COMPONENTS common)
find_package(tf2_eigen REQUIRED)

find_package(
catkin REQUIRED
COMPONENTS message_generation
std_msgs
sensor_msgs
geometry_msgs
pcl_ros
pcl_conversions
roscpp
tf2
tf2_ros
tf2_geometry_msgs)
tf2_ros)

# ==== Options ====
set(CMAKE_CXX_STANDARD 14)
Expand All @@ -35,7 +33,7 @@ add_service_files(FILES OSConfigSrv.srv)
generate_messages(DEPENDENCIES std_msgs sensor_msgs geometry_msgs)

set(_ouster_ros_INCLUDE_DIRS
"include;../ouster_client/include;../ouster_client/include/optional-lite;../ouster_viz/include")
"include;../ouster_client/include;../ouster_client/include/optional-lite")

catkin_package(
INCLUDE_DIRS
Expand All @@ -45,12 +43,11 @@ catkin_package(
CATKIN_DEPENDS
roscpp
message_runtime
pcl_ros
std_msgs
sensor_msgs
geometry_msgs
DEPENDS
EIGEN3 GLFW3 GLEW)
EIGEN3)

# ==== Libraries ====
# Build static libraries and bundle them into ouster_ros using the `--whole-archive` flag. This is
Expand All @@ -59,15 +56,14 @@ catkin_package(
set(_SAVE_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS OFF)
add_subdirectory(../ouster_client ouster_client EXCLUDE_FROM_ALL)
add_subdirectory(../ouster_viz ouster_viz EXCLUDE_FROM_ALL)
set(BUILD_SHARED_LIBS ${_SAVE_BUILD_SHARED_LIBS})

# catkin adds all include dirs to a single variable, don't try to use targets
include_directories(${_ouster_ros_INCLUDE_DIRS} SYSTEM ${catkin_INCLUDE_DIRS})
include_directories(${_ouster_ros_INCLUDE_DIRS} ${catkin_INCLUDE_DIRS})

add_library(ouster_ros src/ros.cpp)
target_link_libraries(ouster_ros PUBLIC ${catkin_LIBRARIES} ouster_build PRIVATE
-Wl,--whole-archive ouster_client ouster_viz -Wl,--no-whole-archive)
target_link_libraries(ouster_ros PUBLIC ${catkin_LIBRARIES} ouster_build pcl_common PRIVATE
-Wl,--whole-archive ouster_client -Wl,--no-whole-archive)
add_dependencies(ouster_ros ${PROJECT_NAME}_gencpp)

# ==== Executables ====
Expand All @@ -79,17 +75,13 @@ add_executable(os_cloud_node src/os_cloud_node.cpp)
target_link_libraries(os_cloud_node ouster_ros ${catkin_LIBRARIES})
add_dependencies(os_cloud_node ${PROJECT_NAME}_gencpp)

add_executable(viz_node src/viz_node.cpp)
target_link_libraries(viz_node ouster_ros ${catkin_LIBRARIES} glfw GLEW)
add_dependencies(viz_node ${PROJECT_NAME}_gencpp)

add_executable(img_node src/img_node.cpp)
target_link_libraries(img_node ouster_ros ${catkin_LIBRARIES})
add_dependencies(img_node ${PROJECT_NAME}_gencpp)

# ==== Install ====
install(
TARGETS ouster_ros os_node os_cloud_node viz_node img_node
TARGETS ouster_ros os_node os_cloud_node img_node
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
Expand Down
61 changes: 61 additions & 0 deletions drivers/ouster-ros/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
ARG ROS_DISTRO=melodic

FROM ros:${ROS_DISTRO}-ros-core AS build-env
ENV DEBIAN_FRONTEND=noninteractive \
BUILD_HOME=/var/lib/build \
OUSTER_SDK_PATH=/opt/ouster_example

RUN set -xue \
# Kinetic and melodic have python3 packages but they seem to conflict
&& [ $ROS_DISTRO = "noetic" ] && PY=python3 || PY=python \
# 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 \
$PY-rosdep $PY-rospkg $PY-bloom

# 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

# Install build dependencies using rosdep
COPY --chown=build:build ouster_ros/package.xml ${OUSTER_SDK_PATH}/ouster_ros/package.xml

RUN set -xe \
&& apt-get update \
&& rosdep init \
&& rosdep update --rosdistro=${ROS_DISTRO} \
&& rosdep install -y --from-paths ${OUSTER_SDK_PATH}

# Set up build environment
COPY --chown=build:build cmake ${OUSTER_SDK_PATH}/cmake
COPY --chown=build:build ouster_client ${OUSTER_SDK_PATH}/ouster_client
COPY --chown=build:build ouster_viz ${OUSTER_SDK_PATH}/ouster_viz
COPY --chown=build:build ouster_ros ${OUSTER_SDK_PATH}/ouster_ros

USER build:build
WORKDIR ${BUILD_HOME}

RUN set -xe \
&& mkdir src \
&& ln -s ${OUSTER_SDK_PATH} ./src


FROM build-env

RUN /opt/ros/${ROS_DISTRO}/env.sh catkin_make -DCMAKE_BUILD_TYPE=Release

# Entrypoint for running Ouster ros:
#
# Usage: docker run --rm -it ouster-ros [ouster.launch parameters ..]
#
ENTRYPOINT ["bash", "-c", "set -e \
&& . ./devel/setup.bash \
&& roslaunch ouster_ros ouster.launch \"$@\" \
", "ros-entrypoint"]
12 changes: 4 additions & 8 deletions drivers/ouster-ros/ouster.launch
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<arg name="lidar_mode" default="" doc="resolution and rate: either 512x10, 512x20, 1024x10, 1024x20, or 2048x10"/>
<arg name="timestamp_mode" default="" doc="method used to timestamp measurements: TIME_FROM_INTERNAL_OSC, TIME_FROM_SYNC_PULSE_IN, TIME_FROM_PTP_1588"/>
<arg name="metadata" default="" doc="override default metadata file for replays"/>
<arg name="viz" default="false" doc="whether to run a simple visualizer"/>
<arg name="image" default="false" doc="publish range/intensity/ambient image topic"/>
<arg name="viz" default="false" doc="whether to run a rviz"/>
<arg name="rviz_config" default="-d $(find ouster_ros)/viz.rviz" doc="optional rviz config file"/>
<arg name="tf_prefix" default="" doc="namespace for tf transforms"/>

<node pkg="ouster_ros" name="os_node" type="os_node" output="screen" required="true">
Expand All @@ -30,12 +30,8 @@
<param name="~/tf_prefix" value="$(arg tf_prefix)"/>
</node>

<node if="$(arg viz)" pkg="ouster_ros" name="viz_node" type="viz_node" output="screen" required="true">
<remap from="~/os_config" to="/os_node/os_config"/>
<remap from="~/lidar_packets" to="/os_node/lidar_packets"/>
</node>

<node if="$(arg image)" pkg="ouster_ros" name="img_node" type="img_node" output="screen" required="true">
<node if="$(arg viz)" pkg="rviz" name="rviz" type="rviz" args="$(arg rviz_config)" output="screen" required="true" />
<node if="$(arg viz)" pkg="ouster_ros" name="img_node" type="img_node" output="screen" required="true">
<remap from="~/os_config" to="/os_node/os_config"/>
<remap from="~/points" to="/os_cloud_node/points"/>
</node>
Expand Down
13 changes: 5 additions & 8 deletions drivers/ouster-ros/package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package format="2">
<name>ouster_ros</name>
<version>0.1.0</version>
<version>0.2.0</version>
<description>Ouster example ROS client</description>
<maintainer email="[email protected]">ouster developers</maintainer>
<license>BSD</license>
Expand All @@ -11,17 +11,14 @@
<depend>std_msgs</depend>
<depend>sensor_msgs</depend>
<depend>geometry_msgs</depend>
<depend>pcl_ros</depend>
<depend>pcl_conversions</depend>
<depend>tf2_ros</depend>

<build_depend>libjsoncpp-dev</build_depend>
<build_depend>eigen</build_depend>
<build_depend>message_generation</build_depend>
<build_depend>tf2</build_depend>
<build_depend>tf2_ros</build_depend>
<build_depend>tf2_geometry_msgs</build_depend>
<build_depend>libglew-dev</build_depend>
<build_depend>libglfw3-dev</build_depend>
<build_depend>tf2_eigen</build_depend>
<build_depend>libpcl-all-dev</build_depend>
<build_depend>pcl_conversions</build_depend>
<build_depend>libtclap-dev</build_depend>

<exec_depend>libjsoncpp</exec_depend>
Expand Down
Loading

0 comments on commit 752e78f

Please sign in to comment.