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

Removed sensor_msgs::msg::PointCloud references because is deprecated #1224

Open
wants to merge 3 commits into
base: rolling
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
52 changes: 36 additions & 16 deletions rviz2/test/tools/send_lots_of_points_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
#include <cmath>

#include "rclcpp/rclcpp.hpp"
#include "sensor_msgs/msg/point_cloud.hpp"
#include "sensor_msgs/msg/point_cloud2.hpp"
#include "sensor_msgs/point_cloud2_iterator.hpp"
#include "geometry_msgs/msg/point32.hpp"

int main(int argc, char ** argv)
Expand All @@ -54,34 +55,53 @@ int main(int argc, char ** argv)

auto node = rclcpp::Node::make_shared("send_lots_of_points");

auto pub = node->create_publisher<sensor_msgs::msg::PointCloud>("pointcloud", 100);
auto pub = node->create_publisher<sensor_msgs::msg::PointCloud2>("pointcloud", 100);
rclcpp::Rate loop_rate(rate);

sensor_msgs::msg::PointCloud msg;
sensor_msgs::msg::PointCloud2 msg;
int width = size;
int length = 2 * size;
msg.points.resize(width * length);
msg.header.frame_id = "world";

// Fill 2 using an iterator
sensor_msgs::PointCloud2Modifier modifier(msg);
modifier.setPointCloud2FieldsByString(2, "xyz", "rgb");
int count = 0;
printf("cloud_msg_.point_step %d\n", msg.point_step);
while (rclcpp::ok() ) {
width++;
msg.points.resize(width * length + (count % 2) );

modifier.resize(width, length + (count % 2));
sensor_msgs::PointCloud2Iterator<float> iter_x(msg, "x");
sensor_msgs::PointCloud2Iterator<float> iter_y(msg, "y");
sensor_msgs::PointCloud2Iterator<float> iter_z(msg, "z");
sensor_msgs::PointCloud2Iterator<uint8_t> iter_r(msg, "r");
sensor_msgs::PointCloud2Iterator<uint8_t> iter_g(msg, "g");
sensor_msgs::PointCloud2Iterator<uint8_t> iter_b(msg, "b");
for (int x = 0; x < width; x++) {
for (int y = 0; y < length; y++) {
geometry_msgs::msg::Point32 & point = msg.points[x + y * width];
point.x = static_cast<float>(x / 100.0);
point.y = static_cast<float>(y / 100.0);
// point.z = sinf( x / 100.0 + y / 100.0 + count / 100.0 );
point.z = ((x + y + count) % 100) / 100.0f;
if (count % 2) {
*iter_x = -.1f;
*iter_y = -.1f;
*iter_z = 1.1f;
} else {
*iter_x = static_cast<float>(x / 100.0);
*iter_y = static_cast<float>(y / 100.0);
*iter_z = ((x + y + count) % 100) / 100.0f;
}

*iter_r = 255;
*iter_g = 0;
*iter_b = 0;

++iter_x;
++iter_y;
++iter_z;
++iter_r;
++iter_g;
++iter_b;
}
}
if (count % 2) {
msg.points[width * length + 1].x = -.1f;
msg.points[width * length + 1].y = -.1f;
msg.points[width * length + 1].z = 1.1f;
}

msg.header.stamp = node->now();

printf(
Expand Down
20 changes: 0 additions & 20 deletions rviz_default_plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,8 @@ set(rviz_default_plugins_source_files
src/rviz_default_plugins/displays/pointcloud/transformers/xyz_pc_transformer.cpp
src/rviz_default_plugins/displays/pointcloud/get_transport_from_topic.cpp
src/rviz_default_plugins/displays/pointcloud/point_cloud_common.cpp
src/rviz_default_plugins/displays/pointcloud/point_cloud_to_point_cloud2.cpp
src/rviz_default_plugins/displays/pointcloud/point_cloud_transformer_factory.cpp
src/rviz_default_plugins/displays/pointcloud/point_cloud_selection_handler.cpp
src/rviz_default_plugins/displays/pointcloud/point_cloud_display.cpp
src/rviz_default_plugins/displays/pointcloud/point_cloud2_display.cpp
src/rviz_default_plugins/displays/polygon/polygon_display.cpp
src/rviz_default_plugins/displays/pose/pose_display.cpp
Expand Down Expand Up @@ -1025,24 +1023,6 @@ if(BUILD_TESTING)
)
endif()

ament_add_gtest(point_cloud_display_visual_test
test/rviz_default_plugins/displays/pointcloud/point_cloud_display_visual_test.cpp
${SKIP_VISUAL_TESTS}
TIMEOUT 180)
if(TARGET point_cloud_display_visual_test)
target_include_directories(point_cloud_display_visual_test PRIVATE test)
target_link_libraries(point_cloud_display_visual_test
Qt5::Test
rviz_visual_testing_framework::rviz_visual_testing_framework
${geometry_msgs_TARGETS}
tf2::tf2
rclcpp::rclcpp
${std_msgs_TARGETS}
${sensor_msgs_TARGETS}
point_cloud_common_page_object
)
endif()

ament_add_gtest(point_cloud2_display_visual_test
test/rviz_default_plugins/displays/pointcloud/point_cloud2_display_visual_test.cpp
${SKIP_VISUAL_TESTS}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ class RVIZ_DEFAULT_PLUGINS_PUBLIC PointCloudCommon : public QObject
void reset();
void update(float wall_dt, float ros_dt);

void addMessage(sensor_msgs::msg::PointCloud::ConstSharedPtr cloud);
void addMessage(sensor_msgs::msg::PointCloud2::ConstSharedPtr cloud);

rviz_common::Display * getDisplay() {return display_;}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@

#include "rclcpp/clock.hpp"

#include "rviz_default_plugins/displays/pointcloud/point_cloud_to_point_cloud2.hpp"
#include "rviz_default_plugins/displays/pointcloud/point_cloud_helpers.hpp"
#include "rviz_common/display.hpp"
#include "rviz_common/display_context.hpp"
Expand Down Expand Up @@ -667,11 +666,6 @@ void PointCloudCommon::setProblematicPointsToInfinity(V_PointCloudPoint & cloud_
}
}

void PointCloudCommon::addMessage(const sensor_msgs::msg::PointCloud::ConstSharedPtr cloud)
{
addMessage(convertPointCloudToPointCloud2(cloud));
}

void PointCloudCommon::addMessage(const sensor_msgs::msg::PointCloud2::ConstSharedPtr cloud)
{
processMessage(cloud);
Expand Down

This file was deleted.

Loading