Fix small bugs (#2945)

This commit is contained in:
Freek van Tienen
2022-11-04 00:29:54 +01:00
committed by GitHub
parent e616cb243b
commit d739f2830e
2 changed files with 11 additions and 3 deletions
+3 -1
View File
@@ -139,7 +139,9 @@ void imu_aspirin_event(void)
adxl345_spi_event(&imu_aspirin.acc_adxl);
if (imu_aspirin.acc_adxl.data_available) {
AbiSendMsgIMU_ACCEL_RAW(IMU_ASPIRIN_ID, now_ts, &imu_aspirin.acc_adxl.data.vect, 1, NAN);
struct Int32Vect3 accel;
VECT3_COPY(accel, imu_aspirin.acc_adxl.data.vect);
AbiSendMsgIMU_ACCEL_RAW(IMU_ASPIRIN_ID, now_ts, &accel, 1, NAN);
imu_aspirin.acc_adxl.data_available = false;
}
+8 -2
View File
@@ -52,7 +52,10 @@ def get_ids_in_log(filename):
def get_sensor_ids(ac_id, filename, sensor):
f = open(filename, 'r')
ids = []
pattern = re.compile("\S+ "+ac_id+" IMU_"+sensor+"_RAW (\S+) \S+ \S+ \S+")
if sensor == 'MAG':
pattern = re.compile("\S+ "+ac_id+" IMU_"+sensor+"_RAW (\S+) \S+ \S+ \S+")
else:
pattern = re.compile("\S+ "+ac_id+" IMU_"+sensor+"_RAW (\S+) \S+ \S+ \S+ \S+")
while True:
line = f.readline().strip()
if line == '':
@@ -67,7 +70,10 @@ def get_sensor_ids(ac_id, filename, sensor):
def read_log(ac_id, filename, sensor, sensor_id):
"""Extracts raw sensor measurements from a log."""
f = open(filename, 'r')
pattern = re.compile("(\S+) "+ac_id+" IMU_"+sensor+"_RAW "+sensor_id+" (\S+) (\S+) (\S+)")
if sensor == 'MAG':
pattern = re.compile("(\S+) "+ac_id+" IMU_"+sensor+"_RAW "+sensor_id+" (\S+) (\S+) (\S+)")
else:
pattern = re.compile("(\S+) "+ac_id+" IMU_"+sensor+"_RAW "+sensor_id+" \S+ (\S+) (\S+) (\S+)")
list_meas = []
while True:
line = f.readline().strip()