zauberzeug / rosys

An all-Python robot system based on web technologies. The purpose is similar to ROS, but it's based on NiceGUI and easier to use for mobile robotics.
https://rosys.io
MIT License
70 stars 10 forks source link

Flash p0 via ui is not working #157

Closed pascalzauberzeug closed 1 month ago

pascalzauberzeug commented 1 month ago

While working on https://github.com/zauberzeug/rosys/issues/156 we noticed that flashing p0 via ui does not work correctly. The boot sequence of p0 still showed the old version. However flashing p0 via monitor.py worked perfectly fine.

The whole waiting loop should be reworked, because it just waits for 3 seconds and then tells the user that it's finished.

A quick fix would be to wait for a longer duration (I measured 43 seconds to flash p0), but the better way would be to wait for I (100726) replicator: Replica complete. on the serial with an emergency timeout.

falkoschindler commented 1 month ago

@pascalzauberzeug If I recall correctly, the idea behind the waiting loop is to wait until hardware_time exceeds the start time plus 3 seconds - or until the timeout is reached. This should work, because hardware_time basically freezes during the flash process when no core message is received. Only after flashing and rebooting the ESP, new core messages lead to a time update and the loop exits.

https://github.com/zauberzeug/rosys/blob/2f47e5fd9849bffacce1a74f31d793470ea1e3f9/rosys/hardware/lizard_firmware.py#L110-L114

But I can imagine that this logic is rather fragile. Waiting for "Replica complete" sounds like a more robust approach.

pascalzauberzeug commented 1 month ago

@falkoschindler yes, you are correct. It does freeze. But then I don't understand why it doesn't work. We have to look into that