I have been working on some code in Python with RobotPy (version 2023.4.3) and have been stuck on debugging an error for the past few days when trying to push a double array (List[float]) to NetworkTables4 on a test board.
Traceback (most recent call last):
File "/home/orangepi/test.py", line 15, in <module>
publisher.set([129391.1234234, 123984.324239])
MemoryError: std::bad_alloc
I have been unable to recreate this issue in Windows or MacOS systems, in which both my minimal and full Python code have worked without fault. This issue occurs regardless of the array type, having tried all the NetworkTables array publishers. Single double, float, int, etc. publishers work without fault.
I’ve written a minimal test script shown below:
import ntcore
instance = ntcore.NetworkTableInstance.getDefault()
instance.setServerTeam(694)
instance.setServer("10.6.94.2", ntcore.NetworkTableInstance.kDefaultPort4)
instance.startClient4("694_client")
table = instance.getTable("/output")
publisher = table.getDoubleArrayTopic("test").publish()
publisher.set([129391.1234234, 123984.324239])
I have exhausted all debugging methods that I have been able to think of with no success. Any help or guidance would be greatly appreciated. Thank you in advance.