Rosanswers logo

Hola! I am writing a python script, to run teleop_twist_keyboard.py for irobot create, by opening just one terminal in which I will call the python script. This script should open roscore, then it will open a new terminal and run rosrun irobot_create_2_1 driver.py and finally open another terminal and it will run rosrun teleop_twist_keyboard teleop_twist_keyboard.py. So I want to write just one command in one konsole and then it will automatically open the new terminals and call for the 3 functions.

Originally posted by andreapatri on ROS Answers with karma: 26 on 2012-09-08

Post score: 0

Original comments

Comment by joq on 2012-09-08:
What is your question?

Comment by andreapatri on 2012-09-08:
How can I open a konsole terminal from a python script?


1 Answer 1


Rosanswers logo

I'm not entirely sure that I understand your question, but this sounds like exactly the kind of thing that launch files are used for. Using a launch file you could easily launch all of the nodes that you are interested in, automatically start a new roscore if one is needed, and control the inputs and outputs for each individual node (if for example you wanted each node to launch in a different terminal window). All of this could be accomplished with a single call to roslaunch. Here is a minimalist example that may do approximately what you want:

  <!-- start first node and roscore if needed: -->
  <node pkg="teleop_twist_keyboard" name="keyboard_control" 
    type="teleop_twist_keyboard.py" output="screen"
    respawn="true" launch-prefix="xterm -rv -e" />
  <!-- start second node: -->
  <node pkg="irobot_create_2_1" name="irobot_driver"
    type="driver.py" output="screen" />

Note that I have used the launch-prefix tag in the first node entry to force the node to open in a new xterm window. More about launch files can be found here and available XML tags here

Originally posted by jarvisschultz with karma: 9031 on 2012-09-08

This answer was ACCEPTED on the original site

Post score: 1


Your Answer

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