adafruit / Adafruit_CircuitPython_BNO08x

Helper library for the Hillcrest Laboratories BNO080 IMU
MIT License
22 stars 29 forks source link

Library does not install properly on Raspberry Pi #5

Closed jerryneedell closed 3 years ago

jerryneedell commented 3 years ago

I have tried installing this library on a Raspberry Pi4 via pip3 and it says it installs but when I try to use it it reports that there is not adafruit_bno8x module

When I look where my python3 modules are stored by pip3, I do not see a folder fo adafruit_bno8x. there is a folder adafruit_circuitpython_bno08x-1.0.0.dist-info but not the actual module.

i have tried installing it both via pip3 install adafruit_circuitpython_bno0x8 and sudo pip3 install adafruit_circuitpython_bno0x8

the results are the same pip3 install to ~/.local/lib/python3.7/dist-packages/ sudo pip3 install to /usr/local/lib/python3.7/dist-packages/

jerryneedell commented 3 years ago

The bno08x_simpletest.py script runs normally if I run it from a folder with the adafruit_bno08x library in it.

the bno0x8_more_reports.py script fails with this error


pi@gjnpi4ram4g:~/projects/blinka/bno08x $ python3 bno08x_more_reports.py 
Acceleration:
X: 7.699219  Y: 5.476562 Z: 2.679688  m/s^2

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

Magnetometer:
X: -59.187500  Y: 18.125000 Z: 49.625000 uT

Linear Acceleration:
X: -0.003906  Y: -0.007812 Z: -0.015625 m/s^2

Rotation Vector Quaternion:
I: 0.254333  J: -0.544922 K: -0.143860  Real: 0.785950

Geomagnetic Rotation Vector Quaternion:
I: -0.305176  J: -2.390137 K: -2.165771  Real: 2.345947
Game Rotation Vector Quaternion:
I: 0.254517  J: -0.545044 K: -0.143860  Real: 0.785828

Steps detected: 0

Stability classification: On Table

Activity classification: Unknown confidence: 77/100
Raw Acceleration:
X: 0x08F0  Y: 0xF360 Z: 0x0470 LSB

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

Raw Magnetometer:
X: 0x03B3  Y: 0xFEE4 Z: 0x0314 LSB

SHAKE DETECTED!

Acceleration:
X: 7.699219  Y: 5.476562 Z: 2.679688  m/s^2

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

Magnetometer:
X: -58.875000  Y: 18.125000 Z: 49.250000 uT

Linear Acceleration:
X: -0.011719  Y: 0.500000 Z: -0.515625 m/s^2

Rotation Vector Quaternion:
I: 0.254639  J: -0.545471 K: -0.143799  Real: 0.785461

Geomagnetic Rotation Vector Quaternion:
I: -0.291992  J: -2.392334 K: -2.150391  Real: 2.359619
Game Rotation Vector Quaternion:
I: 0.254639  J: -0.545471 K: -0.143738  Real: 0.785461

        ********** Packet *************
DBG::        HEADER:
DBG::        Data Len: 11
DBG::        Channel: INPUT_SENSOR_REPORTS (3)
DBG::           ** UNKNOWN Report Type **: 0x7b
DBG::        Sequence number: 14

DBG::        Data:
DBG::       [0x04] 0x7B 0x50 0x80 0x00 
DBG::       [0x08] 0x00 0x13 0x3B 0x03 
DBG::       [0x0C] 0x00 0x01 0x00 
        *******************************

Traceback (most recent call last):
  File "bno08x_more_reports.py", line 91, in <module>
    print("Steps detected:", bno.steps)
  File "/home/pi/projects/blinka/bno08x/adafruit_bno08x/__init__.py", line 567, in steps
    self._process_available_packets()
  File "/home/pi/projects/blinka/bno08x/adafruit_bno08x/__init__.py", line 783, in _process_available_packets
    self._handle_packet(new_packet)
  File "/home/pi/projects/blinka/bno08x/adafruit_bno08x/__init__.py", line 841, in _handle_packet
    raise error
  File "/home/pi/projects/blinka/bno08x/adafruit_bno08x/__init__.py", line 836, in _handle_packet
    _separate_batch(packet, self._packet_slices)
  File "/home/pi/projects/blinka/bno08x/adafruit_bno08x/__init__.py", line 351, in _separate_batch
    required_bytes = _report_length(report_id)
  File "/home/pi/projects/blinka/bno08x/adafruit_bno08x/__init__.py", line 340, in _report_length
    return _AVAIL_SENSOR_REPORTS[report_id][2]
KeyError: 123
ladyada commented 3 years ago

on a raspi you may have to use clockstretching hacks

jerryneedell commented 3 years ago

Ah- will look into clock stretching. But there is still something wrong with the pip install...

FoamyGuy commented 3 years ago

I think the pip install issue is inside the setup.py file here: https://github.com/adafruit/Adafruit_CircuitPython_BNO08x/blob/cac28f28159fa0a5bcee29227179ad5a45156ddf/setup.py#L58

I think it needs to be changed to packages instead of py_modules and it should fix installing via pip.

siddacious commented 3 years ago

@FoamyGuy Is right; I'll take care of this later today

FoamyGuy commented 3 years ago

fixed with #6