How to stop the Move Tank class
FUJI-AF opened this issue · 1 comments
FUJI-AF commented
If the question is in the wrong place, delete this question.
Is there a way to stop it when I use the follow_line method of the Move Tank class with the follow_for_forever option?
For example, exit follow_line when the touch sensor is pressed.
WesleyJ-128 commented
There might (is a) be some weird hacky way to do this involving multiple threads/processes. However, there is no "nice" way to do this. What I ended up doing (I needed to stop after a certain number of encoder ticks) was copying the code from Motor.py into my own function, changing the condition that ends the loop, and using that. Not exactly nice, but it works and is cleaner than using multithreading for this.