Skip to content

Commit

Permalink
Merge pull request #808 from danneboom/fix_long_path_crash
Browse files Browse the repository at this point in the history
Use multiple billboard lines when exceeding max elements per line
  • Loading branch information
k-okada authored Jun 29, 2021
2 parents a5893a5 + 67ca565 commit 06ba596
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions jsk_rviz_plugins/src/tf_trajectory_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -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++) {
Expand Down

0 comments on commit 06ba596

Please sign in to comment.