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

Revision history [back]

First you need to be able to listen to the joystick in a separate node to listen when the button is pressed, so assuming you already have that, then you can use the roslaunch api: http://wiki.ros.org/roslaunch/API%20Usage

Below the example shown in tutorial:

import roslaunch

package = 'rqt_gui'
executable = 'rqt_gui'
node = roslaunch.core.Node(package, executable)

launch = roslaunch.scriptapi.ROSLaunch()
launch.start()

process = launch.launch(node)
print process.is_alive()
process.stop()

Of course you will replace rqt_gui with your package and executable applicable to your application.