Hi everyone!

I am using the libstage C++ library in order to conduct a Foraging simulation. I am having some problems
with the PlaceInFreeSpace(xmin,xmax,ymin,ymax) function within Stg::Model's class.

I call it in order to place several tokens (dust) at random positions inside my simulation arena, but everytime I use
this function some dust points end up inside other models (e.g the Collector object). PlaceInFreeSpace() is based on the
protected function TestCollision(), which I understand it should prevent this situation right?. Does anybody know what I am doing wrong?

Here you have the description of the dust point model and the collector model it is colliding with :

define dust model
bitmap "bitmaps/circle.png"
size [0.02 0.02 0.02]
color "black"

blob_return 1
obstacle_return 1
boundary 1
gui_outline 1
gui_move 0

define collector model
color "brown"
obstacle_return 1            # Can hit things.
ranger_return 1              # reflects sonar beams
boundary 1
gui_outline 1
gui_move 1

And here is the code where I try to scatter dust points inside the arena :


 // Write Dust points into dustlist 
  for(this->dust_it=this->point.begin(); this->dust_it!=this->point.end(); this->dust_it++)
      dust_name_aux << "dust" << distance(this->point.begin(),this->dust_it);
      *dust_it = new dust(dust_name_aux.str());
      p = (ModelPosition*) world->GetModel((*dust_it)->name.c_str());

      // Place in free space
      // and write positions into dustList
      (*dust_it)->pose = p->GetGlobalPose();
      // We clean the name aux variable

Any recommendation would be very welcome.
Thanks a lot in advance.