Skip to content

Commit

Permalink
Merge pull request #12 from DeepX-inc/port_nopadding
Browse files Browse the repository at this point in the history
Enable packing w/o padding for pointclouds (gazebosim#493)
  • Loading branch information
mderbaso-deepx authored Jan 29, 2025
2 parents b2d95f7 + e43e5b6 commit 8efd81b
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 47 deletions.
47 changes: 23 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,19 @@ FROM ghcr.io/deepx-inc/base_images:humble
# ---BUILD TOOLS---
RUN apt-get -qq update \
&& apt-get -qq install -y --no-install-recommends \
cmake=3.22.* \
ffmpeg=7:4.4.* \
freeglut3-dev=2.8.* \
g++-10=10.4.* \
git=1:2.34.* \
gnupg=2.2.* \
cmake \
ffmpeg \
freeglut3-dev \
g++ \
git \
gnupg \
libfreeimage-dev=3.18.* \
libglew-dev=2.2.* \
libogre-next-dev=2.2.* \
libxi-dev=2:1.* \
libxmu-dev=2:1.* \
ninja-build=1.10.* \
pkg-config=0.29.* \
redis-server=5:6.0.* \
redis-tools=5:6.0.* \
software-properties-common=0.99.22.* \
lsb-release=11.1.* \
wget=1.21.* \
Expand All @@ -39,23 +37,22 @@ RUN apt-get -qq update && \
wget http://packages.osrfoundation.org/gazebo.key -O - | apt-key add - && \
add-apt-repository ppa:kisak/kisak-mesa && \
curl -sSL http://get.gazebosim.org | sh && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 800 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10 && \
apt-get -qq update && \
apt-get -qq upgrade -y --no-install-recommends \
libgz-cmake3-dev=3.2.* \
libgz-common5-dev=5.4.* \
libgz-fuel-tools8-dev=8.0.* \
libgz-gui7-dev=7.2.* \
libgz-launch6-dev=6.0.* \
libgz-math7-dev=7.1.* \
libgz-msgs9-dev=9.4.* \
libgz-physics6-dev=6.4.* \
libgz-plugin2-dev=2.0.* \
libgz-sim7-dev=7.5.* \
libgz-tools2-dev=2.0.* \
libgz-transport12-dev=12.2.* \
libgz-utils2-dev=2.0.* \
libsdformat13=13.5.* \
libgz-cmake3-dev \
libgz-common5-dev \
libgz-fuel-tools8-dev \
libgz-gui7-dev \
libgz-launch6-dev \
libgz-math7-dev \
libgz-msgs9-dev \
libgz-physics6-dev \
libgz-plugin2-dev \
libgz-sim7-dev \
libgz-tools2-dev \
libgz-transport12-dev \
libgz-utils2-dev \
libsdformat13 \
&& apt-get -qq -y autoclean \
&& apt-get -qq -y autoremove \
&& rm -rf /var/lib/apt/lists/*
Expand All @@ -69,4 +66,6 @@ RUN git clone -b gz-rendering7 --single-branch https://github.com/DeepX-inc/gz-r
# ---PREPARE GZ-SENSORS DIRECTORY---
COPY . gz-sensors/

RUN mkdir -p gz-sensors/build
RUN mkdir -p gz-rendering/build && cd gz-rendering/build && cmake .. && make -j4 && make install

RUN mkdir -p gz-sensors/build && cd gz-sensors/build && cmake .. && make -j4
7 changes: 1 addition & 6 deletions src/DepthCameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,7 @@ bool DepthCameraSensor::Load(const sdf::Sensor &_sdf)
gzdbg << "Points for [" << this->Name() << "] advertised on ["
<< this->Topic() << "/points]" << std::endl;

// 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->Name(), true,
msgs::InitPointCloudPacked(this->dataPtr->pointMsg, this->Name(), false,
{{"xyz", msgs::PointCloudPacked::Field::FLOAT32},
{"rgb", msgs::PointCloudPacked::Field::FLOAT32}});

Expand Down
8 changes: 1 addition & 7 deletions src/GpuLidarSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,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->Name(), true,
msgs::InitPointCloudPacked(this->dataPtr->pointMsg, this->Name(), false,
{{"xyz", msgs::PointCloudPacked::Field::FLOAT32},
{"intensity", msgs::PointCloudPacked::Field::FLOAT32},
{"ring", msgs::PointCloudPacked::Field::UINT16}});
Expand Down
7 changes: 1 addition & 6 deletions src/RgbdCameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,7 @@ bool RgbdCameraSensor::Load(const sdf::Sensor &_sdf)
if (!this->AdvertiseInfo(this->Topic() + "/camera_info"))
return false;

// 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->FrameId(), true,
msgs::InitPointCloudPacked(this->dataPtr->pointMsg, this->FrameId(), 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 @@ -420,10 +420,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());

// Clean up rendering ptrs
visualBox1.reset();
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

0 comments on commit 8efd81b

Please sign in to comment.