Ask Your Question

repeating the simulation

asked 2014-05-05 21:48:54 -0500

Hi, I made a localization simulation in ROS using stage and amcl running from launch file. I would like to repeat the simulation for 1000 times, is there an easy way, tools or tricks to do that?

BR Anas

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-12-10 13:20:08 -0500

BlitherPants gravatar image


I'm not familiar with Stage, but if you just want to repeat a bunch of launch files, you could use bash scripting.

There are a bunch of online tutorials to do this, such as:

For each launch file, I use a separate script. So I have one main script, say, "", which then runs the separate launch files. So in "", you might have the following lines:

source /opt/ros/hydro/setup.bash
gnome-terminal -e /home/turtlebot/Scripts/
sleep 5
rosparam set use_sim_time true
gnome-terminal -e '/home/turtlebot/Scripts/ '"$a"
let a=a+1

You would need to enclose some loop around the scripts you wanted repeated, of course. Here, each "gnome-terminal" opens the new script as a separate window so you can put a .launch file in each, running it as you would in a normal typed terminal. For instance, in my script I have:

echo "Running bag "$1

source /opt/ros/hydro/setup.bash
cd ~/NewMapDump
rosbag play --clock -r 1 /tmp/newurgmount-straight-2.bag
rosrun map_server map_saver -f ''$1
edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools



Asked: 2014-05-05 21:48:54 -0500

Seen: 177 times

Last updated: Dec 10 '14