ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

rqt roslaunch plugin

asked 2013-09-04 21:40:43 -0600

acp gravatar image

Hi everybody.

I have a question :)

I have a plugin.py and a .ui file. I would like to launch a .launch file from my plugin.py over my rqt_gui.

In other words, when I click a pushbutton in my rqt_gui, I would like to launch a launch file from my plugin.

Is there a way a to develop this in the plugin.py?

In advance, thank you

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2013-09-05 05:44:55 -0600

acp gravatar image

updated 2013-09-05 05:49:08 -0600

Hi, I have managed to solve it like this, hope it will help to some one :), this just the piece of code that called the slot.

 self._widget.autonomous.pressed.connect(self._load_launchfile_slot)

     @Slot(str)

   def _load_launchfile_slot(self):

    launchfile_name = 'patrolbot_navigation.launch'
    folder_name_launchfile = 'launch'
    pkg_name  =  'patrol_navigation'

    try:
         #launchfile = os.path.join(rospkg.RosPack().get_path(pkg_name), folder_name_launchfile, launchfile_name)
         #print( launchfile)
        args =  roslaunch.rlutil.resolve_launch_arguments([pkg_name, launchfile_name])
        rospy.loginfo("Starting task: %s"%args)
        runner = roslaunch.parent.ROSLaunchParent( rospy.get_param("/run_id"), args)
        runner.start()
    except IndexError as e:
        raise RLException('IndexError: {}'.format(e.message))
edit flag offensive delete link more

Comments

can i get full file of your work? i kinda familiar with rqt plugin with cpp but not familiar with phyton.

Jundan128 gravatar image Jundan128  ( 2018-10-25 22:02:03 -0600 )edit
0

answered 2013-09-04 22:07:11 -0600

130s gravatar image

updated 2013-09-05 02:30:40 -0600

Is rqt_launch not sufficient for you? That's indeed missing many features yet, but it does look for available .launch files and lets you run/shutdown launch files.


Though I can't give right now a step-by-step instruction or anything, look at NodeProxy class here that accesses roslaunch.nodeprocess.

edit flag offensive delete link more

Comments

Well, it is not, because have a GUI that has to run in parallel with RViz. And, I want to run just one .launch file when I click on a pushbutton. So I can visualize it in RViz. I took a look to the code of rqt_launch and well, I don’t get much of it :). It might be quite simple to write just one line of code in the slote of the plugin.py, but I don’t how to do it :) do you have a clue :) thank you.

acp gravatar image acp  ( 2013-09-04 22:14:55 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2013-09-04 21:40:43 -0600

Seen: 1,611 times

Last updated: Sep 05 '13