0
$\begingroup$

Rosanswers logo

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


Originally posted by acp on ROS Answers with karma: 556 on 2013-09-04

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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))

Originally posted by acp with karma: 556 on 2013-09-05

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Jundan128 on 2018-10-25:
can i get full file of your work? i kinda familiar with rqt plugin with cpp but not familiar with phyton.

$\endgroup$

Your Answer

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