Closed ndward closed 7 years ago
I'd like to include a page on threads but haven't found much helpful information on threads so far (I suppose this is a generic Python issue rather than an EV3 Python issue, but I would like to include some EV3-related code samples).
Have you seen https://pymotw.com/2/threading? Seems like a nice introduction to me.
EDIT: This is python3 version of the same tutorial: https://pymotw.com/3/threading/index.html
I need to include more advanced, more interesting code samples;
I created an example script for the EV3RSTORM model. Would that qualify?
I have a number of code samples for the EV3 buttons on this page https://sites.google.com/site/ev3python/learn_ev3_python/buttons and they all work fine when run from SSH but none of them work correctly from Brickman
Can you open a new issue for this with a code sample that does not work from brickman? I tried a few simple tests, they do seem to work for me.
Am I right to think that IPython / Jupyter should not be used with the EV3 because the EV brick does not have enough RAM for that to work well?
I would say this is correct. However, using rpyc for remote operation did work for me. I created a simple tutorial here: https://gist.github.com/ddemidov/63dab1dd1b91b493a7752c76e055b5c0
Thank you for your Ev3storm script which I placed here https://sites.google.com/site/ev3python/learn_ev3_python/going-further/ev3rstorm-marvin although I'm not sure everyone will like his new personality.
I've linked to the threads explanation on my site but still hope to be able to include an EV3 Python specific example when I can fond one or make one.
Could you please briefly state the advantages and disadvantages of RPyC relative to an SSH connection?
Sorry for the long message again... I keep doing that!
However, my own site will never have much traffic or impact until ev3dev.org links to it, which is so far not the case even though my site includes lots of code samples which is precisely what is missing from ev3dev.org (from a beginners point of view).
We've discussed this over email; for others reading this, I'm going to do a quick review when I have time to read through all the content and provide @ndward with technical feedback and such, and then (or maybe before that, depending on timing) will add links to his site from this repo's README and probably the ev3dev.org libraries page.
What is tethering, how do you set it up and when would you use it? The tethering pages on ev3dev.org such as http://www.ev3dev.org/docs/tutorials/using-usb-tethering/ are still mostly empty.
Tethering is a simple form of networking in which the two devices involved are "tethered" together without any connection to the outside world (if the PC had an internet connection before it will still work, but the EV3 doesn't have access to it). We have removed references to empty pages, and are working on a new "networking" page which streamlines this process with explanations and such. This should be better soon (most of it is included in ev3dev/ev3dev.github.io#258).
The image that the getting started page proposes is from Dec 30 2015 and includes cycle 9 of the kernel which is quite out of date.
We'll be getting a new release published fairly soon, so this should not be an issue going forward. I hope that releases will be a bit more frequent and coordinated with libraries in the future.
You still encourage users to use Etcher to copy the img.xz image to an SD card. I recently downloaded the latest version of Etcher and used it to copy the nightly build to a card and it reported that the process had failed and that I should try again with a different card. ... I still wonder whether it would be better for Windows users to use Win32DiskImager rather than Etcher to avoid these problems.
I have also seen this behavior. If you are still able to reproduce this problem, please open an issue at https://github.com/resin-io/etcher/issues and tell them that you flashed an image to an SD card and Etcher told you it was corrupted. I agree that this is frustrating, but if they don't know about it they can't fix it; when I first saw it, I wasn't able to reproduce it when I went back to report an issue. As I see it, there are two possibilities for why this is: either the card is legitimately unreliable, or Etcher is misreporting the validity. I am 90% sure that the image that was burned is correct.
In general, I think that the simplicity of Etcher is great if we can get the minor bugs fixed: for a beginner, they literally just have to be able to locate their "Downloads" folder and click two "next" buttons. That kind of simplicity, combined with the fact that it protects you from messing with your system drives, minimizes the amount of instructions we have to maintain, and looks pretty in the process, makes it a very good option for us.
Additionally, the Etcher maintainers are working on some features that would make it a much more personalized experience. Part of that is to make it so that it shows the ev3dev logo when you choose the image and it presents release notes/next steps after it's done. There are some interesting scenarios that they're opening up.
Ev3dev.org recommends the use of PuTTY for Windows users but my experiments lead me to recommend MobaXTerm instead to gain extra functionality and a built-in text editor that can be used to edit Python programs. Do you agree? Comments? What about WinSCP?
MobaXTerm is a nifty program. The problem that I have with it isn't the functionality, but the fact that it's only "free" as long as you are willing to live with their limited version of the software. Even if I don't need any of the nonfree features, their attitude makes me want to avoid them: I'm fine with paid software and pay for things in general, but using a restricted version of software like that just feels a bit wrong to me. If you're fine with the features it offers, go for it; I don't think it's "bad" per se.
For me, I generally use PuTTY for SSH (the terminal) and then configure whatever editor I'm using to sync my code. The vast majority of text editors and IDEs have some variety of "deploy on save" functionality (including PyCharm) or an add-in that does it, which allows me to stay with the editor I like to use without having to flip between it and a file transfer program. I use WinSCP on occasion when I need access to a specific file.
I have recommended PyCharm Edu as a good choice of Python IDE. Do you agree? Comments?
I don't have extensive experience in the Python IDE field, but from what I have heard as well as my own experience PyCharm is a great choice.
The EV3 brick includes Bluetooth. Is is possible to pass audio via the Bluetooth connection to Bluetooth speakers, thereby boosting the loudspeaker on the brick?
Yes! I don't believe we have a guide for it right now, however it does work. Maybe @dlech knows where to look for up-to-date information on that.
I know that the USB slot on the EV3 brick can be used to attach things like keyboards, wifi dongles etc. Apart from the obvious value of attaching a wifi dongle, what other devices can be used with EV3dev / EV3 Python?
Webcams, USB hubs and pretty much any other USB device should work, with some caveats. If it's something standard like a webcam, keyboard/mouse, etc., you can be pretty much guaranteed that it will work without any fiddling. For other types of devices, look to see if they say they support Linux: if they do, you can be pretty sure it will work, and if they don't, there's a 50-50 chance that it will work properly (with the level of functionality varying wildly). Stick to simple devices and devices that say they support Linux and you should be fine.
How does one use sound and image files with EV3 Python?
I believe the image files part of your question has been answered elsewhere. For sound, see the Sound class documentation. Long story short, you can play WAV files with Sound.play(‘bark.wav’)
.
For EV3 Basic it is easy to transfer all the standard Lego EV3 sound and graphics files to the brick and then use them in EV3 Basic programs. How would that be done for EV3 Python?
I believe this was answered above.
Can EV3 Python play the sound files that are included with the EV3-G software which are in RSF format? The EV3-G software also includes many graphics in both BMP and RGF formats. I assume that EV3 Python can display the BMP versions, but I have yet to figure out how to do this.
You can use the BMP files, but I have no idea what the RSF ones are... probably a proprietary LEGO format. @dlech?
The documentation for text-to-speech lists these parameters: speak(text, espeak_opts='-a 200 -s 130') What are the parameters I have highlighted in bold?
They are options controlling voice speed and a few other things. Type espeak --help
on the EV3 in a terminal to see the full list of options. When you call Sound.speak
, the library is really just running that espeak
program and passing it the arguments that you put into that parameter, along with the text.
There are currently (2 Sept 2016) no instructions on ev3dev.org for setting up a Wifi connection to the internet using Brickman. I found instructions on page 11 of the this pdf document but they do not include making the IP address of the brick static as ev3dev recommends for the USB connection; So, should the IP address also be made static for the WiFi connection? Nor do the instructions on the pdf say to turn on 'connect automatically'. I'm guessing this should be turned on - please confirm.
Nope, you don't want to make the address static. All you need to do is connect to the Wi-Fi network and optionally check that "connect automatically" box. Nothing else required.
What's the difference between a console and a terminal window?
Different words for the same thing. They originally came from when mainframes were in use; a "console" was essentially an error log with some configuration options and a "terminal" was a very unintelligent computer-like device that would just forward your input to the server and show you the output. At this point, those don't really exist, so the two words are interchangeable. When we say "terminal", it's technically a virtual terminal because it isn't a physical terminal but that distinction is pointless. That was probably a much more intricate explanation than you wanted :laughing:
Maybe @dlech knows where to look for up-to-date information on that.
the RSF ones are... probably a proprietary LEGO format. @dlech?
They are actually just 8-bit mono 8kHz raw audio data with a small header (non-standard as far as I can tell). You can play the file as raw data and have a small noise at the beginning because of playing the header as audio. Or you can chop off the first 8 bytes of the rsf file and just have a raw file.
aplay --file-type raw --channels=1 --format=U8 --rate=8000 file.rsf
...might do something interesting (I didn't actually try it).
What's the difference between a console and a terminal window?
Different words for the same thing..
Not exactly...
"Terminal" and "console" are synonymous. However, "virtual terminal/console" means something different and very specific. A "virtual terminal" is a special part of Linux that means a virtual terminal running on the local computer as opposed to any kind of remote terminal that is physically separate from the local computer.
When you log in remotely via SSH, we call this a "remote terminal". The program you use for this is called a terminal emulator because it is software rather than hardware. (@WasabiFan's explanation was correct, but his use of "virtual" was not.)
"terminal" and "console" by themselves can be used interchangeably, but "console" is more often used to refer to a virtual console whereas terminal more often used to refer to a shell prompt in general (neither local or remote is implied).
In the context of ev3dev "virtual terminal" means the virtual terminals that are displayed on the actual screen on the EV3. Being virtual, you can have many virtual terminals. Traditionally, Linux has a text login on the first 6 virtual terminals and the graphical desktop runs on the 7th virtual terminal (the remainder are generally not used). You can switch between these virtual terminals by pressing ALT+CTRL+Fn on the keyboard where n corresponds to the number of the virtual terminal.
Since ev3dev is based on Linux, this works on the EV3 as well. If you plug in a keyboard, you can switch between virtual terminals. Of course using a keyboard with the EV3 is not practical. However, you can remotely control the virtual consoles from a remote terminal (or local terminal) using sudo chvt <n>
where <n>
is replaced by the virtual terminal you want to switch to. You can use this to switch between Brickman on tty1
and a text login on tty2
.
When you run a program from Brickman, it does the switching automatically to allow your program full use of the screen. If you run a program from a remote terminal, you need to do the switching otherwise Brickman will be fighting you for control of the screen.
What is tethering, how do you set it up and when would you use it?
"Tethering" is a term used by mobile phones (at least here in the USA) to mean when you connect your computer to your phone (by USB/Bluetooth/WiFi/etc.) in order to gain Internet access for your PC via the phone's radio.
Since the EV3 does not have a mobile phone radio, when we tether to the EV3, we just get a network connection from the computer to the EV3. The advantage though is that other than checking the tether box on the EV3, there is (or should be) no other setup required to get a network connection, whereas the other methods of setting up Internet connection sharing require many steps to get a network connection.
Not exactly...
And I thought my explanation was long-winded 😜
Apart from the obvious value of attaching a wifi dongle, what other devices can be used with EV3dev / EV3 Python?
Some of the more interesting one's I have seen...
Don't forget the vision Command and MINDSTORMS cameras
Could you please briefly state the advantages and disadvantages of RPyC relative to an SSH connection?
- It uses much less resources than ipython notebook on ev3, its lightweight, and you only need IP connection to the ev3 once you set it up (no ssh required).
- The scripts you are working with are actually stored and edited on your desktop PC, with your favorite editor/IDE.
- You can have an interactive session (with ipython shell/notebook, pycharm, or whatever) running on your PC and controlling your EV3 (I guess you can even do this from your tablet with something like http://omz-software.com/pythonista/ or http://qpython.com/, but the idea of having to type on tablet horrifies me, so I won't mention it).
- I guess this will be a rare situation, but for some robots you will actually need much more computational power than what EV3 can give you. One example is the Rubics cube solver: there is an algorithm that can give you next to optimal solution (in terms of cube rotations), but it takes more RAM than is available on EV3. With RPYC, you could run the heavy-duty computations on your desktop.
One disadvantage I can see is latency introduced by network connection. This may be important for robots where reaction speed is essential. Here is an example: https://www.youtube.com/watch?v=Y0w_cRt7RzI.
Thanks very much for all those technical tips, but no one is giving an opinion on what to me is a key issue: "I feel that EV3 Python is brilliantly situated where the most-taught textual programming language in the world meets the most popular robotic platform in the world. It would be logical for all the schools that teach Python and can afford EV3 kits to be using EV3 Python to spice up their Python classes and to give students some exposure to robotics, a field that is likely to have a huge impact on human society over the coming decades. EV3 Python should be in use in thousands of schools around the world!"
Thanks very much for all those technical tips, but no one is giving an opinion on what to me is a key issue
I didn't think that was a point of discussion. In my mind, there's no question: Python running on an EV3 is a great platform for teaching textual programming. We haven't done much for direct promotion in part because we haven't felt that the platform was ready; now that we are achieving something stable and documented, I think it makes a lot more sense to promote ev3dev. My hope would be that you can pilot this: try it out in a real classroom and tell us what worked and what didn't, as you've already been doing. We'd want to know how users felt, what might need more clarification, and just overall how you felt about it. Then we can look into advertising it for a wider audience, once we know it has worked well once through a more closely monitored trial.
This has been my hope from the beginning, so seeing it realized would be very exciting!
I'm about to redo and extend the videos I made but I suppose I should wait for the new release to come out since you said about a week ago that 'We expect to release an official image (which will be pretty much exactly the same as the most recent nightly) within the next few days '. Any idea around what date that might happen? I note that pre-releases (for the EV3) up to 30 December 2015 came out every 60 days on average but that it's been 276 days since that December pre-release! Can I dare to hope that the new pre-release will include a fix to issues 220 / 752?
I'm about to redo and extend the videos I made but I suppose I should wait for the new release to come out since you said about a week ago that 'We expect to release an official image (which will be pretty much exactly the same as the most recent nightly) within the next few days '. Any idea around what date that might happen?
That's up to @dlech, I think. We may be waiting on OpenRoberta (ping @ensonic); I'm not sure.
I note that pre-releases (for the EV3) up to 30 December 2015 came out every 60 days on average but that it's been 276 days since that December pre-release!
Those releases were minor changes -- maintenance, mostly. This release contains lots of major upgrades, breaking changes and fixes which we haven't wanted to release in parts. Don't expect releases to be regularly-spaced, because they depend on the specific changes that were made.
Can I dare to hope that the new pre-release will include a fix to issues 220 / 752?
The action item is ev3dev/ev3dev#752, which hasn't been looked into yet, so I doubt it will be included. I think we are generally going to prioritize getting a release out over fixing that specific bug, because there are so many other fixes and changes that we wouldn't want to continue to delay. I'm just speaking based on my personal expectations though, so the final say is really @dlech's.
@dlech and @wasabifan - thanks for your careful replies to this important question. Let's hope 2017 is the year of Python on the EV3
ev3.Sound.speak('EV3 Python rules!')
@WasabiFan I updated already. Will push a new version by the end of this week (need to port the bluetooth stuff).
Anything more to do here or can we close?
I put some comments on my website that are too long-winded, too 'philosophical', too multi-faceted and perhaps too self-indulgent to put on an issues page. However, I've been persuaded to put a link to it here anyway so that people can respond to it. You'll find the message on my www.ev3python.com site at https://sites.google.com/site/ev3python/message-3-to-ev3dev-team ...