TL;DR: See Update 3 at bottom.
I don’t know if I can celebrate just quite yet in my IMU adventures. I feel productive after creating an IMU interface:
- startIMU_NDOF_Mode.py # starts IMU in full Fusion mode using gyros, accels, and mags
- startIMU_IMUPLUS_Mode.py # starts IMU in Fusion mode using gyros and accels only
- safeReadIMU.py # Initializes software interface object without changing hardware and performs reads
- resetIMU.py # Resets heading, pitch, roll values without changing hardware mode
Evaluating the results:
- the last three docking rotations, which are commands “turn_degrees(180.0)”, actually logged values close to 180 (look at the “rotation:” values), and
- the last heading value of 355.4 does seem to correspond to what I see at the moment - Carl is sitting on the dock pointed somewhat CCW of 0 ( the line in floor boards is roughly 0)
2020-05-08 19:59|[logIMU.py.main]** resetIMU.py executed **
2020-05-08 22:35|[imulog.py.logMotionStop]heading: 2.2 rotation: 2.2 motion: 2.8 sec errors: 335
2020-05-09 04:46|[imulog.py.logMotionStop]heading: 181.0 rotation: 178.8 motion: 2.4 sec errors: 362
2020-05-09 04:47|[imulog.py.logMotionStop]heading: 1.4 rotation: 180.2 motion: 2.3 sec errors: 362
2020-05-09 04:47|[imulog.py.logMotionStop]heading: 356.9 rotation: -4.6 motion: 2.8 sec errors: 362
2020-05-09 04:47|[imulog.py.logMotionStop]heading: 356.9 rotation: 0.1 motion: 0.3 sec errors: 362
2020-05-09 04:47|[imulog.py.logMotionStop]heading: 357.2 rotation: 0.2 motion: 0.4 sec errors: 362
2020-05-09 04:47|[imulog.py.logMotionStop]heading: 357.2 rotation: 0.0 motion: 0.1 sec errors: 362
2020-05-09 06:11|[imulog.py.logMotionStop]heading: 357.8 rotation: 0.6 motion: 2.9 sec errors: 369
2020-05-09 09:13|[imulog.py.logMotionStop]heading: 178.1 rotation: 180.2 motion: 2.5 sec errors: 386
2020-05-09 09:13|[imulog.py.logMotionStop]heading: 358.8 rotation: 180.3 motion: 2.4 sec errors: 386
2020-05-09 09:14|[imulog.py.logMotionStop]heading: 355.1 rotation: -3.6 motion: 2.7 sec errors: 386
2020-05-09 09:14|[imulog.py.logMotionStop]heading: 355.2 rotation: 0.1 motion: 0.3 sec errors: 386
2020-05-09 09:14|[imulog.py.logMotionStop]heading: 355.4 rotation: 0.2 motion: 0.4 sec errors: 386
2020-05-09 09:14|[imulog.py.logMotionStop]heading: 355.4 rotation: 0.0 motion: 0.1 sec errors: 386
I am working on a calIbrate IMU program, which means Carl doesn’t get to run very long before I fiddle with him. Therefore, rigorous testing is still waiting.
The IMUPLUS mode (Fusion with Gyros and Accellerometers only, no mags) results do look more promising (+/- 2 deg from encoder values), than prior results in the full NDOF mode (Fusion with Gyros, Accels, and Mags), which was giving +/- 10 degrees over time.
I’ll just have to celebrate how fun it feels when each program has no syntax errors, and runs as expected.
(For reference - the matching wheel.log:)
2020-05-08 22:35|[wheellog.py.logMotionStop]travel: 213.9 rotation: 0.6 motion: 2.8 sec
2020-05-09 04:46|[wheellog.py.logMotionStop]travel: 0.3 rotation: 179.3 motion: 2.4 sec
2020-05-09 04:47|[wheellog.py.logMotionStop]travel: 0.3 rotation: 178.7 motion: 2.3 sec
2020-05-09 04:47|[wheellog.py.logMotionStop]travel: -211.7 rotation: -1.7 motion: 2.7 sec
2020-05-09 04:47|[wheellog.py.logMotionStop]travel: -5.0 rotation: -0.6 motion: 0.3 sec
2020-05-09 04:47|[wheellog.py.logMotionStop]travel: -10.3 rotation: 0.3 motion: 0.5 sec
2020-05-09 04:47|[wheellog.py.logMotionStop]travel: 0.0 rotation: 0.0 motion: 0.1 sec
2020-05-09 06:11|[wheellog.py.logMotionStop]travel: 214.7 rotation: 0.8 motion: 2.9 sec
2020-05-09 09:13|[wheellog.py.logMotionStop]travel: 0.3 rotation: 179.3 motion: 2.4 sec
2020-05-09 09:13|[wheellog.py.logMotionStop]travel: 0.3 rotation: 178.7 motion: 2.3 sec
2020-05-09 09:14|[wheellog.py.logMotionStop]travel: -211.1 rotation: -1.1 motion: 2.7 sec
2020-05-09 09:14|[wheellog.py.logMotionStop]travel: -4.5 rotation: 0.0 motion: 0.3 sec
2020-05-09 09:14|[wheellog.py.logMotionStop]travel: -9.5 rotation: 0.0 motion: 0.4 sec
2020-05-09 09:14|[wheellog.py.logMotionStop]travel: 0.0 rotation: 0.0 motion: 0.1 sec
Update: Undocked Heading: 356.1 degrees looks close:
2020-05-09 12:01|[imulog.py.logMotionStop]heading: 356.1 rotation: 0.8 motion: 2.8 sec errors: 398
Update 2: Undocked Heading per IMU: 354.0 Actual Looks Like 360:
Update 3: Docked Heading per IMU: 355.8 Actual Looks like 360 to me:
Started off dock IMU reading 359.4, actual looked like +1 degree to me,
then backed onto dock, IMU reading 355.8, Actual looks like 360 to me.
This is IMUPLUS mode reset 12 hours ago, so roughly 4 degrees drift.
2020-05-10 14:52|[imulog.py.logMotionStop]heading: 359.4
2020-05-10 21:04|[imulog.py.logMotionStop]heading: 177.8 rotation: 178.4 motion: 2.5 sec errors: 553
2020-05-10 21:05|[imulog.py.logMotionStop]heading: 355.7 rotation: 177.7 motion: 2.4 sec errors: 553
2020-05-10 21:05|[imulog.py.logMotionStop]heading: 355.8 rotation: 0.1 motion: 0.1 sec errors: 553
2020-05-10 21:05|[imulog.py.logMotionStop]heading: 355.7 rotation: -0.1 motion: 2.7 sec errors: 553
2020-05-10 21:05|[imulog.py.logMotionStop]heading: 355.7 rotation: 0.0 motion: 0.3 sec errors: 553
2020-05-10 21:05|[imulog.py.logMotionStop]heading: 355.8 rotation: 0.1 motion: 0.3 sec errors: 553
I saw a posting on the Bosch sensor forum that drift during non-motion is a problem when not using the earth magnetic as a reference. Can’t win with this - need magnetic, but magnetic is not reliable reference. I’m starting to believe the wheel encoders are more reliable with slightly better accuracy.
For comparison, note the corresponding two +180 degree turns recorded by the wheel encoders -0.1 degrees and -0.7 degrees, versus -1.6 degrees and -2.3 degrees from the IMU!
2020-05-10 21:04|[wheellog.py.logMotionStop]travel: 0.3 rotation: 179.9 motion: 2.4 sec
2020-05-10 21:05|[wheellog.py.logMotionStop]travel: 0.8 rotation: 179.3 motion: 2.3 sec