-
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
Can't use screen AND motors ? #276
Comments
How do you run the program? If you do this from an ssh session, then brickman (the default interface) is still in control of the screen and is probably overwriting your changes. If you launch the script from brickman, the script should get a separate virtual screen and will have full control of it. It is also possible to get the separate screen from the command line with EDIT: another link: #194 (comment) |
Aha, I remember reading about that. I must confess I didn't understand neither the post you mentioned nor your answer ! I am on a Mac, and not really familiar with non GUI apps, like terminal, although I'm getting better. Could you tell me where exactly I should sudo something ? On the bot, when ssh-logged, or on my computer ? I never launch my programs on the brick directly, because I am using a nice pyCharm feature, the git repository. Like that, I don't have to chmod my files in order to launch them directly on the brick. Plus, I can let my bot on my playground, and remain on my seat ! |
Thank you for your help. I didn't get exactly what I wanted with the trick you showed me. It displays some kind of terminal on the bot, but what I wanted to have was to be able to display live values from the light sensor (I can do it, but in a separate program).
Instead of making both motors turn at the same time, they do it one after the other ! Is it ok, doc ? |
There is a demo project that uses threads here: https://github.com/rhempel/ev3dev-lang-python/blob/develop/demo/R3PTAR/r3ptar.py. |
Thanks for the link. I will check this, definitely. I've read something about threads, and it's a bit complicated for me now. I think I will have to study that .join thing... |
You need to enter this into the command prompt of the ssh session:
when you enter your password, you should see that the robot screen switched from the brickman interface to a new console with a login prompt. Ignore that prompt. Now, when you update the screen from your python script, brickman won't be able to mess with the results. The following script works for me: from time import sleep
import ev3dev.ev3 as ev3
import ev3dev.fonts as fonts
ir = ev3.InfraredSensor()
screen = ev3.Screen()
f = fonts.load('luBS18')
while True:
screen.clear()
screen.draw.text((10,10), 'Dist: {}'.format(ir.proximity), font=f)
screen.update()
sleep(0.25) When you are done and want to bring the brickman interface back, enter in the ssh session:
|
@ndward has a guide on doing this at the bottom of this page: https://sites.google.com/site/ev3python/learn_ev3_python/screen.
@ddemidov I think (?) that virtual terminal 2 is reserved for Brickman child apps or something of that nature... I can't remember for sure though. Either way it shouldn't make any real difference. |
OpenRoberta, specifically. But if |
Hi,
I can't figure what the problem is with my code : I want to calibrate my light sensor, in order to follow a black line. I want the robot to oscillate 4 times, so that the sensor can update the max_white and max_black values.
I have succeeded using the lcd screen and the motors, but separately. If I put all my functions in the same file, it will not work, but if I use the functions in different files, the code works.
In fact, the motors will run, but the display isn't even changed from its original state, and the values are not updated.
I am not exactly sure if it's a bug somewhere, or if it's due to my very beginner level in programming.
Here is my code :
Any help appreciated !
The text was updated successfully, but these errors were encountered: