diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 611df0f8..fa37bfe4 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,6 +2,10 @@ Changelog ========= +[unreleased] +============ +* fix: LaserScan is not properly aligned with generated point cloud + ouster_ros v0.12.0 ================== * [BREAKING]: updated ouster_client to the release of ``20231031`` [v0.10.0]; changes listed below. diff --git a/ouster-ros/package.xml b/ouster-ros/package.xml index 6609bf52..9b4f760b 100644 --- a/ouster-ros/package.xml +++ b/ouster-ros/package.xml @@ -2,7 +2,7 @@ ouster_ros - 0.12.0 + 0.12.1 Ouster ROS2 driver ouster developers BSD diff --git a/ouster-ros/src/os_ros.cpp b/ouster-ros/src/os_ros.cpp index 0af634f8..188a9acb 100644 --- a/ouster-ros/src/os_ros.cpp +++ b/ouster-ros/src/os_ros.cpp @@ -180,7 +180,8 @@ sensor_msgs::msg::LaserScan lidar_scan_to_laser_scan_msg( msg.intensities.resize(ls.w); for (auto v = 0; v < ls.w; ++v) { - auto v_shift = (ls.w / 2 - 1 - v - pixel_shift_by_row[ring]) % ls.w; + auto sign = v < ls.w / 2 ? -1 : +1; + auto v_shift = (ls.w / 2 - 1 - v + sign * pixel_shift_by_row[ring]) % ls.w; auto src_idx = ring * ls.w + v_shift; msg.ranges[v] = rg[src_idx] * ouster::sensor::range_unit; msg.intensities[v] = static_cast(sg[src_idx]);