Example #1
0
 def test_ambu_just_passed(self):
     print('Testing test_ambu_just_passed')
     pd = ProcessData()
     res = pd.pick_message(
             {'longitude' : 38.8888, 'latitude' : 38.8889, 'timestamp' : 81},
             {'longitude' : 38.8888, 'latitude' : 38.8888, 'timestamp' : 80},
             {'longitude' : 38.8888, 'latitude' : 38.8890, 'timestamp' : 81},
             {'longitude' : 38.8888, 'latitude' : 38.88881, 'timestamp' : 80}
         )
      
     self.assertEqual(res, 3)
Example #2
0
 def test_not_relevant(self):
     print('Testing test_not_relevant')
     pd = ProcessData()
     res = pd.pick_message(
             {'longitude' : 38.8888, 'latitude' : 38.8888, 'timestamp' : 81},
             {'longitude' : 38.8888, 'latitude' : 38.8889, 'timestamp' : 80},
             {'longitude' : 38.8888, 'latitude' : 39.8888, 'timestamp' : 81},
             {'longitude' : 38.8888, 'latitude' : 39.8889, 'timestamp' : 80}
         )
      
     self.assertEqual(res, 0)
Example #3
0
 def test_ambu_2_minutes_behind(self):
     print('Testing test_ambu_2_minutes_behind')
     pd = ProcessData()
     res = pd.pick_message(
             {'longitude' : 38.8888, 'latitude' : 38.8889, 'timestamp' : 81},
             {'longitude' : 38.8888, 'latitude' : 38.8888, 'timestamp' : 80},
             {'longitude' : 38.8888, 'latitude' : 38.8790, 'timestamp' : 81},
             {'longitude' : 38.8888, 'latitude' : 38.8788, 'timestamp' : 80}
         )
      
     self.assertEqual(res, 2)
Example #4
0
    def test_double_message(self):
        print('Testing double message')
        pd = ProcessData()

        res = pd.pick_message(
                {'longitude' : 38.8888, 'latitude' : 38.8888, 'timestamp' : 81},
                {'longitude' : 38.8888, 'latitude' : 38.8889, 'timestamp' : 80},
                {'longitude' : 38.8888, 'latitude' : 38.8588, 'timestamp' : 81},
                {'longitude' : 38.8888, 'latitude' : 38.8589, 'timestamp' : 80}
            )
        second_res = pd.pick_message(
                {'longitude' : 38.8888, 'latitude' : 38.8888, 'timestamp' : 81},
                {'longitude' : 38.8888, 'latitude' : 38.8889, 'timestamp' : 80},
                {'longitude' : 38.8888, 'latitude' : 38.8588, 'timestamp' : 81},
                {'longitude' : 38.8888, 'latitude' : 38.8589, 'timestamp' : 80}
            )
         
        self.assertEqual(second_res, 0)
Example #5
0
    def run(self):
        '''Check if receiver has got a new data point, if so process data'''
        print('=========== new run ===============')

        while len(self.car.position_history) > 1 and \
                len(self.ambulance.position_history) > 1:
            old_ambu, new_ambu = self.car.get_data()
            old_car, new_car = self.ambulance.get_data()
            self.process_data.is_relevant(new_car, old_car, new_ambu, old_ambu)
# =======
        self.vechicle1 = Vehicle(start_ahead=True)
        self.vechicle2 = Vehicle(speed=3)
        self.process_data = ProcessData(self.vechicle1,self.vechicle2)
# =======
        self.amb = Vehicle(speed=10)
        self.car = Vehicle(start_ahead=True)
        self.process_data = ProcessData(self.amb,self.car)
# >>>>>>> Mapview
        self.map = MapView()
        self.text_speech = TextToSpeech()
Example #6
0
class Main:

    def __init__(self):
# <<<<<<< HEAD
# <<<<<<< HEAD
        self.ambulance = Vehicle(speed=2)
        self.car = Vehicle(start_ahead=True)
        self.process_data = ProcessData(self.car,self.ambulance)

    def run(self):
        '''Check if receiver has got a new data point, if so process data'''
        print('=========== new run ===============')

        while len(self.car.position_history) > 1 and \
                len(self.ambulance.position_history) > 1:
            old_ambu, new_ambu = self.car.get_data()
            old_car, new_car = self.ambulance.get_data()
            self.process_data.is_relevant(new_car, old_car, new_ambu, old_ambu)
# =======
        self.vechicle1 = Vehicle(start_ahead=True)
        self.vechicle2 = Vehicle(speed=3)
        self.process_data = ProcessData(self.vechicle1,self.vechicle2)
# =======
        self.amb = Vehicle(speed=10)
        self.car = Vehicle(start_ahead=True)
        self.process_data = ProcessData(self.amb,self.car)
# >>>>>>> Mapview
        self.map = MapView()
        self.text_speech = TextToSpeech()

    def run(self):
        '''Check two vehicle objects against each other and process data, show a map with one plot'''

        while len(self.amb.format_position_history)>1 and len(self.car.format_position_history)>1:
            old_ambu, new_ambu = self.amb.get_data()
            self.map.plot_coordinates(old_ambu['longitude'],old_ambu['latitude'],'rs')
            old_car, new_car = self.car.get_data()
            self.map.plot_coordinates(old_car['longitude'], old_car['latitude'],'bs')
# <<<<<<< HEAD
            self.process_data.is_relevant(new_car, old_car, new_ambu, old_ambu)
        self.map.show_map()
Example #7
0
    def __init__(self):
# <<<<<<< HEAD
# <<<<<<< HEAD
        self.ambulance = Vehicle(speed=2)
        self.car = Vehicle(start_ahead=True)
        self.process_data = ProcessData(self.car,self.ambulance)