ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The plugin should be in a lib that can be loaded by another process, it should not implement the process itself. I. e. there should not be a main() in your process and you should create a library rather than an executable.
This means remove your main and change
add_executable(Project_node
src/System/system.cpp
src/Gui/gui.cpp
${MOC_SRC_H}
${MOC_GUI_H}
)
for
add_library(rqt_project
src/System/system.cpp
src/Gui/gui.cpp
${MOC_SRC_H}
${MOC_GUI_H}
)
in your CMakeLists.txt. Note that rqt_project
will correspond to an output library file named librqt_project.so
. This in turn is loaded because in your plugin.xml you state: <library path="lib/librqt_project">
, i. e. the postfix of the library path in plugin.xml must correspond with the target name of add_library in the CMakeLists.txt.
You can launch your plugin then via rgt_gui (it should appear there amongst the plugins) or standalone using a script like the one mentioned here: http://answers.ros.org/question/124706/how-to-run-a-newly-created-rqt-plugin/#191986
2 | No.2 Revision |
The plugin should be in a lib that can be loaded by another process, it should not implement the process itself. I. e. there should not be a main() in your process and you should create a library rather than an executable.
This means remove your main and change
add_executable(Project_node
src/System/system.cpp
src/Gui/gui.cpp
${MOC_SRC_H}
${MOC_GUI_H}
)
for
add_library(rqt_project
src/System/system.cpp
src/Gui/gui.cpp
${MOC_SRC_H}
${MOC_GUI_H}
)
in your CMakeLists.txt. Note that rqt_project
will correspond to an output library file named librqt_project.so
. This in turn is loaded because in your plugin.xml you state: <library path="lib/librqt_project">
, i. e. the postfix of the library path in plugin.xml must correspond with the target name of add_library in the CMakeLists.txt.
You can launch your plugin then via rgt_gui (it should appear there amongst the plugins) or standalone using a script like the one mentioned here: http://answers.ros.org/question/124706/how-to-run-a-newly-created-rqt-plugin/#191986
Edit:
Maybe you have to add a group tag to make your plugin appear in rqt_gui, e. g.:
<library path="lib/libfoobar">
<class name="foo/Bar" type="foo::Bar" base_class_type="rqt_gui_cpp::Plugin">
<description>
A GUI plugin to view a sensor_msgs/Image topic in an foobar manner.
</description>
<qtgui>
<group>
<label>Visualization</label>
<icon type="theme">folder</icon>
<statustip>Plugins related to visualization.</statustip>
</group>
<label> blub image view</label>
<icon type="theme">image-x-generic</icon>
<statustip>A GUI plugin to view foobar topic in some manner.</statustip>
</qtgui>
</class>
</library>