Results 1 to 2 of 2

Thread: How to get parameter from ros launch file and use it in Qt?

  1. #1
    Join Date
    Apr 2014
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How to get parameter from ros launch file and use it in Qt?

    Im using ROS Fuerte and qt_ros so can integrate ROS in Qt GUI. I would like to use

    some parameters from the ROS launch file in my Qt GUI. in the main.cpp file of the GUI Im using the ROS launch file to start the process like this:

    Qt Code:
    1. int main(int argc, char **argv) {
    2. //Roslaunch
    3. QProcess process;
    4. process.start("roslaunch", QStringList() << "/home/launch/pow.launch");
    5. //GUI
    6. QApplication app(argc, argv);
    7. pow_gui::MainWindow w(argc,argv);
    8. w.show();
    9. app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
    10. int result = app.exec();
    11. std::cout << "q application finished" << std::endl;
    12. return result;
    13. }
    To copy to clipboard, switch view to plain text mode 

    So in my pow.launch

    Qt Code:
    1. <launch>
    2. <param name="/use_sim_time" value="true"/>
    3. <node name="hector_mapping" pkg="hector_mapping" type="hector_mapping" output="screen">
    4. <param name="pub_map_odom_transform" value="false"/>
    5. <remap from="scan" to="scan_2"/>
    6. <param name="map_frame" value="map"/>
    7.  
    8. </node>
    9.  
    10. <node name="foo_throttler" type="throttle" pkg="topic_tools" args="messages /scan 10/scan_throttle" />
    11. <node name="foo_throttler1" type="throttle" pkg="topic_tools" args="messages /raw_imu 10/raw_imu_throttle" />
    12.  
    13. <node name="rosplay" pkg="rosbag" type="play" args="/home/10m_forward5.bag --clock"/>
    14. <node pkg="tf" type="static_transform_publisher" name="corner_duhhu" args="-0.17 -0.2 0 0 0 0 base_link laser 20"/>
    15.  
    16. <node pkg="tf" type="static_transform_publisher" name="raw_tf" args="0 0 0 0 0 0 /map /raw_frame 10"/>
    17.  
    18. <!--node pkg="analyzer" type="parking" name="parking" output="screen"/> -->
    19. <node pkg="analyzer" type="wst_forward10m" name="wst_forward10m" output="screen"/>
    20. <!--node pkg="analyzer" type="wst_turn" name="wst_turn" output="screen"/> -->
    21.  
    22. </launch>
    To copy to clipboard, switch view to plain text mode 

    when Im using the node pkg="analyzer" type="wst_forward10m" name="wst_forward10m" I would like to have a tab in QT saying that Im using that node and when using node pkg="analyzer" type="wst_turn" name="wst_turn" would like to have that displayed in QT.

    Any help?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to get parameter from ros launch file and use it in Qt?

    Since the file's format is XML, have a look at QXmlStreamReader.

    Cheers,
    _

Similar Threads

  1. Replies: 27
    Last Post: 6th September 2013, 22:23
  2. I cannot launch my app!
    By MIH1406 in forum Qt Tools
    Replies: 9
    Last Post: 26th October 2009, 11:53
  3. Launch app by opening a file
    By Windsoarer in forum Qt Programming
    Replies: 2
    Last Post: 28th May 2009, 06:22
  4. Replies: 1
    Last Post: 13th May 2009, 03:18
  5. launch app
    By damien in forum Qt Programming
    Replies: 2
    Last Post: 5th February 2009, 19:42

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.