void SimulationRecorderModule::init( const SteerLib::OptionDictionary & options, SteerLib::EngineInterface * engineInfo ) {

	_recFilename = "";
	_engine = engineInfo;
	_simulationWriter = NULL;

	// parse the options
	SteerLib::OptionDictionary::const_iterator optionIter;
	for (optionIter = options.begin(); optionIter != options.end(); ++optionIter) {
		if ((*optionIter).first == "retime") {
		}
		else if ((*optionIter).first == "recfile") {
			_recFilename = (*optionIter).second;
		}
	}

	//if (_recFilename == "") {
	//	throw Util::GenericException("No rec file specified for recording.");
	//}

	_initialized = false;



}
void SocialForcesAIModule::init( const SteerLib::OptionDictionary & options, SteerLib::EngineInterface * engineInfo )
{
	gEngine = engineInfo;
	gSpatialDatabase = engineInfo->getSpatialDatabase();
	_data = "";

	gUseDynamicPhaseScheduling = false;
	gShowStats = false;
	logStats = false;
	gShowAllStats = false;
	logFilename = "sfAI_Rut29.log";

	sf_acceleration = ACCELERATION;
	sf_personal_space_threshold = PERSONAL_SPACE_THRESHOLD;
	sf_agent_repulsion_importance = AGENT_REPULSION_IMPORTANCE;
	sf_query_radius = QUERY_RADIUS;
	sf_body_force = BODY_FORCE;
	sf_agent_body_force = AGENT_BODY_FORCE;
	sf_sliding_friction_force = SLIDING_FRICTION_FORCE;
	sf_agent_b = AGENT_B;
	sf_agent_a = AGENT_A;
	sf_wall_b = WALL_B;
	sf_wall_a = WALL_A;
	sf_max_speed = MAX_SPEED;


	SteerLib::OptionDictionary::const_iterator optionIter;
	for (optionIter = options.begin(); optionIter != options.end(); ++optionIter) {
		std::stringstream value((*optionIter).second);
		// std::cout << "option " << (*optionIter).first << " value " << value.str() << std::endl;
		if ((*optionIter).first == "")
		{
			value >> gLongTermPlanningPhaseInterval;
		}
		else if ((*optionIter).first == "sf_acceleration")
void TestCasePlayerModule::init( const SteerLib::OptionDictionary & options, SteerLib::EngineInterface * engineInfo ) {
	_engine = engineInfo;
	_testCaseFilename = "";
	_aiModuleName = "";
	_aiModuleSearchPath = "";
	_aiModule = NULL;
	_obstacles.clear();

	// parse command line options
	SteerLib::OptionDictionary::const_iterator optionIter;
	for (optionIter = options.begin(); optionIter != options.end(); ++optionIter) {
		if ((*optionIter).first == "testcase") {
			_testCaseFilename = (*optionIter).second;
		}
		else if ((*optionIter).first == "ai") {
			_aiModuleName = (*optionIter).second;
		}
		else {
			throw Util::GenericException("unrecognized option \"" + Util::toString((*optionIter).first) + "\" given to testCasePlayer module.");
		}
	}

	// load the module if it is not already
	if ( !_engine->isModuleLoaded(_aiModuleName) ) {
		_engine->loadModule(_aiModuleName,_aiModuleSearchPath,"");
		/// @todo add a boolean that flags this module was loaded here, so that we can unload the module after the simulation is done.
	}

	// get a pointer to the loaded module
	_aiModule = _engine->getModule(_aiModuleName);


#ifdef ENABLE_GUI
#ifdef ENABLE_QT

	QMainWindow * mainWindow = (QMainWindow*)(_engine->getEngineController()->getQtMainWindow());

	if(mainWindow != NULL) {

		/// @todo why is this tooltip attribute here, and not in the engine driver?
		mainWindow->QWidget::setAttribute(Qt::WA_AlwaysShowToolTips);

		_testCasePlayerDockWidget = new QDockWidget("Test Case Player");
		_testCasePlayerWidget = new SteerSimQt::TestCasePlayerWidget(this, _engine);
		_testCasePlayerDockWidget->setWidget(_testCasePlayerWidget);
		mainWindow->addDockWidget(Qt::RightDockWidgetArea, _testCasePlayerDockWidget);
	}
	else {
		_testCasePlayerDockWidget = NULL;
		_testCasePlayerWidget = NULL;
	}
#endif
#endif
}
void RecFilePlayerModule::init( const SteerLib::OptionDictionary & options, SteerLib::EngineInterface * engineInfo )
{
	_recFilename = "";
	_playbackSpeed = 1.0;
	_engine = engineInfo;

	// parse the options
	SteerLib::OptionDictionary::const_iterator optionIter;
	for (optionIter = options.begin(); optionIter != options.end(); ++optionIter) {
		if ((*optionIter).first == "retime") {
			std::istringstream((*optionIter).second) >> _playbackSpeed;
			if (_playbackSpeed < 0.0) {
				throw GenericException("Playback speed cannot be negative. Requested playback speed was " + toString(_playbackSpeed));
			}
		}
		else if ((*optionIter).first == "recfile") {
Beispiel #5
0
void CollisionAIModule::init( const SteerLib::OptionDictionary & options, SteerLib::EngineInterface * engineInfo )
{
	gEngine = engineInfo;
	gSpatialDatabase = engineInfo->getSpatialDatabase();

	gUseDynamicPhaseScheduling = false;
	gShowStats = false;
	logStats = false;
	gShowAllStats = false;
    logFilename = "CollisionAI.log";

	SteerLib::OptionDictionary::const_iterator optionIter;
	for (optionIter = options.begin(); optionIter != options.end(); ++optionIter) {
		std::stringstream value((*optionIter).second);
		if ((*optionIter).first == "")
		{
			value >> gLongTermPlanningPhaseInterval;
		}
		else if ((*optionIter).first == "ailogFileName")