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

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 image Carrie Yan  ( 2017-05-04 15:20:38 -0600 )edit

4 Answers

Sort by ยป oldest newest most voted
20

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 image vacky11  ( 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 image aaditya_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 image sai  ( 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 image Arkapravo  ( 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 image vncntmh  ( 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 image sai  ( 2013-05-15 16:00:43 -0600 )edit

@Sai Thanks!!!

vncntmh gravatar image vncntmh  ( 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 image vncntmh  ( 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 image sai  ( 2013-05-15 17:37:18 -0600 )edit

Redo the package creation process once again following the tutorials

sai gravatar image sai  ( 2013-05-15 17:38:46 -0600 )edit
1

answered 2019-11-28 09:07:46 -0600

Robotronics gravatar image

updated 2019-11-28 22:50:43 -0600

jayess gravatar image

To Solve This Problem :

roscd beginner_tutorials

roscd: No such package/stack 'beginner_tutorials'

Simply go to the command terminal and type in :

sudo gedit ~/.bashrc

Go to the end of the list and add :

source /home/Your_Path_name/catkin_ws/devel/setup.bash

Close and Save.

Go to Command line again and type

source ~/.bashrc

Run again roscd and Viola! :)

edit flag offensive delete link more
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 image Waleed  ( 2017-03-09 07:17:44 -0600 )edit

Question Tools

4 followers

Stats

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

Seen: 44,995 times

Last updated: Nov 28 '19