===== ARGoS + Buzz quick start ===== ==== Installing ARGoS ==== [[http://www.argos-sim.info|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 [[https://github.com/ilpincy/argos3-examples|examples]]. ==== Installing Buzz ==== Compile and install Buzz following the instructions reported in the [[https://github.com/MISTLab/Buzz|GitHub page]]. Make sure to compile Buzz **after** having installed ARGoS, so the compilation scripts will also compile the ARGoS integration code. ==== Library Configuration ==== The Buzz integration library for ARGoS is composed of two elements: - A set of ARGoS controllers. At the moment, available controllers include one for the [[http://www.swarmanoid.org/swarmanoid_hardware.php.html|foot-bot]], one for the Khepera IV robot (both wheeled robots), and one for the [[http://pleiades.ca|Spiri]] (a commercial quad-rotor). More can be added easily by subclassing ''CBuzzController'', defined in ''$PREFIX/include/buzz/argos/buzz_controller.h''. ''$PREFIX'' depends on your system and is usually ''/usr'' or ''/usr/local''. - A special definition of ARGoS' QtOpenGL user functions, which allow Buzz scripts to draw in the OpenGL visualization of ARGoS. 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''. ==== Defining an ARGoS experiment file ==== To use ARGoS and Buzz together, define your ''.argos'' experiment file as usual. However, instead of a custom controller, in the '''' section use '''' or '''' (or both!), depending on the robots you intend to use. For example, if you want to use both controllers, write something similar to this: ... ... ... ... ... ... Always make sure the parameters ''arena//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 '''' tag of the robot controller. The above example for the foot-bot, for example, becomes: ... ... To activate the Buzz editor and support debugging, use ''buzz_qt'' to indicate that you want to use the Buzz QtOpenGL user functions: You can launch ARGoS as usual, with the command: $ argos3 -c myexperiment.argos ==== Debugging Buzz Programs ==== === Inspecting a Robot's State === 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. === Debugging Information === The Buzz integration library offers a data structure, called ''debug'', that allows the developer to perform several operations. == Writing Text on Top of a Robot == * ''debug.print(message)'' * prints a message on top of the robot, after the robot id * ''message'' can be a combination of text and variables, such as ''"x = ", x, " cm"'' == Drawing the Trajectory of a Robot == * ''debug.trajectory.enable(maxpoints,r,g,b)'' * enable trajectory tracking setting how many points should be stored and the drawing color * ''(r,g,b)'' is the drawing color of the trajectory (0-255 for each value) * ''debug.trajectory.enable(maxpoints)'' * enable trajectory tracking setting how many points should be stored * ''debug.trajectory.enable(r,g,b)'' * enable trajectory tracking keeping maxpoints' last value and setting the drawing color * ''(r,g,b)'' is the drawing color of the trajectory (0-255 for each value) * ''debug.trajectory.enable()'' * enable trajectory tracking keeping maxpoints' last value (default is 30) * ''debug.trajectory.disable()'' * disable trajectory tracking * ''debug.trajectory.clear()'' * delete all the trajectory points == Drawing Vectors == * ''debug.rays.add(r,g,b, x,y,z)'' * draw a ray from the reference point of the robot to ''(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)'' * draw a ray from ''(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()'' * delete all the rays