示例#1
0
    def __init__(self, serial_data, vehicle_event_dispatcher):

        splitted_data = serial_data.split(',')

        gyro_data = Vector3D(splitted_data[0], splitted_data[1],
                             splitted_data[2])
        vehicle_event_dispatcher.dispatch_event(
            VehicleEventDispatcher.GYRO_DATA_EVENT, gyro_data)

        accel_data = Vector3D(splitted_data[3], splitted_data[4],
                              splitted_data[5])
        vehicle_event_dispatcher.dispatch_event(
            VehicleEventDispatcher.ACCEL_DATA_EVENT, accel_data)

        mag_data = Vector3D(splitted_data[6], splitted_data[7],
                            splitted_data[8])
        vehicle_event_dispatcher.dispatch_event(
            VehicleEventDispatcher.MAGNETOMETER_DATA_EVENT, mag_data)
示例#2
0
 def unpack_data():
     try:
         serial_data = self._date_output_queue.get()
         splitted_data = serial_data.split(',')
         accel_raw_data_vector = Vector3D(float(splitted_data[0]),
                                          float(splitted_data[1]),
                                          float(splitted_data[2]))
         self._vehicle_event_dispatcher.dispatch_event(
             VehicleEventDispatcher.ACCEL_RAW_DATA_EVENT,
             accel_raw_data_vector)
     except:
         logging.error(
             "Protocol Handler: Failed to notify update accel raw data")
         print "Protocol Handler: Failed to notify update accel raw data"
示例#3
0
 def unpack_data():
     if not self._date_output_queue.empty():
         try:
             serial_data = self._date_output_queue.get()
             values = serial_data.split(',')
             magnetometer_raw_vector = Vector3D(values[0], values[1],
                                                values[2])
             self._vehicle_event_dispatcher.dispatch_event(
                 VehicleEventDispatcher.MAGNETOMETER_RAW_DATA_EVENT,
                 magnetometer_raw_vector)
         except:
             logging.error(
                 "Protocol Handler: Failed to notify update magnetometer raw data"
             )
             print "Protocol Handler: Failed to notify update magnetometer raw data"