swri-robotics / mapviz

Modular ROS visualization tool for 2D data.
BSD 3-Clause "New" or "Revised" License
371 stars 144 forks source link

736 add a duplicate feature for plugins #737

Open rjb0026 opened 3 years ago

rjb0026 commented 3 years ago

Closes #736. Added a "duplicate" feature to quickly create a deep copy of a plugin including all its configurations. Current methods for creating a duplicate:

https://user-images.githubusercontent.com/33141599/120910447-b9126b80-c644-11eb-82f6-048480bb7eb5.mp4

danthony06 commented 3 years ago

Looks pretty useful at first glance. I need to look at the temp file code, that seems a little odd.

rjb0026 commented 3 years ago

There might be a more efficient way, but I was trying to use the existing plugin interface. I didn't initially see a super easy way to go from YAML::Emitter to YAML::Node directly. I did however see a way to go from YAML::Node to YAML::Emitter easily. It would be nice if the MapvizPlugin::SaveConfig interface took in a YAML::Node directly and then let the user decide how to save that since it's not actually saving to a file in any of the implementations I've looked at.

Changing the existing MapvizPlugin interface or adding another pure virtual method to the MapvizPlugin class would break all existing plugins. Avoiding that was my primary objective for doing something kinda quick and dirty. I can look around in yaml-cpp to see if there is a more efficient way to do that conversion in case I'm just missing something.

rjb0026 commented 3 years ago

@danthony06 I found a better way to save/load the config for the plugin to be duplicated that does not require using a temp file. I've tested locally on melodic. The CI seems to be failing because it can't find catkin tools, so It didn't even make it to the build.