Пример #1
0
        public SensorArray(CommunicationTypes communicationTypes, BumpSensorLocations bumpSensorLocations)
        {
            communicationArray = new CommunicationArray(communicationTypes);

            bumpSensors         = new BumpSensors(bumpSensorLocations);
            bumpSensors.OnBump += new EventHandler <BumpEventArgs>(Bump);
        }
Пример #2
0
        public BumpSensors(BumpSensorLocations bumpSensorLocations)
        {
            bumpSensors = new List <BumpSensor>();

            if ((bumpSensorLocations & BumpSensorLocations.Back) != 0)
            {
                bumpSensors.Add(new BumpSensor(BumpSensorLocation.Back));
            }

            if ((bumpSensorLocations & BumpSensorLocations.Front) != 0)
            {
                bumpSensors.Add(new BumpSensor(BumpSensorLocation.Front));
            }

            if ((bumpSensorLocations & BumpSensorLocations.Left) != 0)
            {
                bumpSensors.Add(new BumpSensor(BumpSensorLocation.Left));
            }

            if ((bumpSensorLocations & BumpSensorLocations.Right) != 0)
            {
                bumpSensors.Add(new BumpSensor(BumpSensorLocation.Right));
            }

            // this is in case the bumpsensors themselves get code to invoke the bump
            foreach (BumpSensor bumpSensor in bumpSensors)
            {
                bumpSensor.OnBump += Bump;
            }
        }
Пример #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="id">The bots ID</param>
 /// <param name="communicationType">The bots communication type</param>
 /// <param name="bumpSensorLocations"></param>
 public EPROM(Guid id, CommunicationTypes communicationType, BumpSensorLocations bumpSensors)
 {
     this.communicationType = communicationType;
     this.bumpSensors       = bumpSensors;
     this.id = id;
     FileHelper.SaveROM(id, this);
     history = new History();
 }