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

fix(tier4_planning_rviz_plugin): supress initial warning message #2960

Merged
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
35 changes: 15 additions & 20 deletions common/tier4_planning_rviz_plugin/include/path/display.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,14 @@ class AutowarePathWithDrivableAreaDisplay : public AutowarePathBaseDisplay<T>
{
public:
AutowarePathWithDrivableAreaDisplay()
: property_drivable_area_view_{"View Drivable Area", true, "", this},
property_drivable_area_alpha_{"Alpha", 0.999, "", &property_drivable_area_view_},
property_drivable_area_color_{"Color", QColor(0, 148, 205), "", &property_drivable_area_view_},
property_drivable_area_width_{"Width", 0.3f, "", &property_drivable_area_view_}
{
property_drivable_area_view_ = new rviz_common::properties::BoolProperty(
"View Drivable Area", true, "", this, SLOT(updateVisualization()));
property_drivable_area_alpha_ = new rviz_common::properties::FloatProperty(
"Alpha", 0.999, "", property_drivable_area_view_, SLOT(updateVisualization()), this);
property_drivable_area_alpha_->setMin(0.0);
property_drivable_area_alpha_->setMax(1.0);
property_drivable_area_color_ = new rviz_common::properties::ColorProperty(
"Color", QColor(0, 148, 205), "", property_drivable_area_view_, SLOT(updateVisualization()),
this);
property_drivable_area_width_ = new rviz_common::properties::FloatProperty(
"Width", 0.3f, "", property_drivable_area_view_, SLOT(updateVisualization()), this);
property_drivable_area_width_->setMin(0.001);
property_drivable_area_alpha_.setMin(0.0);
property_drivable_area_alpha_.setMax(1.0);
property_drivable_area_width_.setMin(0.001);
Comment on lines +87 to +94
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If SLOT(updateVisualization()) is removed, I think visualization is not updated after parameters are changed.

Copy link
Contributor Author

@takayuki5168 takayuki5168 Mar 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Let me unresolve the comment not to forget the reason not to use SLOT(updateVisualization) 🙏 )
I had a discussion with Saito-san internally.

  • In order to register the updateVisualization function as SLOT, the class that has the function has Q_OBJECT type.
    • FYI: Error: Class declaration lacks Q_OBJECT macro.
  • The template class cannot have Q_OBJECT type.
    • FYI: Error: Template classes not supported by Q_OBJECT.
  • The derived class from the template class with the updateVisualiation function can be compiled, but the runtime error No such slot rviz_common::_RosTopicDisplay::updateVisualization() occurs.

In short, by the change to use a template class in order to make path/trajectory/... implementation common (#2871), now we cannot use SLOT(updateVisualization).

}

~AutowarePathWithDrivableAreaDisplay()
Expand Down Expand Up @@ -137,11 +132,11 @@ class AutowarePathWithDrivableAreaDisplay : public AutowarePathBaseDisplay<T>
return;
}

if (property_drivable_area_view_->getBool()) {
if (property_drivable_area_view_.getBool()) {
Ogre::ColourValue color =
rviz_common::properties::qtToOgre(property_drivable_area_color_->getColor());
color.a = property_drivable_area_alpha_->getFloat();
const auto line_width = property_drivable_area_width_->getFloat();
rviz_common::properties::qtToOgre(property_drivable_area_color_.getColor());
color.a = property_drivable_area_alpha_.getFloat();
const auto line_width = property_drivable_area_width_.getFloat();
visualizeBound(msg_ptr->left_bound, color, line_width, left_bound_object_);
visualizeBound(msg_ptr->right_bound, color, line_width, right_bound_object_);
}
Expand All @@ -151,10 +146,10 @@ class AutowarePathWithDrivableAreaDisplay : public AutowarePathBaseDisplay<T>
Ogre::ManualObject * left_bound_object_{nullptr};
Ogre::ManualObject * right_bound_object_{nullptr};

rviz_common::properties::BoolProperty * property_drivable_area_view_;
rviz_common::properties::ColorProperty * property_drivable_area_color_;
rviz_common::properties::FloatProperty * property_drivable_area_alpha_;
rviz_common::properties::FloatProperty * property_drivable_area_width_;
rviz_common::properties::BoolProperty property_drivable_area_view_;
rviz_common::properties::FloatProperty property_drivable_area_alpha_;
rviz_common::properties::ColorProperty property_drivable_area_color_;
rviz_common::properties::FloatProperty property_drivable_area_width_;
};

class AutowarePathWithLaneIdDisplay
Expand Down