the utilization of rviz::Panel::load and rviz::Panel::save when create a custom rviz plugin

asked 2017-12-06 04:41:02 -0500

tengfei gravatar image

Hi all. I'm trying to write some rviz plugins based on the Class rviz::Panel.I get the tutorial from here and tried it. But I still get confused with these
two functions: rviz::Panel::load and rviz::Panel::save, which are the virtual function of rviz::plugin. Here are the override

void TeleopPanel::save( rviz::Config config ) const

  rviz::Panel::save( config );
  config.mapSetValue( "Topic", output_topic_ );
void TeleopPanel::load( const rviz::Config& config )
  rviz::Panel::load( config );
  QString topic;
  if( config.mapGetString( "Topic", &topic ))
    output_topic_editor_->setText( topic );

the complete code is here. After I searched the documentation I still don't understand well. I guess the load function is called when the rviz plugin is added and take things from "Topic" into Qstring topic then execute the internal function while the save function is called when the rviz plugin is closed and put the things in Qstring output_topic_ into "Topic" and saved it .When next time the rviz plugin is added, the load function will give the Qstring topic from "Topic" last time it saved by save function. is that right? and If what I understanding is right, so should I override the rviz::Panel::load and rviz::Panel::save whatever rviz_plugins I created when I use rviz::Panel? Or it is not necessary?

edit retag flag offensive close merge delete