From 45ca9a0e935e2bf29fd46ce751129412c6056153 Mon Sep 17 00:00:00 2001 From: Victor Lazaro Date: Thu, 30 Nov 2023 10:37:13 -0500 Subject: [PATCH 1/2] added setReorientation function --- src/SparkFun_BNO08x_Arduino_Library.cpp | 12 ++++++++++++ src/SparkFun_BNO08x_Arduino_Library.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/SparkFun_BNO08x_Arduino_Library.cpp b/src/SparkFun_BNO08x_Arduino_Library.cpp index 6db1380..dc5bd9d 100644 --- a/src/SparkFun_BNO08x_Arduino_Library.cpp +++ b/src/SparkFun_BNO08x_Arduino_Library.cpp @@ -995,6 +995,18 @@ bool BNO08x::clearTare() return true; } +bool BNO08x::setReorientation(sh2_Quaternion_t *orientation) +{ + int status = sh2_setReorientation(orientation); + + if (status != SH2_OK) + { + return false; + } + + return true; +} + // //This tells the BNO08x to begin calibrating // //See page 50 of reference manual and the 1000-4044 calibration doc // void BNO08x::sendCalibrateCommand(uint8_t thingToCalibrate) diff --git a/src/SparkFun_BNO08x_Arduino_Library.h b/src/SparkFun_BNO08x_Arduino_Library.h index bf9984f..bf29cce 100644 --- a/src/SparkFun_BNO08x_Arduino_Library.h +++ b/src/SparkFun_BNO08x_Arduino_Library.h @@ -257,6 +257,8 @@ class BNO08x bool tareNow(bool zAxis=false, sh2_TareBasis_t basis=SH2_TARE_BASIS_ROTATION_VECTOR); bool saveTare(); bool clearTare(); + + bool setReorientation(sh2_Quaternion_t *orientation); uint8_t getTapDetector(); uint64_t getTimeStamp(); From bbf2aa106abe363cc32363104f1d336a3e127c16 Mon Sep 17 00:00:00 2001 From: Pete Lewis <601236+lewispg228@users.noreply.github.com> Date: Fri, 1 Dec 2023 10:44:18 -0700 Subject: [PATCH 2/2] Attribution and function description --- README.md | 7 ++++++- src/SparkFun_BNO08x_Arduino_Library.cpp | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 67cea01..933aa37 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,13 @@ In addition the BNO08x IMU provides a built-in step counter, tap detector, activ This Arduino Library was built off the [original library](https://github.com/sparkfun/SparkFun_BNO080_Arduino_Library) written by Nathan Seidle ([SparkFun](http://www.sparkfun.com)). -Thanks to all those who have helped improve the original library: +Thanks to all those who have helped improve this library! +This BNO086 Library - CEVA-DSP Sh2 Driver-based improvements: +* LazaroFilm for adding setReorientation() [PR15](https://github.com/sparkfun/SparkFun_BNO08x_Arduino_Library/pull/15) +* rah2501 for fixing an INT/RST pin bug [PR13](https://github.com/sparkfun/SparkFun_BNO08x_Arduino_Library/pull/13) + +Original BNO080 Library improvements: * blendmaster for adding [Linear Accel report](https://github.com/sparkfun/SparkFun_BNO080_Arduino_Library/pull/4) * per1234 for fixing our [keywords file](https://github.com/sparkfun/SparkFun_BNO080_Arduino_Library/pull/12) * fm4dd for typo - [PR 19](https://github.com/sparkfun/SparkFun_BNO080_Arduino_Library/pull/19) diff --git a/src/SparkFun_BNO08x_Arduino_Library.cpp b/src/SparkFun_BNO08x_Arduino_Library.cpp index dc5bd9d..bddaeb3 100644 --- a/src/SparkFun_BNO08x_Arduino_Library.cpp +++ b/src/SparkFun_BNO08x_Arduino_Library.cpp @@ -995,6 +995,13 @@ bool BNO08x::clearTare() return true; } +// setReorientation() +// Contributed by githhub user LazaroFilm (Victor Lazaro) Nov 2023. +// https://github.com/sparkfun/SparkFun_BNO08x_Arduino_Library/pull/15 +// This function takes a quaternion and applies it to the rotation vector output as an offset. +// This can be used in conjunction to the tare functions to offset the output manually. +// To reset, simply send a zeroed out quaternion to the function. + bool BNO08x::setReorientation(sh2_Quaternion_t *orientation) { int status = sh2_setReorientation(orientation);