Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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

Hi 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 prcess like this:

int main(int argc, char **argv) {
    //Roslaunch
    QProcess process;
    process.start("roslaunch", QStringList() << "/home/launch/pow.launch");
    //GUI
    QApplication app(argc, argv);
    pow_gui::MainWindow w(argc,argv);
       w.show();
    app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
    int result = app.exec();
    std::cout << "q application finished" << std::endl;
    return result;
}

So in my pow.launch launch fle

<launch>

    <param name="/use_sim_time" value="true"/>
    <node name="hector_mapping" pkg="hector_mapping" type="hector_mapping" output="screen">
 <param name="pub_map_odom_transform" value="false"/>
    <remap from="scan" to="scan_2"/>
 <param name="map_frame" value="map"/>

 </node>

    <node name="foo_throttler" type="throttle" pkg="topic_tools" args="messages /scan 10/scan_throttle" /> 
    <node name="foo_throttler1" type="throttle" pkg="topic_tools" args="messages /raw_imu 10/raw_imu_throttle" /> 

    <node name="rosplay" pkg="rosbag" type="play" args="/home/10m_forward5.bag --clock"/>
    <node pkg="tf" type="static_transform_publisher" name="corner_duhhu" args="-0.17 -0.2 0 0 0 0 base_link laser 20"/> 

    <node pkg="tf" type="static_transform_publisher" name="raw_tf" args="0 0 0 0 0 0 /map /raw_frame 10"/> 

    <!--node pkg="analyzer" type="parking"  name="parking" output="screen"/>  -->
    <node pkg="analyzer" type="wst_forward10m"  name="wst_forward10m" output="screen"/> 
    <!--node pkg="analyzer" type="wst_turn"  name="wst_turn" output="screen"/>  -->

</launch>

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 node displayed in QT.

Any help?