Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable packing w/o padding for PointCloudMsgs #493

Open
wants to merge 1 commit into
base: gz-sensors9
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/DepthCameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -439,14 +439,10 @@ bool DepthCameraSensor::CreateCamera()
std::placeholders::_4, std::placeholders::_5));

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

Expand Down
7 changes: 1 addition & 6 deletions src/GpuLidarSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,7 @@ bool GpuLidarSensor::Load(const sdf::Sensor &_sdf)
}

// Initialize the point message.
// \todo(anyone) The true value in the following function call forces
// the xyz and rgb fields to be aligned to memory boundaries. This is need
// by ROS1: https://github.com/ros/common_msgs/pull/77. Ideally, memory
// alignment should be configured. This same problem is in the
// RgbdCameraSensor.
msgs::InitPointCloudPacked(this->dataPtr->pointMsg, this->FrameId(), true,
msgs::InitPointCloudPacked(this->dataPtr->pointMsg, this->FrameId(), false,
{{"xyz", msgs::PointCloudPacked::Field::FLOAT32},
{"intensity", msgs::PointCloudPacked::Field::FLOAT32},
{"ring", msgs::PointCloudPacked::Field::UINT16}});
Expand Down
6 changes: 1 addition & 5 deletions src/RgbdCameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -395,12 +395,8 @@ bool RgbdCameraSensor::CreateCameras()
std::placeholders::_4, std::placeholders::_5));

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

Expand Down
6 changes: 3 additions & 3 deletions test/integration/gpu_lidar_sensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -431,10 +431,10 @@ void GpuLidarSensorTest::DetectBox(const std::string &_renderEngine)
EXPECT_EQ(static_cast<uint32_t>(vertSamples), pointMsgs.back().height());
EXPECT_EQ(static_cast<uint32_t>(horzSamples), pointMsgs.back().width());
EXPECT_FALSE(pointMsgs.back().is_bigendian());
EXPECT_EQ(32u, pointMsgs.back().point_step());
EXPECT_EQ(32u * horzSamples, pointMsgs.back().row_step());
EXPECT_EQ(18u, pointMsgs.back().point_step());
EXPECT_EQ(18u * horzSamples, pointMsgs.back().row_step());
EXPECT_FALSE(pointMsgs.back().is_dense());
EXPECT_EQ(32u * horzSamples * vertSamples, pointMsgs.back().data().size());
EXPECT_EQ(18u * horzSamples * vertSamples, pointMsgs.back().data().size());

EXPECT_TRUE(pointMsgs.back().has_header());
EXPECT_LT(1, pointMsgs.back().header().data().size());
Expand Down
2 changes: 1 addition & 1 deletion test/integration/rgbd_camera.cc
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ void RgbdCameraSensorTest::ImagesWithBuiltinSDF(
{
// init the point cloud msg to be filled
msgs::PointCloudPacked pointsMsg;
msgs::InitPointCloudPacked(pointsMsg, "depth2Image", true,
msgs::InitPointCloudPacked(pointsMsg, "depth2Image", false,
{{"xyz", msgs::PointCloudPacked::Field::FLOAT32},
{"rgb", msgs::PointCloudPacked::Field::FLOAT32}});
pointsMsg.set_width(rgbdSensor->ImageWidth());
Expand Down
Loading