ev3dev / ev3dev-lang-python

Pure python bindings for ev3dev
MIT License
430 stars 145 forks source link

Python IDEs for ev3dev that can run on Lego brick #160

Closed edmundronald closed 8 years ago

edmundronald commented 8 years ago

This thread is for discussing IDEs, preferably with code completion, etc. that will facilitate ev3dev application work.

Ideally, an IDE would be able to facilitate writing code by showing the package function definitions or documentation links. And it makes sense to talk about this as a design criterion for the code itself.

@nadehi18 has suggested atom.

Edmund

edmundronald commented 8 years ago

I would prefer to have something that runs on the EV3, because that way I can log in from anything that is lying around, including my iPad, and the files are already where I want them. Also, the IDE might as well be in the EV3 release.

Edmund

edmundronald commented 8 years ago

@nadehi18 Yup iPython or Jupyter allow one to create notebooks, but they're not really IDEs. I guess we'll continue this discussion when I have my brick with me again - at the moment I'm on vacation. Thank you for suggesting atom and sublime text!

WasabiFan commented 8 years ago

@nadehi18 Yes, there has been some previous discussion surrounding that project on ev3dev. In general, the conclusion has been that any editor running on the EV3 in real time is too slow for normal use (see ev3dev/ev3dev#432) because the processor isn't able to keep up with the work of hosting the live session.

There is one tutorial on ev3dev.org already that explains how to get PyCharm running. I haven't tried it myself, but as far as I know it should do what you are looking for, so I'd suggest trying that out. Note that there has been some discussion on this in ev3dev/ev3dev#619. Someone was having trouble following that tutorial, so if you try out this option it would be helpful if you post back there with your findings.

If you aren't happy with that option, I would recommend using your own editor that copies files over the network when you save. This minimizes the amount of work that the EV3 has to do and gives you a native experience with a choice of IDEs. This is how I do my ev3dev development; I use Visual Studio Code along with a community-made file sync plugin and I have found that it does everything that I need without any lag. Alternatively, if you don't have an editor with sync functionality, you could also try setting up an NFS file share or using a tool such as WinSCP or FileZilla to do the copy manually (but still quickly).

There has been a large amount of discussion on this topic in ev3dev/ev3dev#477, so I would recommend skimming through there to see if there's anything of interest to you. And it would be great to hear your opinion on what we can do to make the "getting started workflow" better (which is what we have been discussing there)!

edmundronald commented 8 years ago

@WasabiFan Dev envs are a recurring issue with the new linux-based devices which are not really embedded one-trick poneys, and not really full servers. I had much of the same issues with editing files on my Arduino Yun, which runs OpenWRT.

I'll scan through the refs you provided.

In the mean time, thank you for providing a beginner-friendly environment!

Edmund

edmundronald commented 8 years ago

I am looking through this https://wiki.python.org/moin/IntegratedDevelopmentEnvironments

Obviously, anything running X is going to be out.

laurensvalk commented 8 years ago

I'm presently using this, which is very light and easy to use:

geany2

In Ubuntu, it's very easy to just open the files on the EV3 by clicking "connect to server" in the file browser.

Then, you can just edit your code in any text editor you like. When you save your code, it's immediately stored on the EV3.

I use Geany, because it has a built-in terminal, but you could use something else and have a separate terminal window.

laurensvalk commented 8 years ago

You could copy paste it to a local folder after you're done, or even use something to sync it to a local folder automatically after each save, or use github.

edmundronald commented 8 years ago

Laurens, I think the "good" Python IDEs can do code completion, retrieve docs etc from any module ...but maybe for that they need to be running Python on the target. I'm talking from the perspective of a "beginner" who doesn't know where the docs are etc for the functionality - ie how to run a motor.

The big advantage of the Lego iconic language is that it is self-disclosing and self-documenting. Each tile tells you what you can do with that component.

laurensvalk commented 8 years ago

I'm aware, there have been quite a few threads about this. It's getting better. Ev3dev is just not there yet at this time.

edmundronald commented 8 years ago

I like Ev3Dev a lot; And I'm saying there might be some Python introspection technology out there we might leverage to make it even better easily, just like your mounting trick solves the Edit issue on Linux, and probably on Mac too with eg. TextWrangler. I am sure the crossdev issue with different Python envs exists for web devs too, and they probably have a fix.

edmundronald commented 8 years ago

@nadehi18 thx i am on mobile too. i will come back to you for help! Atm we're discussing finding a way for an sdk to automagically bring up the embedded docs etc while the enduser is editing ev3dev app code. Otherwise you need to findd the link to the right version docs etc.

edmundronald commented 8 years ago

@laurensvalk btw what did you improve in the balanc3r code? it is really much better. Have you found a better way to filter the gyro?

laurensvalk commented 8 years ago

btw what did you improve in the balanc3r code? it is really much better. Have you found a better way to filter the gyro?

I'm not sure what you mean as I didn't make changes recently, but you are welcome to ask about the segway code on its Github page here. I'm certainly interested in hearing about the code apparently performing differently.

edmundronald commented 8 years ago

I've posted a query on the atom forum; I think there should be a way to do introspection on the brick (or any remote machine) by editing the "run python" command preferences or something in the editor.

https://discuss.atom.io/t/edit-locally-code-complete-on-remote-python-mindstorms-ev3dev/28592

edmundronald commented 8 years ago

I have been playing around with various IDEs on the brick. Console mode is less and less supported by modern apps is my feeling, and this is unfortunate. X is a pig.

Console-mode emacs is very good, syntax coloration etc, and fast, with Terminal.app on the Mac supplying the console, any font you want. Of course you need to be happy to deal with emacs. The install line is given below, and one needs to know that F10 invokes the menu.

sudo apt-get install emacs24-nox

If one is willing to run X on the computer side, then Idle is usable, and also Geany. I tried them with Bluetooth and tethering, bluetooth is bad, tethering gives -barely- tolerable speed. The trick to getting an X server on a comp to work over ssh with client programs on the brick is to install Xauth. I believe Xauth should be installed by default together with some simple X clients eg. xclock to allow people to test their X configuration quickly.

edmundronald commented 8 years ago

I closed this issue by mistake - my bad. Apologies.

edmundronald commented 8 years ago

Yes. Bluetooth works fine with Emacs, but it is too slow for heavy X graphics apparently. Wired works -barely. Maybe wifi will work better. If you wanna check, just install xauth and your IDE of choice on the brick. All this graphics stuff has grown obese IMHO.

psychemedia commented 8 years ago

Another approach to running a GUI is to have a GUI client on a host and connect it to use a remote IPython kernel on the EV3.

If you have a client that works with Jupyter, a Jupyter server on a host can connect to a remote IPython kernel on the EV3.

See also this thread: https://github.com/ev3dev/ev3dev/issues/630#issuecomment-218870494

psychemedia commented 8 years ago

On the IPython front (IPython kernel running on brick and connecting to that as a remote kernel from elsewhere), I wonder if the Atom Hydrogen extension lets you work with remote kernels?

dwalton76 commented 8 years ago

Will close this one since I don't think there are any changes to make to the repo and the discussion had died down. Feel free to re-open if needed.