Example #1
0
 def read_input_data(self, dirpath):
     control_data = Dataset.read_raw_control_data(
         os.path.join(dirpath, "input", "input_control.csv"))
     laser_intensity_data = Dataset.read_raw_laser_intensity_data(
         os.path.join(dirpath, "input", "input_laser.csv"))
     self.ts2control = {}
     self.ts2laser = {}
     self.ts2intensity = {}
     control_i = 0
     laser_intensity_i = 0
     for ts, time in enumerate(self.timestamps):
         if self.ts2sensor[ts] == 'gps':
             pass
         elif self.ts2sensor[ts] == 'control':
             assert_feq(time, control_data[control_i][0], 2)
             self.ts2control[ts] = control_data[control_i][1:]
             control_i += 1
         elif self.ts2sensor[ts] == 'laser':
             assert_feq(time, laser_intensity_data[laser_intensity_i][0], 2)
             row = laser_intensity_data[laser_intensity_i]
             self.ts2laser[ts] = row[1:1 + LASER_COLS]
             self.ts2intensity[ts] = row[1 + LASER_COLS:]
             laser_intensity_i += 1
         else:
             assert False
     assert control_i == len(control_data)
     assert laser_intensity_i == len(laser_intensity_data)
Example #2
0
    def read_ground_data(self, dirpath):
        # Obstacles:
        self.ground_obstacles = []
        path = os.path.join(dirpath, "eval_data", "eval_obstacles.csv")
        with open(path) as csv_file:
            reader = csv.reader(csv_file)
            header = reader.next()
            assert header[0] == 'GPSLon'
            for row in reader:
                assert len(row) == 2
                self.ground_obstacles.append((float(row[0]), float(row[1])))

        # Everything else:
        gps_data = Dataset.read_raw_gps_data(
            os.path.join(dirpath, "eval_data", "eval_gps.csv"))
        control_data = Dataset.read_raw_control_data(
            os.path.join(dirpath, "eval_data", "eval_control.csv"))
        laser_intensity_data = Dataset.read_raw_laser_intensity_data(
            os.path.join(dirpath, "eval_data", "eval_laser.csv"))
        self.ground_ts2gps = {}
        self.ground_ts2control = {}
        self.ground_ts2laser = {}
        self.ground_ts2intensity = {}
        gps_i = 0
        control_i = 0
        laser_intensity_i = 0
        for ts, time in enumerate(self.timestamps):
            if self.ts2sensor[ts] == 'gps':
                assert_feq(time, gps_data[gps_i][0], 2)
                row = gps_data[gps_i]
                self.ground_ts2gps[ts] = [row[2], row[1], row[3]]
                gps_i += 1
            elif self.ts2sensor[ts] == 'control':
                assert_feq(time, control_data[control_i][0], 2)
                self.ground_ts2control[ts] = control_data[control_i][1:]
                control_i += 1
            elif self.ts2sensor[ts] == 'laser':
                assert_feq(time, laser_intensity_data[laser_intensity_i][0], 2)
                row = laser_intensity_data[laser_intensity_i]
                self.ground_ts2laser[ts] = row[1:1 + LASER_COLS]
                self.ground_ts2intensity[ts] = row[1 + LASER_COLS:]
                laser_intensity_i += 1
            else:
                assert False
        assert gps_i == len(gps_data)
        assert control_i == len(control_data)
        assert laser_intensity_i == len(laser_intensity_data)