ev3dev-lang-python icon indicating copy to clipboard operation
ev3dev-lang-python copied to clipboard

How to stop the Move Tank class

Open FUJI-AF opened this issue 5 years ago • 1 comments

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.

FUJI-AF avatar Dec 02 '20 09:12 FUJI-AF

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.

WesleyJ-128 avatar Mar 11 '21 00:03 WesleyJ-128