buzz_argos

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
buzz_argos [2016/04/10 00:12] – created ilpincybuzz_argos [2018/03/18 23:31] root
Line 11: Line 11:
 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. 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.
  
-==== ARGoS + Buzz ==== +==== Library Configuration ====
- +
-=== Integration: Basic information ===+
  
 The Buzz integration library for ARGoS is composed of two elements: 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]] (wheeled robot) 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 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. With these, a developer can write debugging information on top of each robot.+ 
 +  - 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:+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:
  
 <code bash> <code bash>
Line 26: Line 25:
 </code> </code>
  
-If you installed Buzz without specifying a custom installation prefix (e.g., using only ''cmake ../src; make; make install''), you don't need to set ''ARGOS_PLUGIN_PATH''.+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 ===+==== Defining an ARGoS experiment file ====
  
 To use ARGoS and Buzz together, define your ''.argos'' experiment file as usual. To use ARGoS and Buzz together, define your ''.argos'' experiment file as usual.
Line 35: Line 34:
  
 <code xml> <code xml>
 +<!-- 
 +     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> <controllers>
  
 +  <!-- Include this if you're using foot-bots -->
   <buzz_controller_footbot id="bcf">   <buzz_controller_footbot id="bcf">
     <actuators>     <actuators>
Line 46: Line 58:
       <range_and_bearing implementation="medium" medium="rab" show_rays="true" noise_std_dev="0" />       <range_and_bearing implementation="medium" medium="rab" show_rays="true" noise_std_dev="0" />
     </sensors>     </sensors>
-    <params bytecode_file="myscript.bo" debug_file="myscript.bdbg" />+    <params />
   </buzz_controller_footbot>   </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">   <buzz_controller_spiri id="bcs">
     <actuators>     <actuators>
Line 58: Line 84:
       <positioning       implementation="default" />       <positioning       implementation="default" />
     </sensors>     </sensors>
-    <params bytecode_file="myscript.bo" debug_file="myscript.bdbg" />+    <params />
   </buzz_controller_spiri>   </buzz_controller_spiri>
  
 </controllers> </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>
 +
 +...
 +
 </code> </code>
  
-To activate drawinguse ''buzz_qt'' to indicate that you want to use the Buzz QtOpenGL user functions:+If you want ARGoS to start with a Buzz script already loadedyou can specify that in the ''<params />'' tag of the robot controller. The above example for the foot-bot, for example, becomes:
  
 <code xml> <code xml>
 +  ...
 +
 +  <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>
 +  
 +  ...
 +  
 +</code>
 +
 +To activate the Buzz editor and support debugging, use ''buzz_qt'' to indicate that you want to use the Buzz QtOpenGL user functions:
 +
 +<code xml>
 +<!-- For a full example of an ARGoS configuration file, refer to
 +     https://github.com/ilpincy/argos3-examples/blob/master/experiments/diffusion_1.argos
 +-->
 +
 <visualization> <visualization>
   <qt-opengl>   <qt-opengl>
Line 80: Line 160:
 </code> </code>
  
-Make sure the paths of the Buzz files (e.g., ''myscript.bo'' and ''myscript.bdbg'' in the above example) are set correctly.+Make sure the parameters ''arena/<robot>/rab%%_%%msg%%_%%size'' are set to relatively large values, such as 100 bytes as reported in the above examples.
  
-=== Writing debug information ===+==== Debugging Buzz Programs ====
  
-The Buzz integration library offers command, called ''debug()'', that allows the developer to write text on top of a robot as shown in this example:+=== Inspecting Robot's State ===
  
-<code buzz> +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. 
-10 + 
-debug("The value of x is ", x) +=== Debugging Information === 
-</code>+ 
 +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, " 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 ==
  
-This will print ''The value of x is 10'' on top of each robot that executes that command.+  * ''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
  • buzz_argos.txt
  • Last modified: 2018/03/18 23:34
  • by root