Description
ev3dev version: 4.14.117-ev3dev-2.3.5-ev3
- ev3dev-lang-python version:
||/ Name Version Architecture Description
+++-==================================-======================-======================-=========================================================================
ii micropython-ev3dev2 2.1.0 all Python language bindings for ev3dev for MicroPython
ii python3-ev3dev 1.2.0 all Python language bindings for ev3dev
ii python3-ev3dev2 2.1.0 all Python language bindings for ev3dev
I have certain programs that crash on EV3Dev2 when 2 parallel Thread
s may control the same Motor. The crashes have different error messages on MicroPython vs. Python3. I have reproduced the errors in the enclosed test scripts "BUG.SameMotor.Threading.EV3Dev2.MicroPython.py" and "BUG.SameMotor.Threading.EV3Dev2.Python3.py".
For comparison, I have also tried and enclosed below other variations (e.g. using ev3dev
(1.2.0) or pybricks
instead of ev3dev2
, or using multiprocessing
or PyBricks's run_parallel
instead of threading
) that run successfully.
All these programs do the following: turn the Motor clockwise when the Touch Sensor is pressed, or turn the same Motor counter-clockwise when any IR Remote Control button is pressed. The observations from all the coding variations are as follows:
threading
withev3dev2
2.1.0 onmicropython
: CRASHED after pressing the IR Remote Control buttons a few times (making the Motor turn counter-clockwise), even if the Touch Sensor is NOT pressed at all (i.e. that Touch-Sensor-triggeredThread
never commands the Motor at all).
File "ev3dev2/motor.py", line 1048, in on_for_seconds
File "ev3dev2/motor.py", line 928, in wait_until_not_moving
File "ev3dev2/motor.py", line 908, in wait
OSError: 4
threading
withev3dev2
2.1.0 onpython3
: CRASHED when the Touch Sensor and an IR Remote Control button are pressed at the same time, i.e. bothThread
are trying to command the Motor at the same time. But the program runs ok when only 1 button is pressed.
File "/usr/lib/python3/dist-packages/ev3dev2/motor.py", line 1048, in on_for_seconds
self.wait_until_not_moving()
File "/usr/lib/python3/dist-packages/ev3dev2/motor.py", line 928, in wait_until_not_moving
return self.wait(lambda state: self.STATE_RUNNING not in state or self.STATE_STALLED in state, timeout)
File "/usr/lib/python3/dist-packages/ev3dev2/motor.py", line 908, in wait
self._poll.poll(poll_tm)
RuntimeError: concurrent poll() invocation
-
multiprocessing
withev3dev2
2.1.0 onmicropython
: bothProcess
es run successfully WITH mutual blocking, i.e. 1Process
CANNOT interrupt/reverse the otherProcess
's Motor movement mid-stream -
multiprocessing
withev3dev2
2.1.0 onpython3
: bothProcess
es run successfully WITH mutual blocking, i.e. 1Process
CANNOT interrupt/reverse the otherProcess
's Motor movement mid-stream -
threading
withev3dev
(1.2.0) onpython3
: bothThread
s run successfully WITHOUT mutual blocking, i.e. 1Thread
CAN interrupt/reverse the otherThread
's Motor movement mid-stream -
multiprocessing
withev3dev
(1.2.0) onpython3
: bothProcess
es run successfully WITHOUT mutual blocking, i.e. 1Process
CAN interrupt/reverse the otherProcess
's Motor movement mid-stream -
threading
withpybricks
(2.0.0) onpybricks-micropython
: bothThread
s run successfully WITH mutual blocking, i.e. 1Thread
CANNOT interrupt/reverse the otherThread
's Motor movement mid-stream -
run_parallel
(experimental PyBricks feature) withpybricks
(2.0.0) onpybricks-micropython
: bothThread
s run successfully WITH mutual blocking, i.e. 1Thread
CANNOT interrupt/reverse the otherThread
's Motor movement mid-stream