Skip to content

Commit

Permalink
Rename fault detection flags
Browse files Browse the repository at this point in the history
  • Loading branch information
waltjohnson committed Jan 12, 2025
1 parent cd3eb13 commit 4987c86
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 17 deletions.
50 changes: 36 additions & 14 deletions python/logInspector/logPlotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1034,17 +1034,30 @@ def imuStatus(self, fig=None, axs=None):
if fig is None:
fig = plt.figure()
ax = fig.subplots(1, 1, sharex=True)
fig.suptitle('IMU Status - ' + os.path.basename(os.path.normpath(self.log.directory)))

for d in self.active_devs:
r = d == self.active_devs[0] # plot text w/ first device
cnt = 0

time = self.getData(d, DID_PIMU, 'time')
time = self.getData(d, DID_PIMU, 'time')
status = self.getData(d, DID_PIMU, 'status')
title = 'PIMU Status - '
if not len(time):
time = self.getData(d, DID_IMU, 'time')
status = self.getData(d, DID_IMU, 'status')
title = 'IMU Status - '
if not len(time):
time = self.getData(d, DID_IMU3_RAW, 'time')
status = self.getData(d, DID_IMU3_RAW, 'status')
title = 'IMU3-RAW Status - '
if not len(time):
return

fig.suptitle(title + os.path.basename(os.path.normpath(self.log.directory)))

towOffset = self.getData(d, DID_GPS1_POS, 'towOffset')
if towOffset.size:
if len(towOffset) > 0:
time = getTimeFromGpsTow(time + np.mean(towOffset))
status = self.getData(d, DID_PIMU, 'status')

ax.plot(time, -cnt * 1.5 + ((status & 0x00000001) != 0))
p1 = ax.get_xlim()[0] + 0.02 * (ax.get_xlim()[1] - ax.get_xlim()[0])
Expand Down Expand Up @@ -1224,21 +1237,16 @@ def hdwStatus(self, fig=None, axs=None):

ax.plot(instime, -cnt * 1.5 + ((hStatus & 0x00000001) != 0))
p1 = ax.get_xlim()[0] + 0.02 * (ax.get_xlim()[1] - ax.get_xlim()[0])
if r: ax.text(p1, -cnt * 1.5, 'Motion Gyr Sig')
if r: ax.text(p1, -cnt * 1.5, 'Motion Gyr')
cnt += 1
ax.plot(instime, -cnt * 1.5 + ((hStatus & 0x00000002) != 0))
if r: ax.text(p1, -cnt * 1.5, 'Motion Acc Sig')
if r: ax.text(p1, -cnt * 1.5, 'Motion Acc')
cnt += 1
ax.plot(instime, -cnt * 1.5 + ((hStatus & 0x00000004) != 0))
if r: ax.text(p1, -cnt * 1.5, 'Motion Gyr Dev')
cnt += 1
ax.plot(instime, -cnt * 1.5 + ((hStatus & 0x00000005) != 0))
if r: ax.text(p1, -cnt * 1.5, 'Motion Acc Dev')
if r: ax.text(p1, -cnt * 1.5, 'Fault Detect Gyr')
cnt += 1
cnt += 1

ax.plot(instime, -cnt * 1.5 + ((hStatus & 0x00000010) != 0))
if r: ax.text(p1, -cnt * 1.5, 'Satellite Rx')
ax.plot(instime, -cnt * 1.5 + ((hStatus & 0x00000008) != 0))
if r: ax.text(p1, -cnt * 1.5, 'Fault Detect Acc')
cnt += 1
cnt += 1

Expand All @@ -1256,6 +1264,20 @@ def hdwStatus(self, fig=None, axs=None):
cnt += 1
cnt += 1

ax.plot(instime, -cnt * 1.5 + ((hStatus & 0x00000010) != 0))
if r: ax.text(p1, -cnt * 1.5, 'Satellite Rx')
cnt += 1
ax.plot(instime, -cnt * 1.5 + ((hStatus & 0x00000020) != 0))
if r: ax.text(p1, -cnt * 1.5, 'Strong In')
cnt += 1
ax.plot(instime, -cnt * 1.5 + ((hStatus & 0x00000040) != 0))
if r: ax.text(p1, -cnt * 1.5, 'GPS TOW Valid')
cnt += 1
ax.plot(instime, -cnt * 1.5 + ((hStatus & 0x00000080) != 0))
if r: ax.text(p1, -cnt * 1.5, 'Ref IMU Rx')
cnt += 1
cnt += 1

ax.plot(instime, -cnt * 1.5 + ((hStatus & 0x00002000) != 0))
if r: ax.text(p1, -cnt * 1.5, 'EKF using ref. IMU')
cnt += 1
Expand Down
6 changes: 3 additions & 3 deletions src/data_sets.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,11 @@ enum eHdwStatusFlags
/** Unit is moving and NOT stationary */
HDW_STATUS_MOTION_MASK = (int)0x00000003,
/** IMU gyro fault detection. One of the redundant gyro sensors is not in agreement and being excluded. */
HDW_STATUS_IMU_GYR_FAULT = (int)0x00000004,
HDW_STATUS_IMU_FAULT_DETECT_GYR = (int)0x00000004,
/** IMU accelerometer fault detection. One of the redundant accelerometer sensors is not in agreement and being excluded. */
HDW_STATUS_IMU_ACC_FAULT = (int)0x00000008,
HDW_STATUS_IMU_FAULT_DETECT_ACC = (int)0x00000008,
/** IMU fault detection mask. One of the redundant IMU sensors is not in agreement and being excluded. */
HDW_STATUS_IMU_FAULT_MASK = (int)0x0000000C,
HDW_STATUS_IMU_FAULT_DETECT_MASK = (int)0x0000000C,

/** GPS satellite signals are being received (antenna and cable are good). Unset indicates weak signal or no output from GPS receiver. */
HDW_STATUS_GPS_SATELLITE_RX = (int)0x00000010,
Expand Down

0 comments on commit 4987c86

Please sign in to comment.