Ask Your Question
0

launch a launch file using a joy button

asked 2021-11-28 12:50:59 -0600

Is it possible somehow to launch a launch file just by pressing a button on a joystick? until now what I saw, is that joystick is used to send velocity messages to the cmd_vel topic. but I haven't seen it used to launch something. if it is possible what is the best way to do that? THANKS in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-11-29 11:46:14 -0600

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%20U...

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2021-11-28 09:10:05 -0600

Seen: 17 times

Last updated: Nov 29 '21