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

Data visualization #68

Open
dlech opened this issue Dec 7, 2018 · 8 comments
Open

Data visualization #68

dlech opened this issue Dec 7, 2018 · 8 comments

Comments

@dlech
Copy link
Member

dlech commented Dec 7, 2018

@ndward wrote:

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.

@dlech
Copy link
Member Author

dlech commented Dec 7, 2018

@marchanderic44 wrote:

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 Author

dlech commented Dec 7, 2018

Idea:

It looks like it is possible to run Jupyter notebooks in VS Code.

It also looks like it is possible to do real-time plots with matplotlib.

Putting this together, I think one could write some code that runs in a Jupyter notebook in VS Code (on the computer) that A) listens for data from the EV3 over a network connection (UDP packets would be a good way to do this) and B) plots the data received using matplotlib. A separate program would run on the EV3 that collects data and sends it over a network connection to the listening program on the computer.

@marchanderic44
Copy link

Hy Dlech,
It's seem great with matplotlib.
But how transfert data from legoEV3 to PC in real time?
I can creat a file.txt from position of legoEV3 (for example). When the script is finish, I transfert the file with WINscp (because I use PC and not linux). And after, I can read the file with matplotlib.
So, with your link, we can display with matplotlib in real time.
But I am not competent to transfert in real time data from legoEV3 to PC in real time.
Is not it more complicated with jupyter rather than a threat script in legoEV3?

@dlech
Copy link
Member Author

dlech commented Dec 11, 2018

Jupyter just seems like a nice way to display the plots in VS code instead of in a separate window. But it is not necessary.

Did you look into using network sockets to transfer the data like I suggested? Here is some detailed information: https://docs.python.org/3/howto/sockets.html

@marchanderic44
Copy link

I did not know, I will try. Thanks

@marchanderic44
Copy link

Thank you for your help. I succeeded.
Here are the scripts for people interested.
ev3.py is the scrit for the ev3: the position of the wheel left and right are sent to the client which is the program on my PC, named graph.py.
This last program takes the value of the position of the right wheels and the gauges in the graph x, y via matplotlib in real time.
NB: the values ​​of x and y do not correspond to the position of the robot, it is just to test the posibility to make a display of values ​​in real time.
real_time.zip

@bpmerkel
Copy link

bpmerkel commented Sep 8, 2019

Recommend closing this issue.

@pythoncader
Copy link

pythoncader commented Aug 1, 2020

I succeeded as well. Run the script on the ev3 first, then within vscode. Write the ip address of the ev3 in the input, then the program will graph the live data from the IR sensor within matplotlib on the PC.
Thanks so much for the help!
... I used EV3 Micro-Python from Lego Education
ir_grapher.zip

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

No branches or pull requests

4 participants