uRemoteError (No data / Preamble mismatch) when initializing LineSensorUR inside an async wrapper or alongside task runners #3 #2845
zoligyenge
started this conversation in
General
Replies: 2 comments 8 replies
|
uRemoteError is not part stock Pybricks, so not sure we can help on the Pybricks cc: @antonvh |
2 replies
|
Documentation about async uremote is here: https://docs.antonsmindstorms.com/en/latest/Software/uRemote/docs/index.html#client-async-call-async-cmd-args. It might be that the linesensor has no async methods (yet). Uremote, underlying, has them. |
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi. I am not sure this is the right place since I am not sure whether the problem is in Anton's LMS Line Sensor's firwmware, the pybricks helper functions or pybricks.
When using Anton's Mindstorms LMS Line Sensor Pybricks wrapper (line_sensor_pybricks.py) with uRemote, initializing the sensor instance at global scope while the script is structured for asynchronous execution (run_task()) results in a uRemoteError: Read error: No data. Is remote script running? or Preamble mismatch. However, an identical initialization script running completely synchronously works without issues.
Environment
Hub: LEGO SPIKE Prime / Inventor Hub
Pybricks Code App Version: v3.0.1
Pybricks Firmware Version: v4.0.1
Sensor: LMS Line Sensor (connected to Port C) [firmware_ch32_line_i2c_ur_v5.6.uf2]
Library: line_sensor_pybricks.py (v1.0 / uRemote protocol wrapper)
Code That Fails (Async Task Context)
Code That Works (Synchronous Context)
Steps to Reproduce
Connect the LMS Line Sensor to Port C on an Inventor Hub.
Upload line_sensor_pybricks.py to the hub.
Run the async script containing run_task(main()).
Observe the timeout / no data exception during the UART transaction.
Additional Context
Raw UARTDevice tests on the port pass successfully, proving the hardware and port connection are fully functional. The issue appears to be tied to how the uRemote RPC handshake initializes when the MicroPython cooperative async scheduler (run_task) is active under Pybricks firmware v4.0.1.
I tried with multiple HUB, Multiple LMS Line follower modules.
All reactions