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

Irobot create Python script

asked 2012-09-08 07:39:19 -0500

andreapatri gravatar image

updated 2014-01-28 17:13:36 -0500

ngrennan gravatar image

Hola! I am writing a python script, to run 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 and finally open another terminal and it will run rosrun teleop_twist_keyboard 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.

edit retag flag offensive close merge delete



What is your question?

joq gravatar image joq  ( 2012-09-08 09:20:37 -0500 )edit

How can I open a konsole terminal from a python script?

andreapatri gravatar image andreapatri  ( 2012-09-08 10:35:57 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2012-09-08 10:48:02 -0500

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="" output="screen"
    respawn="true" launch-prefix="xterm -rv -e" />
  <!-- start second node: -->
  <node pkg="irobot_create_2_1" name="irobot_driver"
    type="" 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

edit flag offensive delete link more

Question Tools


Asked: 2012-09-08 07:39:19 -0500

Seen: 669 times

Last updated: Sep 08 '12