Skip to main content

Python language bindings for ev3dev

Project description

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.large_motor('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.large_motor('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


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.2.1.post16.tar.gz (35.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file python-ev3dev-0.2.1.post16.tar.gz.

File metadata

File hashes

Hashes for python-ev3dev-0.2.1.post16.tar.gz
Algorithm Hash digest
SHA256 142a6e9e5348cc470c4f0489963a1c34c65586763a951752385eb6c17d028c92
MD5 4f7277706bb840e49b4a7de39f7f8d2f
BLAKE2b-256 449bf34f3f0c8d99a7a1ca677532fd2f48ea6fde7f7b50536798851764d4bf07

See more details on using hashes here.

File details

Details for the file python_ev3dev-0.2.1.post16-py3.4-linux-armv6l.egg.

File metadata

File hashes

Hashes for python_ev3dev-0.2.1.post16-py3.4-linux-armv6l.egg
Algorithm Hash digest
SHA256 7e2db9cdc18af638b87544558f0c97effdd4ea922f2ddc6804d7dec04806fa04
MD5 d0fd8fc46553987524316b96f7712eca
BLAKE2b-256 d889a36906070bbea885a763fb83de400ae14e12fca29394c190e4ac953b5daf

See more details on using hashes here.

File details

Details for the file python_ev3dev-0.2.1.post16-py3.4-linux-armv5tejl.egg.

File metadata

File hashes

Hashes for python_ev3dev-0.2.1.post16-py3.4-linux-armv5tejl.egg
Algorithm Hash digest
SHA256 04dbb14a0aaf5c9225f5632a0f44b5e4b25ad9329ae1bc43ecd1889c16b9953d
MD5 7e740bdd764a08938522f99ae6a09672
BLAKE2b-256 1bbc24a3004c33dc2d1d7977ac34e2bb4b87155ec89c4662b7805a43de4a8b95

See more details on using hashes here.

File details

Details for the file python_ev3dev-0.2.1.post16-py2.7-linux-armv6l.egg.

File metadata

File hashes

Hashes for python_ev3dev-0.2.1.post16-py2.7-linux-armv6l.egg
Algorithm Hash digest
SHA256 40266776dd0d6925cf69dc3b23e298da4341585881c728463d3ef14a0eb252a1
MD5 3f43bbf6c0094f116f3f9cf9ee446346
BLAKE2b-256 fdf364545ed9311eee11c7ef0bf3eacd00efd5d4879fd197f415b6408a16232b

See more details on using hashes here.

File details

Details for the file python_ev3dev-0.2.1.post16-py2.7-linux-armv5tejl.egg.

File metadata

File hashes

Hashes for python_ev3dev-0.2.1.post16-py2.7-linux-armv5tejl.egg
Algorithm Hash digest
SHA256 5f1ad57399da8e99dba610b06a131150ef6ca44111b1ad6d0cba41743202a9be
MD5 15ccedd87598cdb0ad2670659f994194
BLAKE2b-256 0dae4652ec799d40345316953630f8f722bdafe4d422cf4f73718ec41ad61533

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page