Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unprocessable Batch bytes #49

Open
hopwoodc opened this issue Feb 2, 2024 · 9 comments
Open

Unprocessable Batch bytes #49

hopwoodc opened this issue Feb 2, 2024 · 9 comments

Comments

@hopwoodc
Copy link

hopwoodc commented Feb 2, 2024

I am trying to get a BNO086 working. I'm getting this error:

Adafruit CircuitPython 8.2.9 on 2023-12-06; Raspberry Pi Pico with rp2040
>>> 
>>> import board
>>> import busio
>>> from adafruit_bno08x.i2c import BNO08X_I2C
>>> from adafruit_bno08x import BNO_REPORT_ACCELEROMETER
>>> import board
>>> scl=board.GP17
>>> sda=board.GP16
>>> i2c=busio.I2C(scl,sda)
>>> bno = BNO08X_I2C(i2c, address=0x4b)
>>> bno.enable_feature(BNO_REPORT_ACCELEROMETER)

                ********** Packet *************
DBG::            HEADER:
DBG::            Data Len: 2
DBG::            Channel: SHTP_COMMAND (0)
DBG::            Sequence number: 4

DBG::            Data:
DBG::           [0x04] 0x01 0x0E 
                *******************************

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "adafruit_bno08x/__init__.py", line 999, in enable_feature
  File "adafruit_bno08x/__init__.py", line 803, in _process_available_packets
  File "adafruit_bno08x/__init__.py", line 863, in _handle_packet
  File "adafruit_bno08x/__init__.py", line 858, in _handle_packet
  File "adafruit_bno08x/__init__.py", line 379, in _separate_batch
RuntimeError: ('Unprocessable Batch bytes', 2)

I'm able to read data every couple of times, but am often getting error messages like this.

@rohangarg2001
Copy link

Getting the same error while using BNO086

@BentPen
Copy link

BentPen commented Mar 14, 2024

Still having this issue as well. BNO085, with Raspberry Pi 3B+.

@ReedTruax
Copy link

I am also having this issue with a PI Pico

@BentPen
Copy link

BentPen commented Mar 18, 2024

@ReedTruax I ended up giving up on the BNO085 and bought a LSM9DS1, which worked very nicely. Granted, I didn't use the Adafruit code, but rather the code from this other repo here: https://github.com/Richard-Gemmell/lsm9ds1-rjg. I have no opinion on the Adafruit code, but saw that in his repo Richard Gemmell took the time to incorporate all the data sheet functionality (in particular, sending special bytes to registers to control ODR--output data rate). His work was a goldmine. (Though if you decide to go the same route as I did, take a brief look at the issue I made there.)

@diplodocuslongus
Copy link

Still having this issue as well. BNO085, with Raspberry Pi 3B+.

For me it's a BNO086, same RPi 3B+, bookworm. No reading so far.

@Andrew123098
Copy link

Any solutions? I am having the same issue with a BNO086 using a Raspberry Pi Zero 2 W

@Andrew123098
Copy link

Okay so a parshal solution to this problem has been found. Here is the specific error I had which I believe is the same as the error above:

                ********** Packet *************
DBG::            HEADER:
DBG::            Data Len: 2
DBG::            Channel: SHTP_COMMAND (0)
DBG::            Sequence number: 4

DBG::            Data:
DBG::           [0x04] 0x01 0x0E
                *******************************

Traceback (most recent call last):
  File "/home/pi/dronepi/Examples/read_IMU.py", line 15, in <module>
    bno.enable_feature(BNO_REPORT_ACCELEROMETER)
  File "/home/pi/dronepi/env/lib/python3.11/site-packages/adafruit_bno08x/__init__.py", line 999, in enable_feature
    self._process_available_packets(max_packets=10)
  File "/home/pi/dronepi/env/lib/python3.11/site-packages/adafruit_bno08x/__init__.py", line 803, in _process_available_packets
    self._handle_packet(new_packet)
  File "/home/pi/dronepi/env/lib/python3.11/site-packages/adafruit_bno08x/__init__.py", line 863, in _handle_packet
    raise error
  File "/home/pi/dronepi/env/lib/python3.11/site-packages/adafruit_bno08x/__init__.py", line 858, in _handle_packet
    _separate_batch(packet, self._packet_slices)
  File "/home/pi/dronepi/env/lib/python3.11/site-packages/adafruit_bno08x/__init__.py", line 379, in _separate_batch
    raise RuntimeError("Unprocessable Batch bytes", unprocessed_byte_count)
RuntimeError: ('Unprocessable Batch bytes', 2)

The solution found was to go into the __init __ .py file and comment out the exception raised in the _handle_packet function on line 863. By commenting this out, the code is allowed to continue. All this does is allow the IMU to send bad data to you, but after about a second, it starts sending good data and works perfectly.

I still do not know why the IMU is sending bad data for the first second or so of initializing. Perhaps it would be wise to add a pause after initialization before reading values in over I2C? Regardless, this fixed the problem. You can see below the output of the bno08x_more_reports.py code below: *NOTE I changed the I2C frequency to 400kHz.

                ********** Packet *************
DBG::            HEADER:
DBG::            Data Len: 2
DBG::            Channel: SHTP_COMMAND (0)
DBG::            Sequence number: 4

DBG::            Data:
DBG::           [0x04] 0x01 0x0E
                *******************************


                ********** Packet *************
DBG::            HEADER:
DBG::            Data Len: 3
DBG::            Channel: SHTP_COMMAND (0)
DBG::            Sequence number: 7

DBG::            Data:
DBG::           [0x04] 0x01 0x0E 0x0E
                *******************************


                ********** Packet *************
DBG::            HEADER:
DBG::            Data Len: 4
DBG::            Channel: SHTP_COMMAND (0)
DBG::            Sequence number: 10

DBG::            Data:
DBG::           [0x04] 0x01 0x0E 0x0E 0x0E
                *******************************


                ********** Packet *************
DBG::            HEADER:
DBG::            Data Len: 5
DBG::            Channel: SHTP_COMMAND (0)
DBG::            Sequence number: 13

DBG::            Data:
DBG::           [0x04] 0x01 0x0E 0x0E 0x0E
DBG::           [0x08] 0x0E
                *******************************


                ********** Packet *************
DBG::            HEADER:
DBG::            Data Len: 6
DBG::            Channel: SHTP_COMMAND (0)
DBG::            Sequence number: 16

DBG::            Data:
DBG::           [0x04] 0x01 0x0E 0x0E 0x0E
DBG::           [0x08] 0x0E 0x0E
                *******************************


                ********** Packet *************
DBG::            HEADER:
DBG::            Data Len: 7
DBG::            Channel: SHTP_COMMAND (0)
DBG::            Sequence number: 19

DBG::            Data:
DBG::           [0x04] 0x01 0x0E 0x0E 0x0E
DBG::           [0x08] 0x0E 0x0E 0x0E
                *******************************


                ********** Packet *************
DBG::            HEADER:
DBG::            Data Len: 8
DBG::            Channel: SHTP_COMMAND (0)
DBG::            Sequence number: 22

DBG::            Data:
DBG::           [0x04] 0x01 0x0E 0x0E 0x0E
DBG::           [0x08] 0x0E 0x0E 0x0E 0x0E
                *******************************


                ********** Packet *************
DBG::            HEADER:
DBG::            Data Len: 9
DBG::            Channel: SHTP_COMMAND (0)
DBG::            Sequence number: 25

DBG::            Data:
DBG::           [0x04] 0x01 0x0E 0x0E 0x0E
DBG::           [0x08] 0x0E 0x0E 0x0E 0x0E
DBG::           [0x0C] 0x0E
                *******************************


                ********** Packet *************
DBG::            HEADER:
DBG::            Data Len: 11
DBG::            Channel: SHTP_COMMAND (0)
DBG::            Sequence number: 31

DBG::            Data:
DBG::           [0x04] 0x01 0x0E 0x0E 0x0E
DBG::           [0x08] 0x0E 0x0E 0x0E 0x0E
DBG::           [0x0C] 0x0E 0x0E 0x0E
                *******************************


                ********** Packet *************
DBG::            HEADER:
DBG::            Data Len: 11
DBG::            Channel: SHTP_COMMAND (0)
DBG::            Sequence number: 36

DBG::            Data:
DBG::           [0x04] 0x01 0x0E 0x0E 0x0E
DBG::           [0x08] 0x0E 0x0E 0x0E 0x0E
DBG::           [0x0C] 0x0E 0x0E 0x0C
                *******************************


                ********** Packet *************
DBG::            HEADER:
DBG::            Data Len: 11
DBG::            Channel: SHTP_COMMAND (0)
DBG::            Sequence number: 39

DBG::            Data:
DBG::           [0x04] 0x01 0x0E 0x0E 0x0E
DBG::           [0x08] 0x0E 0x0E 0x0E 0x0E
DBG::           [0x0C] 0x0E 0x0E 0x0C
                *******************************


                ********** Packet *************
DBG::            HEADER:
DBG::            Data Len: 11
DBG::            Channel: SHTP_COMMAND (0)
DBG::            Sequence number: 42

DBG::            Data:
DBG::           [0x04] 0x01 0x0E 0x0E 0x0E
DBG::           [0x08] 0x0E 0x0E 0x0E 0x0E
DBG::           [0x0C] 0x0E 0x0E 0x0C
                *******************************

Gyro:
X: 0.001953  Y: 0.000000 Z: -0.001953 rads/s

Magnetometer:
X: -13.500000  Y: 4.062500 Z: -31.750000 uT

Linear Acceleration:
X: 0.011719  Y: 0.015625 Z: 0.023438 m/s^2

Rotation Vector Quaternion:
I: 0.001892  J: -0.078796 K: -0.000183  Real: 0.996887

Geomagnetic Rotation Vector Quaternion:
I: -0.154297  J: -0.283447 K: -1.995850  Real: 3.451416
Game Rotation Vector Quaternion:
I: 0.001953  J: -0.078796 K: -0.000244  Real: 0.996887

Steps detected: 0

Stability classification: Unknown

Activity classification: Unknown confidence: 91/100
Raw Acceleration:
X: 0x0008  Y: 0xFD88 Z: 0x0F50 LSB

Raw Gyro:
X: 0xFFFE  Y: 0x0000 Z: 0x0000 LSB

Raw Magnetometer:
X: 0xFFBE  Y: 0xFFB8 Z: 0xFBED LSB

SHAKE DETECTED!

Gyro:
X: 0.000000  Y: 0.000000 Z: 0.000000 rads/s

Magnetometer:
X: -14.187500  Y: 5.062500 Z: -30.500000 uT

Linear Acceleration:
X: 0.011719  Y: 0.000000 Z: -0.007812 m/s^2

Rotation Vector Quaternion:
I: 0.001953  J: -0.079712 K: -0.000244  Real: 0.996826

Geomagnetic Rotation Vector Quaternion:
I: -0.161621  J: -0.279541 K: -2.087891  Real: 3.396484
Game Rotation Vector Quaternion:
I: 0.002014  J: -0.079651 K: -0.000244  Real: 0.996826

Steps detected: 0

Stability classification: On Table

Activity classification: Unknown confidence: 91/100
Raw Acceleration:
X: 0x0000  Y: 0xFD70 Z: 0x0F50 LSB

Raw Gyro:
X: 0xFFFD  Y: 0x0001 Z: 0xFFFF LSB

Raw Magnetometer:
X: 0xFFC4  Y: 0xFFA6 Z: 0xFBE5 LSB

Gyro:
X: 0.000000  Y: 0.000000 Z: 0.000000 rads/s

Magnetometer:
X: -13.750000  Y: 4.187500 Z: -30.125000 uT

Linear Acceleration:
X: 0.023438  Y: 0.019531 Z: 0.011719 m/s^2

Rotation Vector Quaternion:
I: 0.002014  J: -0.080261 K: -0.000244  Real: 0.996765

Geomagnetic Rotation Vector Quaternion:
I: -0.164795  J: -0.277832 K: -2.116211  Real: 3.378906
Game Rotation Vector Quaternion:
I: 0.002014  J: -0.080261 K: -0.000244  Real: 0.996765

Steps detected: 0

@Nate711
Copy link

Nate711 commented Oct 22, 2024

I have the exact same problem as well

@Nate711
Copy link

Nate711 commented Oct 22, 2024

@siddacious

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants