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.2.post10.tar.gz (37.1 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.2.post10.tar.gz.

File metadata

File hashes

Hashes for python-ev3dev-0.2.2.post10.tar.gz
Algorithm Hash digest
SHA256 f4faa14be721d2c550e53440a6df9c94873a2260aed253249c514a7de776c60e
MD5 1feb334f8e45902fe02806da4c61a9c8
BLAKE2b-256 b29fc08e623a60fe4b2611d21904c793b705c40ab555f61a71c686e3a9014496

See more details on using hashes here.

File details

Details for the file python_ev3dev-0.2.2.post10-py3.4-linux-armv6l.egg.

File metadata

File hashes

Hashes for python_ev3dev-0.2.2.post10-py3.4-linux-armv6l.egg
Algorithm Hash digest
SHA256 b60935052b7d231a0b866aa2c7121a4a68eac9366d98f692d12a2f798f5770e7
MD5 4c8a2fb1cbbce9df421d49d83f4f74d4
BLAKE2b-256 14c061f9f3c4e2ebd01a5daf83665f1f4fdb93fa2db9ca9b1acd5d6f84cae948

See more details on using hashes here.

File details

Details for the file python_ev3dev-0.2.2.post10-py3.4-linux-armv5tejl.egg.

File metadata

File hashes

Hashes for python_ev3dev-0.2.2.post10-py3.4-linux-armv5tejl.egg
Algorithm Hash digest
SHA256 1317866cb52da28df57b0e4c1db49456eab8ef4fd40ff47d34d03bcdc506d2eb
MD5 f8e9a9361b2a99c19fa1594a8845a23e
BLAKE2b-256 78ddd98e5402be4ddf616910342aa32ad4a8fa777e181077ca8d6072811c0144

See more details on using hashes here.

File details

Details for the file python_ev3dev-0.2.2.post10-py2.7-linux-armv6l.egg.

File metadata

File hashes

Hashes for python_ev3dev-0.2.2.post10-py2.7-linux-armv6l.egg
Algorithm Hash digest
SHA256 28fa94b28ec644e7a1520b1895a00025e188b5ea3bf9f316510d6e297031422c
MD5 ac8e5ed2d9f58dc5133c603d05bea589
BLAKE2b-256 433c46ec5d2021ba43759e222693bf5b975f26480398a2805e19f2d500acc576

See more details on using hashes here.

File details

Details for the file python_ev3dev-0.2.2.post10-py2.7-linux-armv5tejl.egg.

File metadata

File hashes

Hashes for python_ev3dev-0.2.2.post10-py2.7-linux-armv5tejl.egg
Algorithm Hash digest
SHA256 0bf9091f2a0e2583d38482afcf2e68844233f6b8b52ed865157fc4ca86c204f2
MD5 ad4a3ad112042d95fd9230933e56200d
BLAKE2b-256 09d72f15e9b1488a44bafdb462f17dbafd5a624c9415221cf3c5ecf715081dc4

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