The Robotics Primer Workbook
Developed by  USC, iRobot® and Microsoft® Robotics Studio
Categories: Exercise | Player Exercise

Behavior:Exercise3-Flocking

Setup

This exercise will require a swarm of robots. Simulation is the cheapest way to create a swarm of robots for development use. See Group:Group Howto for an example of how to create a swarm of robots in simulation.

Sensing Other Robots

The blobfinder proxy can be used to determine what other robots are in the area. The following code is an example:


   PlayerCc::BlobfinderProxy* bp = (PlayerCc::BlobfinderProxy*)
     clients[i]->GetProxy(PLAYER_BLOBFINDER_CODE,i);      
   int width = bp->GetWidth();
   for( unsigned int j = 0; j < bp->GetCount(); j++ )
     printf( "x: %d y: %d\n", bp->GetBlob(j).x, bp->GetBlob(j).y );

this will print out the x and y coordinates (from the camera's point of view) of every detected blob in the scene. Robots will show up as red squares in stage.

Behaviors

1. Wander
2. Linear Safety
3. Angular Safety
4. Move toward robots

Retrieved from "http://roboticsprimer.sourceforge.net/workbook/Behavior:Exercise3-Flocking"

This page has been accessed 1,148 times. This page was last modified 00:34, 4 April 2007. Content is available under GNU Free Documentation License 1.2.


Browse
Main Page
Glossary
Sections
Prerequisites
Introduction
Robot Components
Locomotion
Sensors
Feedback Control
Deliberative Control
Reactive Control
Hybrid Control
Behavior-based Control
Emergent Behavior
Navigation
Group Robotics
Learning


Log in / create account