Home

Awesome

fastsim

Fastsim is a fast, lightweight simulator of a wheeled robot (khepera-like).

This is the library version. A Sferes2 module and ros module are available in separate repositories. The ROS module currently uses this library, but not the sferes one (not yet).

If you use this software in an academic article, please cite:

Mouret, J.-B. and Doncieux, S. (2012). Encouraging Behavioral Diversity in Evolutionary Robotics: an Empirical Study. Evolutionary Computation. Vol 20 No 1 Pages 91-133.

Usage & installation

Depedencies:

Academic papers that use faststim

Minimal documentation

Fastsim uses a bitmap (a pbm file) as an environment. It uses pixel-wise collision detection and interesection tests (lasers). There are two coordinate systems: world coordinates, and pixel coordinates. In general, everything is expressed in world coordinate and a scaling is automatically applied by fastsim to get the pixel coordinates.

Units:

Main classes:

Objects:

Sensors:

Example with a configuration file


#include <iostream>
#include "fastsim.hpp"

int main(int argc, char** argv) {
  using namespace fastsim;
  assert(argc == 2);
  fastsim::Settings settings(argv[1]);
  boost::shared_ptr<Map> map = settings.map();
  boost::shared_ptr<Robot> robot = settings.robot();

  Display d(map, *robot);

  for (int i = 0; i < 10000; ++i)
    {
      d.update();
      robot->move(1.0, 1.1, map);
      usleep(1000);
    }
  return 0;
}

Configuration file:

<?xml version="1.0"?>
<fastsim>
  <display enable="true"/>
  <!-- world -->
  <map name="worlds/cuisine.pbm" size="600"/>
  <robot x="300" y="300" theta="0" diameter="30"/>
  <illuminated_switch x="250" y="450" color="0" radius="10" on="true"/>
  <light_sensor angle="100" color="0" angular_range="50"/>
  <goal x="100" y="100" color="0" diameter="10"/>

  <!-- sensors (optionals) -->
  <laser range="100" angle="45"/>
  <laser range="100" angle="-45"/>
  <!-- <laser_scanner angle_min="-100" angle_max="100" angle_inc="2" range="300"/> -->
  <radar slices="4" color="0"/>
</fastsim>

Example without a configuration file

#include <iostream>
#include "fastsim.hpp"

int main()
{
  try
    {
      using namespace fastsim;
      boost::shared_ptr<Map> m = boost::shared_ptr<Map>(new Map("cuisine.pbm", 600));
      m->add_goal(Goal(100, 100, 10, 0));
      Robot r(20.0f, Posture(200, 200, 0));
      r.add_laser(Laser(M_PI / 4.0, 100.0f));
      r.add_laser(Laser(-M_PI / 4.0, 100.0f));
      r.add_laser(Laser(0.0f, 100.0f));
      r.add_radar(Radar(0, 4));
      Display d(m, r);

      float x = 30;
      for (int i = 0; i < 10000; ++i)
	{
	  d.update();
	  r.move(1.0, 1.1, m);
	}
    }
  catch (fastsim::Exception e)
    {
      std::cerr<<"error : "<<e.get_msg()<<std::endl;
    }
  return 0;
}