From a19bdc8029dcd8270f198a60419c4362829ad44a Mon Sep 17 00:00:00 2001 From: Jan Krieglstein Date: Wed, 7 Apr 2021 09:29:44 +0200 Subject: [PATCH] Use multiple billboard lines when exceeding max elements per line --- jsk_rviz_plugins/src/tf_trajectory_display.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jsk_rviz_plugins/src/tf_trajectory_display.cpp b/jsk_rviz_plugins/src/tf_trajectory_display.cpp index 06c0f2bf7..591365ab6 100644 --- a/jsk_rviz_plugins/src/tf_trajectory_display.cpp +++ b/jsk_rviz_plugins/src/tf_trajectory_display.cpp @@ -38,6 +38,7 @@ namespace jsk_rviz_plugins { + #define MAX_ELEMENTS_PER_LINE (65536 / 4) // from ros-visualization/rviz/src/rviz/ogre_helpers/billboard_line.cpp TFTrajectoryDisplay::TFTrajectoryDisplay() : Display() { @@ -157,8 +158,9 @@ namespace jsk_rviz_plugins } } line_->clear(); - line_->setNumLines(1); - line_->setMaxPointsPerLine(trajectory_.size()); + // split into multiple lines if the trajectory size exceeds MAX_ELEMENTS_PER_LINE (https://github.com/ros-visualization/rviz/issues/1107) + line_->setNumLines(trajectory_.size() / MAX_ELEMENTS_PER_LINE + 1); + line_->setMaxPointsPerLine(trajectory_.size() > MAX_ELEMENTS_PER_LINE ? MAX_ELEMENTS_PER_LINE : trajectory_.size()); line_->setLineWidth(line_width_); line_->setColor(color_.red() * 255.0, color_.green() * 255.0, color_.blue() * 255.0, 255.0); for (size_t i = 0; i < trajectory_.size(); i++) {