New Problem: could not find an available, non-overlapping IPv4 when running Python

Just ran into a new issue with trying to run a python script. I am trying to implement the new Madgwick Fusion algorithm: xioTechnologies/Fusion

There is a imufusion package on pypi for the library.

What I am seeing is that if I create a requirements.txt file with

imufusion
numpy
matoplot

but when I try to run:

from arduino.app_utils import *
import time
from arduino.app_utils import App, Bridge
import matplotlib.pyplot as plt
import numpy as np
import sys

Import sensor data

data = np.genfromtxt("sensor_data.csv", delimiter=",", skip_header=1)

sample_rate = 100  # 100 Hz

timestamp = data[:, 0]
gyroscope = data[:, 1:4]
accelerometer = data[:, 4:7]
magnetometer = data[:, 7:10]

Instantiate algorithms

offset = imufusion.Offset(sample_rate)
ahrs = imufusion.Ahrs()

ahrs.settings = imufusion.Settings(
imufusion.CONVENTION_NWU,  # convention
0.5,  # gain
2000,  # gyroscope range
10,  # acceleration rejection
10,  # magnetic rejection
5 * sample_rate,  # recovery trigger period = 5 seconds
)

Process sensor data

delta_time = np.diff(timestamp, prepend=timestamp[0])

euler = np.empty((len(timestamp), 3))
internal_states = np.empty((len(timestamp), 6))
flags = np.empty((len(timestamp), 4))

for index in range(len(timestamp)):
gyroscope[index] = offset.update(gyroscope[index])

ahrs.update(gyroscope[index], accelerometer[index], magnetometer[index], delta_time[index])

euler[index] = ahrs.quaternion.to_euler()

ahrs_internal_states = ahrs.internal_states
internal_states[index] = np.array(
    [
        ahrs_internal_states.acceleration_error,
        ahrs_internal_states.accelerometer_ignored,
        ahrs_internal_states.acceleration_recovery_trigger,
        ahrs_internal_states.magnetic_error,
        ahrs_internal_states.magnetometer_ignored,
        ahrs_internal_states.magnetic_recovery_trigger,
    ]
)

ahrs_flags = ahrs.flags
flags[index] = np.array(
    [
        ahrs_flags.initialising,
        ahrs_flags.angular_rate_recovery,
        ahrs_flags.acceleration_recovery,
        ahrs_flags.magnetic_recovery,
    ]
)

def plot_bool(axis, x, y, label):
axis.plot(x, y, "tab:cyan", label=label)
plt.sca(axis)
plt.yticks([0, 1], ["False", "True"])
axis.grid()
axis.legend()

Plot Euler angles

figure, axes = plt.subplots(nrows=11, sharex=True, gridspec_kw={"height_ratios": [6, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1]})

figure.suptitle("Euler angles, internal states, and flags")

axes[0].plot(timestamp, euler[:, 0], "tab:red", label="Roll")
axes[0].plot(timestamp, euler[:, 1], "tab:green", label="Pitch")
axes[0].plot(timestamp, euler[:, 2], "tab:blue", label="Yaw")
axes[0].set_ylabel("Degrees")
axes[0].grid()
axes[0].legend()

Plot initialising flag

plot_bool(axes[1], timestamp, flags[:, 0], "Initialising")

Plot angular rate recovery flag

plot_bool(axes[2], timestamp, flags[:, 1], "Angular rate recovery")

Plot acceleration rejection internal states and flag

axes[3].plot(timestamp, internal_states[:, 0], "tab:olive", label="Acceleration error")
axes[3].set_ylabel("Degrees")
axes[3].grid()
axes[3].legend()

plot_bool(axes[4], timestamp, internal_states[:, 1], "Accelerometer ignored")

axes[5].plot(timestamp, internal_states[:, 2], "tab:orange", label="Acceleration recovery trigger")
axes[5].grid()
axes[5].legend()

plot_bool(axes[6], timestamp, flags[:, 2], "Acceleration recovery")

Plot magnetic rejection internal states and flag

axes[7].plot(timestamp, internal_states[:, 3], "tab:olive", label="Magnetic error")
axes[7].set_ylabel("Degrees")
axes[7].grid()
axes[7].legend()

plot_bool(axes[8], timestamp, internal_states[:, 4], "Magnetometer ignored")

axes[9].plot(timestamp, internal_states[:, 5], "tab:orange", label="Magnetic recovery trigger")
axes[9].grid()
axes[9].legend()

plot_bool(axes[10], timestamp, flags[:, 3], "Magnetic recovery")

plt.show(block="dont_block" not in sys.argv)  # don't block when script run by CI

app.run()

I get a weird error message and noted that none of packages is downloaded:

Starting app "Madgwick_fusion_test"
Sketch profile configured: FQBN="arduino:zephyr:unoq", Port=""
The library ArxContainer has been automatically added from sketch project.
The library ArxTypeTraits has been automatically added from sketch project.
The library DebugLog has been automatically added from sketch project.
The library MsgPack has been automatically added from sketch project.
Sketch uses 241 bytes (0%) of program storage space. Maximum is 1966080 bytes.
Global variables use 0 bytes (0%) of dynamic memory, leaving 523624 bytes for local variables. Maximum is 523624 bytes.
Open On-Chip Debugger 0.12.0+dev-ge6a2c12f4 (2025-05-22-15:51)
Licensed under GNU GPL v2
For bug reports, read






debug_level: 2
clock_config
/tmp/remoteocd/sketch.elf-zsk.bin
Info : Linux GPIOD JTAG/SWD bitbang driver (libgpiod v2)
Info : Note: The adapter "linuxgpiod" doesn't support configurable speed
Info : SWD DPIDR 0x0be12477
Info : [stm32u5.ap0] Examination succeed
Info : [stm32u5.cpu] Cortex-M33 r0p4 processor detected
Info : [stm32u5.cpu] target has 8 breakpoints, 4 watchpoints
Info : [stm32u5.cpu] Examination succeed
Info : [stm32u5.ap0] gdb port disabled
Info : [stm32u5.cpu] starting gdb server on 3333
Info : Listening on port 3333 for gdb connections
CPU in Non-Secure state
[stm32u5.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x41000000 pc: 0x08019392 psp: 0x2002ccf8
[stm32u5.cpu] halted due to breakpoint, current mode: Thread
xPSR: 0x09000000 pc: 0x08006374 psp: 0x20034a70
shutdown command invoked
20035490
python provisioning
python downloading
Network madgwick_fusion_test_default  Creating
Network madgwick_fusion_test_default  Error
failed to create network madgwick_fusion_test_default: Error response from daemon: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network
exit status 1

here is a zip of the app:
madgwick_fusion_test.zip (865.1 KB)

Not sure what the issue is.

1 Like

I reinstalled everything on the Q and now getting:

Starting app "Madgwick_Fusion_Test"
Sketch profile configured: FQBN="arduino:zephyr:unoq", Port=""
The library ArxContainer has been automatically added from sketch project.
The library ArxTypeTraits has been automatically added from sketch project.
The library DebugLog has been automatically added from sketch project.
The library MsgPack has been automatically added from sketch project.
Sketch uses 241 bytes (0%) of program storage space. Maximum is 1966080 bytes.
Global variables use 0 bytes (0%) of dynamic memory, leaving 523624 bytes for local variables. Maximum is 523624 bytes.
Open On-Chip Debugger 0.12.0+dev-ge6a2c12f4 (2025-05-22-15:51)
Licensed under GNU GPL v2
For bug reports, read






debug_level: 2
clock_config
/tmp/remoteocd/sketch.elf-zsk.bin
Info : Linux GPIOD JTAG/SWD bitbang driver (libgpiod v2)
Info : Note: The adapter "linuxgpiod" doesn't support configurable speed
Info : SWD DPIDR 0x0be12477
Info : [stm32u5.ap0] Examination succeed
Info : [stm32u5.cpu] Cortex-M33 r0p4 processor detected
Info : [stm32u5.cpu] target has 8 breakpoints, 4 watchpoints
Info : [stm32u5.cpu] Examination succeed
Info : [stm32u5.ap0] gdb port disabled
Info : [stm32u5.cpu] starting gdb server on 3333
Info : Listening on port 3333 for gdb connections
CPU in Non-Secure state
[stm32u5.cpu] halted due to debug-request, current mode: Handler External Interrupt(61)
xPSR: 0x0100004d pc: 0x0801acea msp: 0x2002c950
Info : SWD DPIDR 0x0be12477
Error: error running OpenOCD: exit status 1
Error: Failed to write memory at 0x00000000
00000000
Open On-Chip Debugger 0.12.0+dev-ge6a2c12f4 (2025-05-22-15:51)
Licensed under GNU GPL v2
For bug reports, read






debug_level: 2
clock_config
/tmp/remoteocd/sketch.elf-zsk.bin
Info : Linux GPIOD JTAG/SWD bitbang driver (libgpiod v2)
Info : Note: The adapter "linuxgpiod" doesn't support configurable speed
Info : SWD DPIDR 0x0be12477
Info : [stm32u5.ap0] Examination succeed
Info : [stm32u5.cpu] Cortex-M33 r0p4 processor detected
Info : [stm32u5.cpu] target has 8 breakpoints, 4 watchpoints
Info : [stm32u5.cpu] Examination succeed
Info : [stm32u5.ap0] gdb port disabled
Info : [stm32u5.cpu] starting gdb server on 3333
Info : Listening on port 3333 for gdb connections
CPU in Non-Secure state
[stm32u5.cpu] halted due to debug-request, current mode: Handler External Interrupt(61)
xPSR: 0x0100004d pc: 0x0801acea msp: 0x2002c950
Info : device idcode = 0x30076482 (STM32U57/U58xx - Rev U : 0x3007)
Info : TZEN = 0 : TrustZone disabled by option bytes
Info : RDP level 0 (0xAA)
Info : flash size = 2048 KiB
Info : flash mode : dual-bank
Info : Padding image section 0 at 0x080f0032 with 14 bytes (bank write end alignment)
Warn : Adding extra erase range, 0x080f0040 .. 0x080f1fff
shutdown command invoked
Open On-Chip Debugger 0.12.0+dev-ge6a2c12f4 (2025-05-22-15:51)
Licensed under GNU GPL v2
For bug reports, read
debug_level: 2
clock_config
/tmp/remoteocd/sketch.elf-zsk.bin
Info : Linux GPIOD JTAG/SWD bitbang driver (libgpiod v2)
Info : Note: The adapter "linuxgpiod" doesn't support configurable speed
Info : SWD DPIDR 0x0be12477
Info : [stm32u5.ap0] Examination succeed
Info : [stm32u5.cpu] Cortex-M33 r0p4 processor detected
Info : [stm32u5.cpu] target has 8 breakpoints, 4 watchpoints
Info : [stm32u5.cpu] Examination succeed
Info : [stm32u5.ap0] gdb port disabled
Info : [stm32u5.cpu] starting gdb server on 3333
Info : Listening on port 3333 for gdb connections
CPU in Non-Secure state
[stm32u5.cpu] halted due to debug-request, current mode: Handler External Interrupt(61)
xPSR: 0x0100004d pc: 0x0801acea msp: 0x2002c950
Info : SWD DPIDR 0x0be12477
Error: error running OpenOCD: exit status 1
Error: Failed to write memory at 0x00000000
00000000
Failed uploading: uploading error: exit status 1

Now getting this error on all my python scripts.
This is getting silly.

NOTE: Not seeing any .cache directory being created!!!

seems like this is no longer an issue after resolving issue with board loading of sketches in the other thread

1 Like