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

Irobot create Python script

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

andreapatri gravatar image

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

ngrennan gravatar image

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.

edit retag flag offensive close merge delete

Comments

1

What is your question?

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

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

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

1 Answer

Sort by ยป oldest newest most voted
1

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

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:

<launch>
  <!-- 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" />
</launch>

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

Stats

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

Seen: 688 times

Last updated: Sep 08 '12