Ask Your Question
1

How to create a launch file?

asked 2013-05-14 19:18:25 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hello Everyone!!

How can i create a launch file?

As a sample, have a look at turtlemimic.launch

<launch>

  <group ns="turtlesim1">
    <node pkg="turtlesim" name="sim" type="turtlesim_node"/>
  </group>

  <group ns="turtlesim2">
    <node pkg="turtlesim" name="sim" type="turtlesim_node"/>
  </group>

  <node pkg="turtlesim" name="mimic" type="mimic">
    <remap from="input" to="turtlesim1/turtle1"/>
    <remap from="output" to="turtlesim2/turtle1"/>
  </node>

</launch>

However, how do I get this working ?

Best,

Vincent

edit retag flag offensive close merge delete

Comments

start with $ gedit turtlemimic.launch, then a new window with gedit will pop up, just paste those stuff, save and close.

Carrie Yan gravatar imageCarrie Yan ( 2017-05-04 15:20:38 -0600 )edit

3 Answers

Sort by ยป oldest newest most voted
19

answered 2013-05-14 20:16:18 -0600

sai gravatar image

Launch file is useful when you want to start/launch many nodes at once without any need to do "rosrun for every node".

In the package, create a folder by the name launch and create a filename.launch file.

It always start with

 <launch>

and if some parameters should be set then

<param name="use_sim_time"  value="true" />

To start a node

<node pkg="name_of_package" type="name_of_packge" name="name_of_executable" 
output="screen"/>

Example

<node pkg="sure_on_cloud" type="estimate_transform_svd" name="estimate_transform_svd" 
output="screen"/>

In the above way, one can call multiple nodes from different packages.

<remap from="/camera/depth/image_rect_raw" to="/camera/depth/image"/>

Nodelets can also be initialized. Sorry I dont know what they are, but they can also be initialized from the example below

  <node pkg="nodelet" type="nodelet" name="standalone_nodelet"  args="manager"/>

 <node pkg="nodelet" type="nodelet" name="point_cloud_xyz"
    args="load depth_image_proc/point_cloud_xyz standalone_nodelet">

Some packages have their topics already set to specific names. They can be remapped to different names.

<remap from="/image_rect" to="/camera/depth/image"/>
<remap from="/points" to="/camera/depth/points"/>
<remap from="/camera_info" to="/camera/depth/camera_info"/>

</node>

</launch>

edit flag offensive delete link more

Comments

launching a node worked for me after a slight modification

<node pkg="name_of_package" type="name_of_executable" name="name_of_executable" output="screen"/>

vacky11 gravatar imagevacky11 ( 2017-03-15 14:54:58 -0600 )edit

http://wiki.ros.org/nodelet // Just if someone wants to read about what nodelets are

aaditya_saraiya gravatar imageaaditya_saraiya ( 2017-09-13 10:44:54 -0600 )edit
2

answered 2013-05-15 00:03:30 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

What program could I create a filename.launch?

edit flag offensive delete link more

Comments

i didnt get u

sai gravatar imagesai ( 2013-05-15 00:10:06 -0600 )edit
2

@vncntmh write the launch file in gedit and save it with a .launch extension ! was that your issue ?

Arkapravo gravatar imageArkapravo ( 2013-05-15 05:08:36 -0600 )edit

gedit turtlemimic.launch, and save in /Home/catkin_ws/beginner_tutorials/launch/

(http://www.ros.org/wiki/ROS/Tutorials/UsingRqtconsoleRoslaunch)

But I have problem when I used:

roscd beginner_tutorials

roscd: No such package/stack 'beginner_tutorials'

vncntmh gravatar imagevncntmh ( 2013-05-15 15:38:49 -0600 )edit
1

It means that beginner_tutorials is not in ROS_PACKAGE_PATH. One solution is to add the path to the beginner tutorials or the workspace to the ROS_PACKAGE_PATH. You can search how to change ROS_PACKAGE_PATH in ROS. Beat way is to create a overlay http://www.ros.org/wiki/fuerte/Installation/Overlays

sai gravatar imagesai ( 2013-05-15 16:00:43 -0600 )edit

@Sai Thanks!!!

vncntmh gravatar imagevncntmh ( 2013-05-15 17:07:06 -0600 )edit
1

now, I have this problem:

roslaunch beginner_tutorials turtlemimic.launch

[beginner_tutorials] is not a package or launch file name

I have beginner_tutorials in my ROS_PACKAGE_PATH (fuerte_workspace) and I used:

gedit turtlemimic.launch

vncntmh gravatar imagevncntmh ( 2013-05-15 17:17:01 -0600 )edit
1

I am guessing that there might be some problem in creating the package. May be manifest file is missing or something else. Even though it is in ROS_PACKAGE_PATH, it is not a package..To know if it is in ROS_PACKAGE_PATH, just roscd filename, shold take you there.

sai gravatar imagesai ( 2013-05-15 17:37:18 -0600 )edit

Redo the package creation process once again following the tutorials

sai gravatar imagesai ( 2013-05-15 17:38:46 -0600 )edit
0

answered 2017-01-28 01:29:34 -0600

Amer Al-Radaideh gravatar image

for those who have this problem ([beginner_tutorials] is not a package or launch file name) please follow this tutorial: http://wiki.ros.org/catkin/Tutorials/...

edit flag offensive delete link more

Comments

I did not understand, Why to set parameters in launch file? what are those parameters

Waleed gravatar imageWaleed ( 2017-03-09 07:17:44 -0600 )edit

Your Answer

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

Add Answer

Question Tools

4 followers

Stats

Asked: 2013-05-14 19:18:25 -0600

Seen: 29,105 times

Last updated: May 15 '13