-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ValueError: invalid literal for int() with base 10: ''
when using InfraredSensor in Threading
#746
Comments
ValueError: invalid literal for int() with base 10: ''
when using InfraredSensor in Threading
Sorry for the delay. We saw this issue here too: ev3dev/ev3dev#1269 The reality is, having two threads concurrently attempt to access the same attribute is likely to cause problems -- there is no synchronization built into the library. If you could restructure your code so that one is always responsible for interacting with the sensor, that would likely solve it. Remember that you could have one thread retrieve data and save it, and the other process it, if that is helpful. |
In addition to what @WasabiFan said... The EV3 IR sensor does not like swapping modes frequently. Using the IR beacon for heading/distance is one mode of operation and using the remote control buttons is another mode of operation (actually there are two different modes for remote control buttons). Programs should only use one mode of operation or wait for several seconds after switching modes for best results. |
@WasabiFan @dlech thanks for your diagnoses and suggestions. @dlech is the Beacon button press detection under a different mode to the press detection of other buttons (top/bottom left/right)? |
The beacon button press detection is the same mode as the other button press detection. See http://docs.ev3dev.org/projects/lego-linux-drivers/en/ev3dev-stretch/sensor_data.html#lego-ev3-ir for more info on the modes. |
@dlech thank you. In that case, I think the above program actually does not make the IR sensor switch among multiple modes, because the program only checks for various button presses. So probably this issue is of the same nature as ev3dev/ev3dev#1269 -- i.e. resulting from multiple threads accessing the sensor values at the same time. |
This error is not exclusive to sensor reads- trying to get the motor encoder values from multiple threads yields the same error. |
||/ 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've got an error in a parallel Thread that uses the InfraredSensor when running the below program. The error message is not easy to understand, so I'm not sure what the problem is. May I have some help troubleshooting this case? Thank you very much.
The text was updated successfully, but these errors were encountered: