0
$\begingroup$

Rosanswers logo

Hi,

is there any tutorial, how to create a GUI, where I can publish messages on a certain topic for C++? Or can anyone provide a minimal Example, how to read and publish a integer?

Thanks

EDIT: I tried to follow the tutorial : http : // ros.org/wiki/rqt/Tutorials/Writing%20a%20C%2B%2B%20Plugin

But somehow, when I try to load Cmakelists in QT Creator, I get following error:

CMake Error at /opt/ros/groovy/share/catkin/cmake/safe_execute_process.cmake:11 (message):
execute_process(/usr/bin/python
"/opt/ros/groovy/share/catkin/cmake/parse_package_xml.py" "/home/GUITest/rqt_mypkg/package.xml" "/home/GUITest/build/catkin_generated/package.cmake") returned error code 1 Call Stack (most recent call first):
/opt/ros/groovy/share/catkin/cmake/catkin_package_xml.cmake:63 (safe_execute_process)
/opt/ros/groovy/share/catkin/cmake/catkin_package_xml.cmake:39 (_catkin_package_xml)
/opt/ros/groovy/share/catkin/cmake/catkin_package.cmake:95 (catkin_package_xml)
CMakeLists.txt:51 (catkin_package)

return parse_package_string(f.read(),

filename) File "/usr/lib/pymodules/python2.7/catkin_pkg/package.py", line 448, in parse_package_string raise InvalidPackage('Error(s) in %s:%s' % (filename, ''.join(['\n- %s' % e for e in errors]))) catkin_pkg.package.InvalidPackage: Invalid package manifest "/home/GUITest/rqt_mypkg/package.xml": Error(s) in /home/GUITest/rqt_mypkg/package.xml:

  • The manifest must not contain the following tags: package Traceback (most recent call last): File "/opt/ros/groovy/share/catkin/cmake/parse_package_xml.py", line 98, in main() File "/opt/ros/groovy/share/catkin/cmake/parse_package_xml.py", line 90, in main package = parse_package(args.package_xml) File "/usr/lib/pymodules/python2.7/catkin_pkg/package.py", line 315, in parse_package

Further, I don't get this from the tutorial:

Basically the same step described in previous tutorial. Some unique cases: Replace rqt_gui_py with rqt_gui_cpp C++ binding specific note for xml attribute: /library/class@name The name of the plugin that is exported via the PLUGINLIB_DECLARE_CLASS macro.

I just replaced rqt_gui_py with rqt_gui_cpp. But what is meant with C++ binding specific note for xml atribute? What should I do here exactly?

[EDIT] My plugin.xml looks like this:

<library path="src">
  <class name="MyPlugin" type="my_namespace::MyPlugin" base_class_type="rqt_gui_cpp::Plugin">
    <description>
      An example Python GUI plugin to create a great user interface.
    </description>
    <qtgui>
      <!-- optional grouping...
      <group>
        <label>Group</label>
      </group>
      <group>
        <label>Subgroup</label>
      </group>
      -->
      <label>My first CPP Plugin</label>
      <icon type="theme">system-help</icon>
      <statustip>Great user interface to provide real value.</statustip>
    </qtgui>
  </class>
</library>

I have following files:

  • /home/GUITest/rqt_mypkg/package.xml
  • /home/GUITest/rqt_mypkg/plugin.xml
  • /home/GUITest/rqt_mypkg/CmakeLists.xml
  • /home/GUITest/rqt_mypkg/my_namespace/my_plugin.h
  • /home/GUITest/rqt_mypkg/my_namespace/my_plugin.cpp

Originally posted by invoices on ROS Answers with karma: 21 on 2013-07-29

Post score: 2


Original comments

Comment by TommyP on 2013-07-30:
Why are you using QT Creator? The tutorial does not mention this. Why not just try to follow the tutorial and take the example code and see if it compiles?

Comment by invoices on 2013-07-30:
If I try to call CMake in the console, I get the same error.

From this tutorial; http://ros.org/wiki/rqt/Tutorials/Create%20your%20new%20rqt%20plugin I dont get the point 6 and below. I dont have a setup.py. Do I need it? Im not using python

Comment by 130s on 2013-07-30:
@invoices I suppose that your original question is already answered. If so, you better open up a new question so that others can have a better view of what's your problem.

Comment by invoices on 2013-07-31:
Ok, I will create a new question as I still have not understood how to create my C++ RQT GUI

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I would put the ros::spin() in its own thread.

This is a good page:

http://www.ros.org/wiki/roscpp/Overview/Callbacks%20and%20Spinning

But what I would do for this problem is to write a rqt plugin in Python but you can also write it in C++:

http://ros.org/wiki/rqt/Tutorials


Originally posted by TommyP with karma: 1339 on 2013-07-30

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.