ARGoS is a fast multi-robot simulator that can interoperate with Buzz.
To install ARGoS, go to http://www.argos-sim.info/core.php and install a binary package. To get started with ARGoS, refer to the examples.
Compile and install Buzz following the instructions reported in the GitHub page. Make sure to compile Buzz after having installed ARGoS, so the compilation scripts will also compile the ARGoS integration code.
The Buzz integration library for ARGoS is composed of two elements:
CBuzzController
, defined in $PREFIX/include/buzz/argos/buzz_controller.h
. $PREFIX
depends on your system and is usually /usr
or /usr/local
.
To have ARGoS find the Buzz integration library in case you installed it in a non-default location, set the environment variable ARGOS_PLUGIN_PATH
. This variable is a :
-separated list of directories in which ARGoS looks for libraries before launching an experiment. For instance:
$ export ARGOS_PLUGIN_PATH=/opt/lib/buzz
If you installed Buzz without specifying a custom installation prefix (e.g., using only cmake -DCMAKE_BUILD_TYPE=Release ../src; make; make install
), you don't need to set ARGOS_PLUGIN_PATH
.
To use ARGoS and Buzz together, define your .argos
experiment file as usual.
However, instead of a custom controller, in the <controllers>
section use <buzz_controller_footbot>
or <buzz_controller_spiri>
(or both!), depending on the robots you intend to use. For example, if you want to use both controllers, write something similar to this:
<!-- For a full example of an ARGoS configuration file, refer to https://github.com/ilpincy/argos3-examples/blob/master/experiments/diffusion_1.argos and the other examples at https://github.com/ilpincy/argos3-examples/blob/master/experiments/ --> ... <controllers> <!-- Include this if you're using foot-bots --> <buzz_controller_footbot id="bcf"> <actuators> <differential_steering implementation="default" /> <leds implementation="default" medium="leds" /> <range_and_bearing implementation="default" /> </actuators> <sensors> <range_and_bearing implementation="medium" medium="rab" show_rays="true" noise_std_dev="0" /> </sensors> <params /> </buzz_controller_footbot> <!-- Include this if you're using Khepera IV --> <buzz_controller_kheperaiv id="bckiv"> <actuators> <differential_steering implementation="default" /> <leds implementation="default" medium="leds" /> <range_and_bearing implementation="default" /> </actuators> <sensors> <range_and_bearing implementation="medium" medium="rab" show_rays="true" noise_std_dev="0" /> </sensors> <params /> </buzz_controller_kheperaiv> <!-- Include this if you're using Spiri --> <buzz_controller_spiri id="bcs"> <actuators> <quadrotor_position implementation="default" /> <range_and_bearing implementation="default" /> </actuators> <sensors> <range_and_bearing implementation="medium" medium="rab" show_rays="false" /> <positioning implementation="default" /> </sensors> <params /> </buzz_controller_spiri> </controllers> ... <arena ...> <!-- Place a foot-bot in the arena --> <foot-bot id="fb0" rab_data_size="100"> ... <controller config="bcf" /> </foot-bot> <!-- Place a Khepera IV in the arena --> <kheperaiv id="fb0" rab_data_size="100"> ... <controller config="bcf" /> </kheperaiv> <!-- Place a Spiri in the arena --> <spiri id="fb0" rab_data_size="100"> ... <controller config="bcs" /> </spiri> </arena> ...
Always make sure the parameters arena/<robot>/rab_data_size
are set to relatively large values, such as 100 bytes as reported in the above examples.
If you want ARGoS to start with a Buzz script already loaded, you can specify that in the <params />
tag of the robot controller. The above example for the foot-bot, for example, becomes:
... <buzz_controller_footbot id="bcf"> <actuators> <differential_steering implementation="default" /> <leds implementation="default" medium="leds" /> <range_and_bearing implementation="default" /> </actuators> <sensors> <range_and_bearing implementation="medium" medium="rab" show_rays="true" noise_std_dev="0" /> </sensors> <!-- This loads the specified files at startup --> <params bytecode_file="myscript.bo" debug_file="myscript.bdb" /> </buzz_controller_footbot> ...
To activate the Buzz editor and support debugging, use buzz_qt
to indicate that you want to use the Buzz QtOpenGL user functions:
<!-- For a full example of an ARGoS configuration file, refer to https://github.com/ilpincy/argos3-examples/blob/master/experiments/diffusion_1.argos --> <visualization> <qt-opengl> <user_functions label="buzz_qt" /> </qt-opengl> </visualization>
You can launch ARGoS as usual, with the command:
$ argos3 -c myexperiment.argos
To understand what's happening on a specific robot, shift-click on it in the ARGoS visualization to select it. This opens a tree widget in the Buzz editor that reports the value of all the variables, and the list of available functions on the robot.
The Buzz integration library offers a data structure, called debug
, that allows the developer to perform several operations.
debug.print(message)
message
can be a combination of text and variables, such as “x = ”, x, “ cm”
debug.trajectory.enable(maxpoints,r,g,b)
(r,g,b)
is the drawing color of the trajectory (0-255 for each value)debug.trajectory.enable(maxpoints)
debug.trajectory.enable(r,g,b)
(r,g,b)
is the drawing color of the trajectory (0-255 for each value)debug.trajectory.enable()
debug.trajectory.disable()
debug.trajectory.clear()
debug.rays.add(r,g,b, x,y,z)
(x,y,z)
.(x,y,z)
is expressed wrt the robot reference frame(r,g,b)
is the color of the vector (0-255 for each value)debug.rays.add(r,g,b, x0,y0,z0, x1,y1,z1)
(x0,y0,z0)
to (x1,y1,z1)
(x0,y0,z0)
and (x1,y1,z1)
are expressed wrt the robot reference frame(r,g,b)
is the color of the vector (0-255 for each value)debug.rays.clear()