public override void populateSensors(int size) { sensors = new List <ISensor>(); List <double> sensorAngles = new List <double>(); double sensorStart = -1.3398; double sensorEnd = 1.3398; double delta = (sensorEnd - sensorStart) / (size - 1); double x = sensorStart; for (int y = 0; y < size; y++) { sensorAngles.Add(x);//sensor_angles[y]); x += delta; } foreach (double val in sensorAngles) { RangeFinder r = new RangeFinder(val, this, actualRange + radius, this.sensorNoise); sensors.Add(r); } }
//public PackBotModel(int id, double nx, double ny, double dir, // AgentBrain agentBrain, Environment environment, // float sensorNoise, float effectorNoise, float headingNoise, float timeStep) //{ // steps = 0; // this.id = id; // updatecounter = 0; // path = new List<Point2D>(); // location = new Point2D(nx, ny); // circle = new Circle2D(location, radius); // old_location = new Point2D(location); // radius = radius; // heading = dir; // velocity = 0.0; // collide_last = false; // this.timeStep = timeStep; // this.environment = environment; // this.agentBrain = agentBrain; // this.sensorNoise = sensorNoise; // this.effectorNoise = effectorNoise; // this.headingNoise = headingNoise; // populateSensors(); //} //public override void populateSensors() //{ // populateSensors(defaultSensorDensity()); //} public override void populateSensors(int size) { sensors = new List<ISensor>(); List<double> sensorAngles = new List<double>(); double sensorStart = -1.57; double sensorEnd = 1.57; double delta = (sensorEnd - sensorStart) / (size - 1); double x = sensorStart; for (int y = 0; y < size; y++) { sensorAngles.Add(x);//sensor_angles[y]); x += delta; } foreach (double val in sensorAngles) { RangeFinder r = new RangeFinder(val, this, 400.0,this.sensorNoise); r.set_delta(30, 0.5); sensors.Add(r); } }