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

How can i modify launch files?

asked 2016-05-11 15:48:25 -0500

bsk gravatar image

Hello,

i'm using Ubuntu 14.04 on virtualbox and ros indigo. I only have a lms100 laser scanner (not robot system) and trying to create a map with hector-slam. So i learned that i need to modify launch files like mapping_default.launch and tutorial.launch

i figured out that these files are read-only. so how can i modify them?

Thanks,

Basak

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2016-05-11 18:19:34 -0500

curranw gravatar image

Many of the launch files are configurable. Anything in the original launch file with the "arg" tag can be set.

If you need to heavily modify the original launch file, create your own package and copy the launch file to your new package. Then you can edit however you'd like. I would only recommend this if the original launch file arguments don't do what you need (they typically do).

Since you are using a laser scanner without a robot system, you'll need to set the base_link frame to whatever frame your laser scanner is in, since that is your "robot".

edit flag offensive delete link more

Comments

Yes i need to modify arg like you said(i need to change odom_frame and base_frame value) so how can i do that? How can i set these arg?

bsk gravatar image bsk  ( 2016-05-12 01:22:50 -0500 )edit

See the link I posted ( http://wiki.ros.org/roslaunch/XML/arg ).

When you include other launch files in your launch file, you can use the arg tag. See example 1.1.

If you'd like to do this on the command line, see example 1.1.2.

curranw gravatar image curranw  ( 2016-05-12 02:03:40 -0500 )edit
curranw gravatar image curranw  ( 2016-05-12 02:25:25 -0500 )edit

I tried 1.1.2 and it works for mapping_default.launch but that didnt help me. Because main file to launch is tutorial.launch and it doesnt have arg to set. And i dont understand how to do exp 1.1 without creating a new package. I'm so lost :/

bsk gravatar image bsk  ( 2016-05-12 10:28:37 -0500 )edit

And for that question, i cant add lines to original launch files. Unless i create a new package, that solution doesnt work for me :/ At the end i need to create a package i guess and it's a whole new problem for me

bsk gravatar image bsk  ( 2016-05-12 10:31:48 -0500 )edit

As a general practice, you should always have your own package that does the specific task you want. For your case, that would be bringing up the laser node and running hector slam. If you'd like to do exactly what the tutorial does, you need to ...

curranw gravatar image curranw  ( 2016-05-12 12:14:31 -0500 )edit

Copy the functionality of tutorial.launch (which uses mapping_default.launch) and set the arguments in your <include> tags.

curranw gravatar image curranw  ( 2016-05-12 12:15:21 -0500 )edit

So first i need to create a package in a catkin workspace(catkin_ws) and copy/create my version of tutorial.launch and try to do <include> things, right? thanks, now i know what should i try to do :)

bsk gravatar image bsk  ( 2016-05-12 12:43:10 -0500 )edit
0

answered 2016-05-12 02:03:28 -0500

lfr gravatar image

updated 2016-05-12 02:05:28 -0500

Hello !

If you you want to modify odom_frame and base_frame values for gmapping, you have two possible solutions: If the launch file you use requested arguments, that is to say, if you can see lines like that:

< arg name="odom_frame" default="xxx" />

< arg name="base_frame" default="yyy" />

and farther:

...$(arg odom_frame)...

...$(arg base_frame)...

----- You just have to call your launch file by adding in parameter of the command line:

odom_frame:=your_new_odom_value

and

base_frame:=your_new_base_value

Else, if you cannot see what is previously indicated, you have to write the new values you want for odom_frame and base_frame inside your gmapping config file, for example gmapping.yaml (you can choose any name you want for this file). Inside, you have to specify the new values respecting the yaml syntax. Then, inside your launch file which call the gmapping node, you load your yaml file previously created using the rosparam command.

I hope I was clear as possible

edit flag offensive delete link more

Comments

first one is ok but didnt work for me and sorry i'm new to all these. i didnt understand the rest of it. I dont know what yaml is, i googled it and didnt understand either :(

bsk gravatar image bsk  ( 2016-05-12 12:57:01 -0500 )edit
1

A YAML file is a file (with the extension .yaml) in which you can store data. In our case, you can write your parameters and their values. When the launch file will load it, it will load the parameters and their specified values in the ROS parameter server.

lfr gravatar image lfr  ( 2016-05-13 02:14:14 -0500 )edit

But if the first one is ok, you don't need to create a yaml file, you can just enter your new values in the command line as I told you before the last paragraph. I hope it answers your question.

lfr gravatar image lfr  ( 2016-05-13 02:16:30 -0500 )edit

first one didnt work for me so i need another solution. So if I create a yaml file, i can load yaml file in launch file by rosparam command in the command line. Did i understand right? and how can i create yaml file??can you recommend a tutorial for that?

bsk gravatar image bsk  ( 2016-05-13 05:19:39 -0500 )edit

I recommend you to load your yaml file in your launch file (that one which launch your mapping node) and not in command line. In order to learn how to create a yaml file, you can see an existing yaml file of a package natively provided by ROS.

lfr gravatar image lfr  ( 2016-05-13 06:24:20 -0500 )edit

To create your yaml file, it is simple, you have just to write:

parameter: value

You write this for each parameter you want set (one parameter per line)

lfr gravatar image lfr  ( 2016-05-13 06:26:00 -0500 )edit

how can i load yaml file to orijinal launch file without rosparam command, i cant write anything in those read only launch files.

bsk gravatar image bsk  ( 2016-05-13 06:34:41 -0500 )edit

In your own launch file (that you have copied and which is not only readable) you have to add a rosparam instruction in order to load your yaml file. See this website for knowing how a launch files works and how to use the rosparam instruction:

http://wiki.ros.org/roslaunch/XML

lfr gravatar image lfr  ( 2016-05-14 02:08:04 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-05-11 15:48:25 -0500

Seen: 3,753 times

Last updated: May 12 '16