示例#1
0
int main(int argc, char* argv[])
{
    // Virtual Worldの作成
    WorldPtr world = createWorld();
    RobotPtr robot = createRobot(world);

    // Agentの作成
    ActionPtr        action = createAction(robot);
    DistSensorPtr    sensor = createDistSensor(robot);
    EnvironmentPtr   env    = createEnvironment(sensor);
    ThreadedAgentPtr agent  = createAgent(sensor, action);

    // 初期化
    env->init();
    agent->init();
    robot->init();

    QApplication app(argc, argv);
    MainWindow window;
    window.setWorldModel(world);
    window.setRobotModel(robot);
    window.setEnvironment(env);
    window.setAgent(agent);

    window.show();
    return app.exec();
}
示例#2
0
vector<EntityPtr> Environment::makeEntityList(vector<MDPObjectState> states)
{
  vector<EntityPtr> entities;
  for (vector<MDPObjectState>::const_iterator obj_it = states.begin(); obj_it != states.end(); ++obj_it)
  {
    entities.push_back(wubble_mdp::makeEntity(*obj_it));
  }

  for (vector<EntityPtr>::iterator ent_it = entities.begin(); ent_it != entities.end(); ++ent_it)
  {
    if ((*ent_it)->getClassString() == "Robot")
    {
      RobotPtr robot = boost::dynamic_pointer_cast<Robot>(*ent_it);
      robot->init(entities); // TODO: Does this need to be somewhere else too?
    }
  }
  return entities;
}