Novakasa / brickrail

LEGO Train automation software for PoweredUp
MIT License
88 stars 7 forks source link

[Bug] marker detection reliability issues #145

Open Novakasa opened 1 year ago

Novakasa commented 1 year ago

there is a potential issue with detecting markers reliably, potentially due to the changes introduced in https://github.com/Novakasa/brickrail/commit/af6be84cb096e934f38f5c66f810c60b12a329da and related commits, to filter out colors that are never used as markers (mainly to make green baseplates and similar possible)

@TekyTeky you reported recently that you have seen marker errors, so this might be that. I have been able to test a bit with my layout on the weekend, and I had a few marker errors that seemingly came in random places. I am planning to add a automatic color data dump after unexpected markers so I can take a look why the wrong marker was detected. This is tracked in #144.

TekyTeky commented 1 year ago

I believe I have not received a recent marker error when manually selecting and moving a train in a forward direction. They usually happen when in random mode, both directions. I thought since delays were introduced at blocks, but that may be coincidental.

Novakasa commented 1 year ago

I implemented #144 now (on Master). Each time you get a marker error, 2 new files will be generated in the log directory. One .txt file that contains the color data, and a plot (.png file) that visualizes the data. This should help in cases where some markers are false detections. This will help a lot to try to debug any issues, so @TekyTeky next time you get a marker error, please post these 2 files along with the regular logs here.

Example for how the plot might look like: hub_city-blue_colors_2023-07-07_13 04 56

It is weird that you only seem to get marker errors in "random mode", my guess is that this just might be due to statistics? When I run random mode with multiple trains, trains will just run a lot more, and with multiple trains at the same time. But if the issues are not a sensor processing issue, then this could definitely be the case.