Skip to content

Commit cd157e2

Browse files
authored
Enable packing w/o padding for pointclouds (#493)
Signed-off-by: Maksim Derbasov <[email protected]>
1 parent ecb2681 commit cd157e2

File tree

5 files changed

+7
-20
lines changed

5 files changed

+7
-20
lines changed

src/DepthCameraSensor.cc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -439,14 +439,10 @@ bool DepthCameraSensor::CreateCamera()
439439
std::placeholders::_4, std::placeholders::_5));
440440

441441
// Initialize the point message.
442-
// \todo(anyone) The true value in the following function call forces
443-
// the xyz and rgb fields to be aligned to memory boundaries. This is need
444-
// by ROS1: https://github.com/ros/common_msgs/pull/77. Ideally, memory
445-
// alignment should be configured.
446442
msgs::InitPointCloudPacked(
447443
this->dataPtr->pointMsg,
448444
this->OpticalFrameId(),
449-
true,
445+
false,
450446
{{"xyz", msgs::PointCloudPacked::Field::FLOAT32},
451447
{"rgb", msgs::PointCloudPacked::Field::FLOAT32}});
452448

src/GpuLidarSensor.cc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,7 @@ bool GpuLidarSensor::Load(const sdf::Sensor &_sdf)
129129
}
130130

131131
// Initialize the point message.
132-
// \todo(anyone) The true value in the following function call forces
133-
// the xyz and rgb fields to be aligned to memory boundaries. This is need
134-
// by ROS1: https://github.com/ros/common_msgs/pull/77. Ideally, memory
135-
// alignment should be configured. This same problem is in the
136-
// RgbdCameraSensor.
137-
msgs::InitPointCloudPacked(this->dataPtr->pointMsg, this->FrameId(), true,
132+
msgs::InitPointCloudPacked(this->dataPtr->pointMsg, this->FrameId(), false,
138133
{{"xyz", msgs::PointCloudPacked::Field::FLOAT32},
139134
{"intensity", msgs::PointCloudPacked::Field::FLOAT32},
140135
{"ring", msgs::PointCloudPacked::Field::UINT16}});

src/RgbdCameraSensor.cc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -395,12 +395,8 @@ bool RgbdCameraSensor::CreateCameras()
395395
std::placeholders::_4, std::placeholders::_5));
396396

397397
// Initialize the point message.
398-
// \todo(anyone) The true value in the following function call forces
399-
// the xyz and rgb fields to be aligned to memory boundaries. This is need
400-
// by ROS1: https://github.com/ros/common_msgs/pull/77. Ideally, memory
401-
// alignment should be configured.
402398
msgs::InitPointCloudPacked(this->dataPtr->pointMsg, this->OpticalFrameId(),
403-
true,
399+
false,
404400
{{"xyz", msgs::PointCloudPacked::Field::FLOAT32},
405401
{"rgb", msgs::PointCloudPacked::Field::FLOAT32}});
406402

test/integration/gpu_lidar_sensor.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -431,10 +431,10 @@ void GpuLidarSensorTest::DetectBox(const std::string &_renderEngine)
431431
EXPECT_EQ(static_cast<uint32_t>(vertSamples), pointMsgs.back().height());
432432
EXPECT_EQ(static_cast<uint32_t>(horzSamples), pointMsgs.back().width());
433433
EXPECT_FALSE(pointMsgs.back().is_bigendian());
434-
EXPECT_EQ(32u, pointMsgs.back().point_step());
435-
EXPECT_EQ(32u * horzSamples, pointMsgs.back().row_step());
434+
EXPECT_EQ(18u, pointMsgs.back().point_step());
435+
EXPECT_EQ(18u * horzSamples, pointMsgs.back().row_step());
436436
EXPECT_FALSE(pointMsgs.back().is_dense());
437-
EXPECT_EQ(32u * horzSamples * vertSamples, pointMsgs.back().data().size());
437+
EXPECT_EQ(18u * horzSamples * vertSamples, pointMsgs.back().data().size());
438438

439439
EXPECT_TRUE(pointMsgs.back().has_header());
440440
EXPECT_LT(1, pointMsgs.back().header().data().size());

test/integration/rgbd_camera.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ void RgbdCameraSensorTest::ImagesWithBuiltinSDF(
475475
{
476476
// init the point cloud msg to be filled
477477
msgs::PointCloudPacked pointsMsg;
478-
msgs::InitPointCloudPacked(pointsMsg, "depth2Image", true,
478+
msgs::InitPointCloudPacked(pointsMsg, "depth2Image", false,
479479
{{"xyz", msgs::PointCloudPacked::Field::FLOAT32},
480480
{"rgb", msgs::PointCloudPacked::Field::FLOAT32}});
481481
pointsMsg.set_width(rgbdSensor->ImageWidth());

0 commit comments

Comments
 (0)