"Panic" while running bluerobotics_navigator, resource busy

Hello, I’m having trouble running the navigator. when I run the example I get a ResousceBusy exception. It remains even after full power cycle:

I start from a newly loaded SD card. I ssh to the pi and here’s my bash history from there:

$ sudo apt install pip
$ sudo pip install bluerobotics_navigator
$ nano test.py # copy the python snippet from here https://bluerobotics.com/learn/navigator-developer-guide/

$ sudo python test.py # WORKS, LED turns on
$ sudo apt update
$ sudo apt upgrade
$ sudo python test.py 
thread '<unnamed>' panicked at 'Error : Error on magnetometer during self-test: DataNotReady', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/navigator-rs-0.3.0/src/lib.rs:395:14

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Traceback (most recent call last):

  File "/home/pi/test.py", line 3, in <module>

    navigator.init()

pyo3_runtime.PanicException: Error : Error on magnetometer during self-test: DataNotReady
$ sudo python test.py 
# works again
$ poweroff
# power cycle
$ sudo python test.py
thread '<unnamed>' panicked at 'Error: Error during CS2 export: Io(Os { code: 16, kind: ResourceBusy, message: "Device or resource busy" })', /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/navigator-rs-0.3.0/src/lib.rs:311:23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
  File "/home/pi/test.py", line 3, in <module>
    navigator.init()
pyo3_runtime.PanicException: Error: Error during CS2 export: Io(Os { code: 16, kind: ResourceBusy, message: "Device or resource busy" })

From there on, it never gets out of that exception, even after reboots.

Anyone knows what I’m missing (and how to get the device ready again?)

Thank you!

Hi @g_b

The apt get update itself isn’t a problem,
but if you run apt get upgrade it can be, as it updates the OS’s kernel, and current navigator/BlueOS releases are based on a previous kernel.

sudo SKIP_WARNING=1 rpi-update 1340be4
should downgrade to the BlueOS current supported kernel

1 Like

Thank you @RaulTrombin it does work I could recover direct access to the PWM’s through the python API.

Now I have a follow up question (maybe it warants another topic): setting the PWM seems to mess up with ardusub: I’m trying to read the mavlink attitude message, and also publish the PWM’s; to no avail.

How would you do that? I’ve tried to set the servos through mavlink rather than through the python api; but it seems that MAV_CMD_DO_SET_SERVO only allows setting one servo at a time every 1/50Hz, which is a bit slow.

Any hack you recommend?
Thank you!

Nice that worked !

Navigator libraries do access the hardware sensors directly, so it’s recommended to use them with ardusub disabled.

When the navigator libraries’ init() function is called, for example, it resets and configures the sensors, so it could break any ardusub routines in progress.

In navigator libraries, you can use the set_pwm_channels_value() or set_pwm_channels_values() functions, which will modify all the selected desired channels at once.
https://docs.bluerobotics.com/navigator-lib/python/#bluerobotics_navigator.set_pwm_channels_value

Thank you for the explanation @RaulTrombin , good to know!

Since I do want some of the ardupilot machinery for now (in particular the estimator) I ended up using pymavlink’s rc_channels_override_send function. (in hindsight, sticking to mavlink to talk to the navigator makes sense)

1 Like