Exemplo n.º 1
0
void AIKnowledgeImpl::addKnowledgeController( Xml configControllers , KnowledgeController *controller )
{
	String name = controller -> getName();

	// find configuration
	Xml config = configControllers.getChildNamedNode( "controller" , name );
	ASSERTMSG( config.exists() , "Configuration not found for knowledge controller=" + name );

	if( !config.getBooleanAttribute( "run" ) ) {
		// do not use this controller
		delete controller;
		logger.logInfo( "addKnowledgeController: knowledge controller ignored as not configured to run - name=" + name );
		return;
	}

	// add controller
	controllers.add( name , controller );
	controller -> createController( config );
	logger.logInfo( "addKnowledgeController: knowledge controller created - name=" + name );
}
Exemplo n.º 2
0
void Sensors::addSensor( Xml configSensors , Sensor *att )
{
	String name = att -> getName();
	Xml config = configSensors.getChildNamedNode( "sensor" , name );

	if( config.exists() && config.getBooleanAttribute( "run" ) ) {
		sensors.add( name , att );
		logger.logInfo( "addSensor: sensor added - name=" + name );
	}
	else {
		sensorsOffline.add( name , att );
		logger.logInfo( "addSensor: sensor is not configured to run - name=" + name );
	}

	// generate cortex dimentions - square-like
	BrainLocation cortexLocation;
	int inputsDim1 , inputsDim2;
	int nInputs = att -> getNInputs( inputsDim1 , inputsDim2 );
	int outputsDim1 , outputsDim2;
	int nOutputs = att -> getNOutputs( outputsDim1 , outputsDim2 );

	// two layers: upper - control, lower - sensor data
	int dz = 2;

	// make cortex location
	int dx = max( inputsDim1 , outputsDim1 );
	int dy = max( inputsDim2 , outputsDim2 );

	cortexLocation.setDimensions( dx , dy , dz );
	cortexLocation.setOrientationZ( true );
	BrainLocation areaLocation = MindArea::getLocation();
	areaLocation.placeLocation( coverLocation , cortexLocation );

	// add to brain
	AIBrain brain;
	brain.createSensorCortex( this , cortexLocation , att );
}