Buzz Diffusion example in ARGoS

Requests regarding how to set up experiments in ARGoS.
ams
Posts: 3
Joined: Tue Dec 13, 2016 5:09 pm

Buzz Diffusion example in ARGoS

Postby ams » Tue Jan 10, 2017 12:16 am

I'm trying to run the Buzz programming language diffusion example in ARGoS.

My buzz code is this:

Code: Select all

#This is just the sample gradient buzz script from the wiki with some debug messages added function init() { if(id == 0) { # Source robot mydist = 0. } else { # Other robots mydist = 1000 # Listen to other robots' distances neighbors.listen("dist_to_source", function(value_id, value, robot_id) { mydist = math.min( mydist, neighbors.get(robot_id).distance + value) log("mydist = ", mydist) }) } } function step() { neighbors.broadcast("dist_to_source", mydist) debug("d=", mydist) } function destroy() { }
What I am expecting is that init() gets called, the source robot initializes its distance to zero, and all the other robots initialize their distance to 1000. Then step() gets called, and each robot broadcasts its distance to the source. When each robot hears from its neighbors, it will determine if the distance that the neighbor reports to the source, plus the distance to that neighbor, is less than the current mydist. If it is, the robot updates mydist. Robots that are neighbors of the source will get called with a distance of zero (the source is no distance from itself), so they will update mydist to be the distance from themselves to the source, and so on.

What happens instead is that init() gets called, and the initial values are set. Robot 0 gets a distance of 0, all the others are set to 1000. The debug call in step() writes the values above the robots in the simulator. The log() call in the neighbors.listen() never writes anything to the log, and the mydist values never change.

My current theory is that the messages are either not getting sent or not arriving, but I don't know why or how to debug this. I just started using ARGoS/Buzz before the holidays last year.

The robots do appear to be able to see each other, as turning rays on shows lines between them.
argos_screenshot.png
argos_screenshot.png (80.13 KiB) Viewed 6046 times

pincy
Site Admin
Posts: 632
Joined: Thu Mar 08, 2012 8:04 pm
Location: Boston, MA
Contact:

Re: Buzz Diffusion example in ARGoS

Postby pincy » Thu Jan 19, 2017 7:03 am

Hi ams,

The reason for the messages not being sent is due to the fact that the RAB device sends packets of 10 bytes at most, but the messages you're sending use more bytes than that (internally).

In your .argos file, try using the attribute rab_data_size to increase the bytes sent, like this:

Code: Select all

<foot-bot id="fb0" rab_data_size="100"> ... <controller config="bcf" /> </foot-bot>
I fixed the documentation on the Buzz website as well. Thanks for spotting this!

Cheers,
Carlo
I made ARGoS.


Return to “How to... ?”