fix two warning

This commit is contained in:
Kalman
2018-08-01 20:20:39 +08:00
parent a7750e8217
commit d2b4cc3022
6 changed files with 63 additions and 46 deletions

View File

@@ -288,14 +288,14 @@ def _parse_args():
'--rate-img',
dest='rate_img',
metavar='RATE',
default=25,
default=60,
type=int,
help='the img rate (default: %(default)s)')
parser.add_argument(
'--rate-imu',
dest='rate_imu',
metavar='RATE',
default=500,
default=200,
type=int,
help='the imu rate (default: %(default)s)')
return parser.parse_args()

View File

@@ -75,12 +75,14 @@ void Dataset::SaveStreamData(
void Dataset::SaveMotionData(const device::MotionData &data) {
auto &&writer = GetMotionWriter();
auto seq = motion_count_;
writer->ofs << seq << ", " << data.imu->timestamp << ", "
<< data.imu->accel[0] << ", " << data.imu->accel[1] << ", "
<< data.imu->accel[2] << ", " << data.imu->gyro[0] << ", "
<< data.imu->gyro[1] << ", " << data.imu->gyro[2] << ", "
<< data.imu->temperature << std::endl;
++motion_count_;
if (data.imu->flag == 1 || data.imu->flag == 2) {
writer->ofs << seq << ", " << data.imu->timestamp << ", "
<< data.imu->accel[0] << ", " << data.imu->accel[1] << ", "
<< data.imu->accel[2] << ", " << data.imu->gyro[0] << ", "
<< data.imu->gyro[1] << ", " << data.imu->gyro[2] << ", "
<< data.imu->temperature << std::endl;
++motion_count_;
}
}
Dataset::writer_t Dataset::GetStreamWriter(const Stream &stream) {
@@ -102,7 +104,7 @@ Dataset::writer_t Dataset::GetStreamWriter(const Stream &stream) {
files::mkdir(writer->outdir);
writer->ofs.open(writer->outfile, std::ofstream::out);
writer->ofs << "seq, timestamp, exposure_time" << std::endl;
writer->ofs << "seq, frame_id, timestamp, exposure_time" << std::endl;
writer->ofs << FULL_PRECISION;
stream_writers_[stream] = writer;
@@ -126,6 +128,8 @@ Dataset::writer_t Dataset::GetMotionWriter() {
motion_writer_ = writer;
motion_count_ = 0;
accel_count_ = 0;
gyro_count_ = 0;
}
return motion_writer_;
}

View File

@@ -54,6 +54,8 @@ class Dataset {
std::map<Stream, std::size_t> stream_counts_;
std::size_t motion_count_;
std::size_t accel_count_;
std::size_t gyro_count_;
};
} // namespace tools

View File

@@ -339,9 +339,9 @@ class MYNTEYE(Dataset):
if index == -1:
sys.exit('Error: Dataset is unexpected format, timestamp not found')
# unit from 0.01ms to 1s
info.timebeg = float(first.split(',')[index].strip()) * 0.00001
info.timeend = float(last.split(',')[index].strip()) * 0.00001
# unit from 1us to 1s
info.timebeg = float(first.split(',')[index].strip()) * 0.000001
info.timeend = float(last.split(',')[index].strip()) * 0.000001
# print('time: [{}, {}]'.format(info.timebeg, info.timeend))
return info
@@ -364,7 +364,7 @@ class MYNTEYE(Dataset):
for line in f:
values = [_.strip() for _ in line.split(',')]
img = Image()
img.timestamp = float(values[fields['timestamp']]) * 0.00001
img.timestamp = float(values[fields['timestamp']]) * 0.000001
yield {What.img_left: img}
if hit_img_right and self._info.has_img_right:
with open(self._info.img_right_txt) as f:
@@ -372,7 +372,7 @@ class MYNTEYE(Dataset):
for line in f:
values = [_.strip() for _ in line.split(',')]
img = Image()
img.timestamp = float(values[fields['timestamp']]) * 0.00001
img.timestamp = float(values[fields['timestamp']]) * 0.000001
yield {What.img_right: img}
if (hit_imu or hit_temp) and self._info.has_imu:
with open(self._info.imu_txt) as f:
@@ -380,7 +380,7 @@ class MYNTEYE(Dataset):
for line in f:
values = [_.strip() for _ in line.split(',')]
imu = IMU()
imu.timestamp = float(values[fields['timestamp']]) * 0.00001
imu.timestamp = float(values[fields['timestamp']]) * 0.000001
imu.accel_x = float(values[fields['accel_x']])
imu.accel_y = float(values[fields['accel_y']])
imu.accel_z = float(values[fields['accel_z']])