Ask Your Question
1

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
2

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

BlitherPants gravatar image

Hi,

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: http://linuxconfig.org/bash-scripting...

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

#!/bin/bash
source /opt/ros/hydro/setup.bash
gnome-terminal -e /home/turtlebot/Scripts/roscore.sh
sleep 5
rosparam set use_sim_time true
a=1
gnome-terminal -e '/home/turtlebot/Scripts/playbag.sh '"$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 playbag.sh script I have:

#!/bin/bash
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

2 followers

Stats

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

Seen: 177 times

Last updated: Dec 10 '14