|Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.|
Running patrolling_sim (fuerte) -- DEPRECATEDDescription: This tutorial describes how to run the patrolling_sim package in Stage/ROS. An example is presented for ease of understanding.
Keywords: stage, patrolling_sim, Multi-Robot Patrol strategies.
Tutorial Level: INTERMEDIATE
Warning: This tutorial is OLD and DEPRECATED. Please refer to the newer versionHERE.
Tutorial by Example
In this example, we will be running the patrolling_sim package using 6 robots performing a "Conscientious Reactive" (CR) patrol strategy in "Cumberland" map (provided in the package).
Compiling the Package
In the patrolling_sim folder, run "rosmake" to compile the package:
Bring Stage Up
Let's bring the Stage window up, with map "Cumberland" and 6 robots.
$ roslaunch patrolling_sim cumberland_stage6robots.launch
Launch Navigation Stack Packages
Let's launch the necessary packages from the Navigation Stack (for six robots and using the "Cumberland" map), which is used in patrolling_sim.
$ roslaunch patrolling_sim cumberland_6robots.launch
Run the "monitor" node
Now, we should run the monitor node, passing the "Cumberland" graph file, the "Conscientious Reactive" (CR) algorithm and 6 robots as parameters.
$ rosrun patrolling_sim monitor maps/cumberland/cumberland.graph CR 6
Run the Algorithm with the intended number of robots
In this example, we should run six instances of the "Conscientious Reactive" (CR) algorithm, one for each robot:
$ rosrun patrolling_sim Conscientious_Reactive __name:=CR_robot0 maps/cumberland/cumberland.graph 0
$ rosrun patrolling_sim Conscientious_Reactive __name:=CR_robot1 maps/cumberland/cumberland.graph 1
$ rosrun patrolling_sim Conscientious_Reactive __name:=CR_robot2 maps/cumberland/cumberland.graph 2
$ rosrun patrolling_sim Conscientious_Reactive __name:=CR_robot3 maps/cumberland/cumberland.graph 3
$ rosrun patrolling_sim Conscientious_Reactive __name:=CR_robot4 maps/cumberland/cumberland.graph 4
$ rosrun patrolling_sim Conscientious_Reactive __name:=CR_robot5 maps/cumberland/cumberland.graph 5
The final result, should look something like this:
Run the package on multiple machines
For higher number of robots, it is recommended to run the ROS nodes in different machines. For example, if you want to run a simulation with 8 robots, you can run stage, monitor and 2 robots on one computer; and 3 robots on two other computers.
In this example, you would need to run step 2.2 and 2.4 (with 8 robots) in the first computer. For step 2.3, you should create 3 separate lunch files, please see:
.../patrolling_sim/launch/cumberland/cumberland_8robots_A.launch .../patrolling_sim/launch/cumberland/cumberland_8robots_B.launch .../patrolling_sim/launch/cumberland/cumberland_8robots_C.launch
and "roslaunch" them on each pc. Finally, for step 2.5 you just need to run robots 0 and 1 in the first machine, robots 2-4 in the second machine and robots 5-7 in the third machine.
For more information on running nodes in different computers you should read the ''Multiple Machines Tutorial''.
To speed up the process, a few shell script files are provided to start the simulations:
Execution Script: run.sh - Uncomment the corresponding line to bypass steps 2.2 and 2.3 when executed.
Algorithm Script: c_reactive.sh - Uncomment the corresponding line to bypass step 2.5 when executed.
To use different patrolling strategies, change the algorithm name in step 2.4 and uncomment the required line in the corresponding script: c_cognitive.sh, cyclic.sh, GBS.sh, hc_reactive.sh, msp.sh, run.sh or SEBS.sh.
You can eventually modify the algorithms scripts to also run the monitor node (step 4).