Twisted-Fields / acorn-precision-farming-rover

Source code for Acorn, the precision farming rover by Twisted Fields
Apache License 2.0
262 stars 37 forks source link

break up the gigantic loops; a few misc fixes #3

Closed merlinran closed 3 years ago

merlinran commented 3 years ago

To show the meaningful diffs, it's better to be reviewed after https://github.com/Twisted-Fields/acorn-precision-farming-rover/pull/6. I'll add inline comments at that point.

It breaks the main loops of remote_control_process.py (nearly 1000 lines of code!) and master_process.py into more manageable methods each within 100 lines. Shorter methods are easier to reason about and have proper level of abstraction.

To make sure I didn't break things, I ran the new and old code side by side, and didn't see difference on the behaviour, except a few bugs of the old code which have been fixed in this PR. I wasn't able to make acorn really move in the simulation with this PR, due to a problem exists in the old code too(travel_speed is always 0), but after hardcoding the default nav parameter travel_speed, the simulated Acorn could rover could follow any path back and forth. Some bugs may be revealed only when running on real hardware, though I'd be surprised if there are many.

tlalexander commented 3 years ago

Thank you! This sounds promising. I am still working on a big PCB project but do let me know if any of these are blocking you.

merlinran commented 3 years ago

closed in favour of https://github.com/Twisted-Fields/acorn-precision-farming-rover/pull/7