Skip to content
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

What PC<>EV3 interactivity is possible while a script is running? #67

Closed
ndward opened this issue Dec 7, 2018 · 5 comments
Closed

What PC<>EV3 interactivity is possible while a script is running? #67

ndward opened this issue Dec 7, 2018 · 5 comments

Comments

@ndward
Copy link

ndward commented Dec 7, 2018

I would like to know what interactivity is possible between the EV3 and the PC when a script has been launched on the EV3 from VS Code. Clearly some data can pass from the EV3 to the PC when print(xxx, file = stderr) is used, but what about the other direction? Is it possible, for example, to use the PC keyboard to remotely control the EV3 robot and if so, how?

I just received this related message from a teacher requesting help:
I am a teacher in France, and I have been programming the Lego EV3 with Matlab Simulink for several years. I want to switch to text programming with students on this medium. With the robot, we are working on trying to realize SLAM. For that, I would like to draw a matrix. Matplotlib is not installed on ev3dev. I tried to install it but without success. And even if I could install it, I'm not sure if I can send the terminal back to the PC with "file = sys.stderr". I did not try with the graphic library Pillow, because I do not think this is the most suitable way. For your information, I work with VS Code. My students worked with the Anaconda Spyder suite and I would have liked to use the same environment, but I followed your valuable advice.

@marchanderic44
Copy link

Thank you.
To complete, I can write in text files (the position of the robot for example). But, how plot this position in real time? with Matplotlib for example or with which tool?

@dlech
Copy link
Member

dlech commented Dec 7, 2018

It is an interesting coincidence that you should bring this up now. I have very recently (2018-11-28) added a new -r option to brickrun that is the first step to doing something like this. (To use it, you will need to use a snapshot image after this date or upgrade packages with sudo apt update && sudo apt upgrade).

I haven't thought about how it could be integrated into the vscode extension yet though.

For now, you can use it from a ssh terminal like this:

brickrun -r -- ./program.py

This will case stdin, stdout and stderr to all be redirected to the ssh terminal. As you may guess, stdin is the one that provides input from the terminal. Probably the simplest way to make use of this is with the built-in input function.

@dlech
Copy link
Member

dlech commented Dec 7, 2018

FYI, I've created a new issue for Matplotlib/Data Visualization at #68, so any further comments on that topic should be made there (my brain can only think about one thing at a time 😉).

@bpmerkel
Copy link

bpmerkel commented Sep 8, 2019

Recommend closing this issue (but document the -r option for sure!)

@dlech
Copy link
Member

dlech commented Jan 3, 2020

VS Code now has an actual terminal API, so we can actually automate using brickrun -r now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants