Inheritance: AbstractUpdateableComponent
 public void GPSUpdatedHandler(GPSCoordinates coordinates)
 {
     if (PropertyChanged != null)
     {
         PropertyChanged(this, new PropertyChangedEventArgs("Coordinates"));
     }
 }
Beispiel #2
0
        public RoverStatus()
        {
            Motors = new Dictionary <Motor.Location, Motor>(6);
            Motors.Add(Motor.Location.FrontLeft, new Motor(Motor.Location.FrontLeft));
            Motors.Add(Motor.Location.FrontRight, new Motor(Motor.Location.FrontRight));
            Motors.Add(Motor.Location.BackLeft, new Motor(Motor.Location.BackLeft));
            Motors.Add(Motor.Location.BackRight, new Motor(Motor.Location.BackRight));
            Motors.Add(Motor.Location.MiddleLeft, new Motor(Motor.Location.MiddleLeft));
            Motors.Add(Motor.Location.MiddleRight, new Motor(Motor.Location.MiddleRight));

            Battery        = new Battery(2000);
            GPSCoordinates = new GPSCoordinates();
            IMUSensor      = new IMU();
            RoboArm        = new RoboticArm();
        }
        public RoverStatus()
        {
            Motors = new Dictionary<Motor.Location, Motor>(6);
            Motors.Add(Motor.Location.FrontLeft, new Motor(Motor.Location.FrontLeft));
            Motors.Add(Motor.Location.FrontRight, new Motor(Motor.Location.FrontRight));
            Motors.Add(Motor.Location.BackLeft, new Motor(Motor.Location.BackLeft));
            Motors.Add(Motor.Location.BackRight, new Motor(Motor.Location.BackRight));
            Motors.Add(Motor.Location.MiddleLeft, new Motor(Motor.Location.MiddleLeft));
            Motors.Add(Motor.Location.MiddleRight, new Motor(Motor.Location.MiddleRight));

            Battery = new Battery(2000);
            GPSCoordinates = new GPSCoordinates();
            IMUSensor = new IMU();
            RoboArm = new RoboticArm();
        }
 //Updated coordinates from status update
 private void UpdateGPS(GPSCoordinates gpsCoordinates)
 {
     roverCoordinates = gpsCoordinates;
     roverCoordinateString = "Rover: " + gpsCoordinates.Location.ToString();
 }
        /// <summary>
        /// (DEPRECATED) Binds the rover location data being sent by StatusUpdater to PushPin on the Map
        /// </summary>
        private void setRoverPinLocation()
        {
            bool messageReceived = false;
            var startTime = DateTime.UtcNow;

            roverCoordinates = new GPSCoordinates();
            roverPin = new Pushpin();

            //Wait for the StatusUpdater to send the location of the rover BEFORE the pushpin is set, or else DataBinding will not occur
            while (roverCoordinates.Location == null && (DateTime.UtcNow - startTime < TimeSpan.FromSeconds(2)))
            {
                //loop until the rover coordinates have been received, timeout after 2 seconds
                messageReceived = true;
            }

            //if the message was successfully received, bind the location
            if (messageReceived)
            {
                roverPin.Location = roverCoordinates.Location;

                formatRoverPin();
            }
        }