Python language bindings for ev3dev
Project description
**Deprecation warning!** This version of python bindings has been deprecated in favor of `rhempel/ev3dev-lang-python`_. This repository is no longer under active developement.
.. _`rhempel/ev3dev-lang-python`: https://github.com/rhempel/ev3dev-lang-python
Python language bindings for ev3dev
===================================
This is a python library implementing unified interface for ev3dev_ devices.
The source code is hosted at https://github.com/ddemidov/ev3dev-lang-python.
.. _ev3dev: http://ev3dev.org
Installation
------------
* Prerequisites:
.. code-block:: bash
apt-get install libboost-python1.55.0 python-setuptools python-pil
These should be enough to install and use the library on your ev3. If you want
to install it on your main computer (for example, to let your IDE of choice
know about the library), or compile the library from source, you will also need
to install `libboost-python1.55-dev`.
* Now, the actual module installation:
.. code-block:: bash
easy_install -U python-ev3dev
Same command will upgrade already installed package to the latest available
version.
Usage
-----
Take a look at the provided demos_. The autogenerated reference
documentation is hosted at http://ddemidov.github.io/ev3dev-lang-python.
.. _demos: https://github.com/ddemidov/ev3dev-lang-python/tree/master/demo
Here is a simple example of running a large EV3 motor connected to output port
`A` for three seconds:
.. code-block:: python
>>> import ev3dev
>>> m = ev3dev.LargeMotor('outA')
>>> m.connected
True
>>> m.run_timed(time_sp=3000, duty_cycle_sp=75)
Remote operation
^^^^^^^^^^^^^^^^
.. highlight:: bash
There are a couple of options for running python code remotely on the EV3
(aside from obvious choice of doing everything in ssh session).
First, you can install `IPython Notebook`_ with:
.. code-block:: bash
apt-get install ipython-notebook
and `access the notebook server`_ from your main computer. There is a `nice
post`_ by Laurens Valk showing this in action. Unfortunately, the IPython
process seems to be rather heavy for the limited EV3 resources, and the
experience tends to deteriorate with time.
The second option is using RPyC_ (Remote Python Call) library. It may be
installed with:
.. code-block:: bash
pip install rpyc
You need to install it both on the EV3 and on the remote host.
After that, once you launch RPyC server with `rpyc_classic.py` command on the
EV3, you can connect to the server from your main computer:
.. code-block:: python
>>> import rpyc
>>> c = rpyc.classic.connect("192.168.10.42")
The parameter to `connect()` function is the host name or the ip address of the
EV3. After the connection is made, you can import the `ev3dev` module
remotely:
.. code-block:: python
>>> ev3dev = c.modules.ev3dev
>>> m = ev3dev.LargeMotor('outA')
>>> m.connected
True
>>> m.run_timed(time_sp=3000, duty_cycle_sp=75)
Note that the code is the same as in the example above once you connect to
remote RPyC server, although its run from a different machine. This may be used
either for interactive developing, or to run resource-heavy programs.
.. _IPython Notebook: http://ipython.org
.. _access the notebook server: https://coderwall.com/p/ohk6cg/remote-access-to-ipython-notebooks-via-ssh
.. _nice post: http://robotsquare.com/2014/06/12/linux-ev3/
.. _RPyC: https://rpyc.readthedocs.org/en/latest/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python-ev3dev-0.3.0.tar.gz
(37.4 kB
view hashes)
Built Distributions
Close
Hashes for python_ev3dev-0.3.0-py3.4-linux-armv6l.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8252b6e9b07b8482e696b58a0e5e8c84fe23b9936d92bfa7a269b9cc6a8ec8e9 |
|
MD5 | b42f5b14aabf1d51fb44638d334c0251 |
|
BLAKE2b-256 | 225ac61c862549f1b6616ed4d2a0ac0550171ca532114bb2eef41a5d79340982 |
Close
Hashes for python_ev3dev-0.3.0-py3.4-linux-armv5tejl.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac047cf7b942f3d38288f2e829616eb384f8d2e58ce908a4155e1c08454e3bfa |
|
MD5 | e4a3241b4e8fdc6d4031dfe922b8b63a |
|
BLAKE2b-256 | 0b28dabdedc1b77f806831d0963d129649b8ffd4a4ea9cb3128dcb9e980cc123 |
Close
Hashes for python_ev3dev-0.3.0-py2.7-linux-armv6l.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7967623d7277625df6ddc8b63566240369983927dc3ba02c2b303206376839df |
|
MD5 | ee55bee20efb887d2f4585dd0d04684b |
|
BLAKE2b-256 | 354fc2d5c8b1915f21ad20187324cb1cea7c4d5b54dfe1d1c5e74a6ec620fe56 |
Close
Hashes for python_ev3dev-0.3.0-py2.7-linux-armv5tejl.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4bc3f76da628ef178fe4255c1342043ca3e26eca85df08ba9e407b73592a9e77 |
|
MD5 | efe6c03540752a14f5eec5ac1456ff27 |
|
BLAKE2b-256 | 6870abf75d66fb39576da1d52f33318e551191a73624f3aca541c9f2ecdab37f |