Skip to content

Commit 6030987

Browse files
bpmerkelWasabiFan
authored andcommitted
Updated README, FAQ, and CONTRIBUTING documentation (ev3dev#653)
* Updated README, FAQ, and CONTRIBUTING documentation * changed to link; per code review; added MoveDifferential * Move `Demo Code` section from FAQ to README * Relocated Demo Code section
1 parent 33b1134 commit 6030987

4 files changed

Lines changed: 148 additions & 96 deletions

File tree

‎CONTRIBUTING.rst‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ take a moment to read our suggestions for happy maintainers and
1010
even happier users.
1111

1212
The ``ev3dev-stretch`` branch
13-
---------------------
13+
-----------------------------
1414

1515
This is where the latest version of our library lives. It targets
1616
`ev3dev-stretch`, which is currently considered a beta. Nonetheless,
@@ -39,13 +39,12 @@ notes.
3939
If your change addresses an Issue
4040
---------------------------------
4141

42-
Bug fixes are always welcome, especially if they are against known
42+
Bug fixes are always welcome, especially if they are against known
4343
issues!
4444

45-
When you send a pull request that addresses an issue, please add a
45+
When you send a pull request that addresses an issue, please add a
4646
note of the format ``Fixes #24`` in the PR so that the PR links back
4747
to its relevant issue and will automatically close the issue when the
4848
PR is merged.
4949

50-
.. _ev3dev: http://ev3dev.org
51-
50+
.. _ev3dev: http://ev3dev.org

‎README.rst‎

Lines changed: 50 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,19 @@ A Python3 library implementing an interface for ev3dev_ devices,
1414
letting you control motors, sensors, hardware buttons, LCD
1515
displays and more from Python code.
1616

17-
If you haven't written code in Python before, you'll need to learn the language
18-
before you can use this library.
17+
If you haven't written code in Python before, you can certainly use this
18+
library to help you learn the language!
1919

2020
Getting Started
2121
---------------
2222

2323
This library runs on ev3dev_. Before continuing, make sure that you have set up
24-
your EV3 or other ev3dev device as explained in the `ev3dev Getting Started guide`_.
25-
Make sure you have an ev3dev-stretch version greater than ``2.2.0``. You can check
26-
the kernel version by selecting "About" in Brickman and scrolling down to the
27-
"kernel version". If you don't have a compatible version, `upgrade the kernel before continuing`_.
24+
your EV3 or other ev3dev device as explained in the
25+
`ev3dev Getting Started guide`_. Make sure you have an ev3dev-stretch version
26+
greater than ``2.2.0``. You can check the kernel version by selecting
27+
"About" in Brickman and scrolling down to the "kernel version".
28+
If you don't have a compatible version,
29+
`upgrade the kernel before continuing`_.
2830

2931
Usage
3032
-----
@@ -36,8 +38,8 @@ once you have that set up.
3638

3739
Otherwise, you can can work with files `via an SSH connection`_ with an editor
3840
such as `nano`_, use the Python interactive REPL (type ``python3``), or roll
39-
your own solution. If you don't know how to do that, you are probably better off
40-
choosing the recommended option above.
41+
your own solution. If you don't know how to do that, you are probably
42+
better off choosing the recommended option above.
4143

4244
The template for a Python script
4345
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -64,16 +66,19 @@ or additional utilities.
6466

6567
You should use the ``.py`` extension for your file, e.g. ``my-file.py``.
6668

67-
If you encounter an error such as ``/usr/bin/env: 'python3\r': No such file or directory``,
68-
you must switch your editor's "line endings" setting for the file from "CRLF" to just "LF".
69-
This is usually in the status bar at the bottom. For help, see `our FAQ page`_.
69+
If you encounter an error such as
70+
``/usr/bin/env: 'python3\r': No such file or directory``,
71+
you must switch your editor's "line endings" setting for the file from
72+
"CRLF" to just "LF". This is usually in the status bar at the bottom.
73+
For help, see `our FAQ page`_.
7074

7175
Important: Make your script executable (non-Visual Studio Code only)
7276
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7377

7478
To be able to run your Python file, **your program must be executable**. If
75-
you are using the `ev3dev Visual Studio Code extension`_, you can skip this step,
76-
as it will be automatically performed when you download your code to the brick.
79+
you are using the `ev3dev Visual Studio Code extension`_, you can skip this
80+
step, as it will be automatically performed when you download your code to the
81+
brick.
7782

7883
**To mark a program as executable from the command line (often an SSH session),
7984
run** ``chmod +x my-file.py``.
@@ -85,8 +90,8 @@ Controlling the LEDs with a touch sensor
8590
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8691

8792
This code will turn the LEDs red whenever the touch sensor is pressed, and
88-
back to green when it's released. Plug a touch sensor into any sensor port before
89-
trying this out.
93+
back to green when it's released. Plug a touch sensor into any sensor port
94+
before trying this out.
9095

9196
.. code-block:: python
9297
@@ -120,8 +125,8 @@ This will run a LEGO Large Motor at 75% of maximum speed for 5 rotations.
120125
m.on_for_rotations(SpeedPercent(75), 5)
121126
122127
You can also run a motor for a number of degrees, an amount of time, or simply
123-
start it and let it run until you tell it to stop. Additionally, other units are
124-
also available. See the following pages for more information:
128+
start it and let it run until you tell it to stop. Additionally, other units
129+
are also available. See the following pages for more information:
125130

126131
- http://python-ev3dev.readthedocs.io/en/ev3dev-stretch/motors.html#ev3dev.motor.Motor.on_for_degrees
127132
- http://python-ev3dev.readthedocs.io/en/ev3dev-stretch/motors.html#units
@@ -138,12 +143,12 @@ The simplest drive control style is with the `MoveTank` class:
138143
# drive in a turn for 5 rotations of the outer motor
139144
# the first two parameters can be unit classes or percentages.
140145
tank_drive.on_for_rotations(SpeedPercent(50), SpeedPercent(75), 10)
141-
146+
142147
# drive in a different turn for 3 seconds
143148
tank_drive.on_for_seconds(SpeedPercent(60), SpeedPercent(30), 3)
144149
145-
There are also `MoveSteering` and `MoveJoystick` classes which provide different
146-
styles of control. See the following pages for more information:
150+
There are also `MoveSteering` and `MoveJoystick` classes which provide
151+
different styles of control. See the following pages for more information:
147152

148153
- http://python-ev3dev.readthedocs.io/en/ev3dev-stretch/motors.html#multiple-motor-groups
149154
- http://python-ev3dev.readthedocs.io/en/ev3dev-stretch/motors.html#units
@@ -160,74 +165,43 @@ If you want to make your robot speak, you can use the ``Sound.speak`` method:
160165
sound = Sound()
161166
sound.speak('Welcome to the E V 3 dev project!')
162167
163-
Make sure to check out the `User Resources`_ section for more detailed
164-
information on these features and many others.
168+
More Demo Code
169+
~~~~~~~~~~~~~~
170+
171+
There are several demo programs that you can run to get acquainted with
172+
this language binding. The programs are available
173+
`at this GitHub site <https://github.com/ev3dev/ev3dev-lang-python-demo>`_.
174+
175+
You can also copy and run the programs in the `utils` directory to
176+
understand some of the code constructs to use the EV3 motors, sensors,
177+
LCD console, buttons, sound, and LEDs.
178+
179+
We also highly recommend `ev3python.com`_ where one of our community
180+
members, @ndward, has put together a great website with detailed guides
181+
on using this library which are targeted at beginners. If you are just
182+
getting started with programming, we highly recommend that you check
183+
it out at `ev3python.com`_!
165184

166185
Using Micropython
167186
-----------------
168187

169-
Normal Python too slow? Try `Micropython`_ if it supports the features your
170-
project needs.
171-
172-
User Resources
173-
--------------
188+
Normal Python too slow? Review `Micropython`_ to see if it supports the
189+
features your project needs.
174190

175191
Library Documentation
176-
**Class documentation for this library can be found on** `our Read the Docs page`_ **.**
177-
You can always go there to get information on how you can use this
178-
library's functionality.
192+
---------------------
179193

180-
Demo Code
181-
There are several demo programs that you can run to get acquainted with
182-
this language binding. The programs are available at
183-
https://github.com/ev3dev/ev3dev-lang-python-demo
194+
**Class documentation for this library can be found on
195+
** `our Read the Docs page`_ **.** You can always go there to get
196+
information on how you can use this library's functionality.
184197

185-
ev3python.com
186-
One of our community members, @ndward, has put together a great website
187-
with detailed guides on using this library which are targeted at beginners.
188-
If you are just getting started with programming, we highly recommend
189-
that you check it out at `ev3python.com`_!
190198

191199
Frequently-Asked Questions
192-
Experiencing an odd error or unsure of how to do something that seems
193-
simple? Check our our `FAQ`_ to see if there's an existing answer.
194-
195-
ev3dev.org
196-
`ev3dev.org`_ is a great resource for finding guides and tutorials on
197-
using ev3dev, straight from the maintainers.
198-
199-
Support
200-
If you are having trouble using this library, please open an issue
201-
at `our Issues tracker`_ so that we can help you. When opening an
202-
issue, make sure to include as much information as possible about
203-
what you are trying to do and what you have tried. The issue template
204-
is in place to guide you through this process.
205-
206-
Upgrading this Library
207-
----------------------
208-
209-
You can upgrade this library from the command line as follows. Make sure
210-
to type the password (the default is ``maker``) when prompted.
211-
212-
.. code-block:: bash
213-
214-
sudo apt-get update
215-
sudo apt-get install --only-upgrade python3-ev3dev2
216-
217-
218-
Developer Resources
219-
-------------------
220-
221-
Python Package Index
222-
The Python language has a `package repository`_ where you can find
223-
libraries that others have written, including the `latest version of
224-
this package`_.
200+
--------------------------
225201

226-
Python 2.x and Python 3.x Compatibility
227-
---------------------------------------
202+
Experiencing an odd error or unsure of how to do something that seems
203+
simple? Check our our `FAQ`_ to see if there's an existing answer.
228204

229-
Some versions of the ev3dev_ distribution come with both `Python 2.x`_ and `Python 3.x`_ installed
230-
but this library is compatible only with Python 3.
231205

232206
.. _ev3dev: http://ev3dev.org
233207
.. _ev3dev.org: ev3dev_

‎docs/faq.rst‎

Lines changed: 74 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,81 @@
11
Frequently-Asked Questions
22
==========================
33

4-
My script works when launched as ``python3 script.py`` but exits immediately or throws an error when launched from Brickman or as ``./script.py``
5-
-------------------------------------------------------------------------------------------------------------------------------------------------
4+
Q: Why does my Python program exit quickly or immediately throw an error?
5+
A: This may occur if your file includes Windows-style line endings
6+
(CRLF--carriage-return line-feed), which are often inserted by editors on
7+
Windows. To resolve this issue, open an SSH session and run the following
8+
command, replacing ``<file>`` with the name of the Python file you're
9+
using:
610

7-
This may occur if your file includes Windows-style line endings, which are often
8-
inserted by editors on Windows. To resolve this issue, open an SSH session and
9-
run the following command, replacing ``<file>`` with the name of the Python file
10-
you're using:
11+
.. code:: shell
1112
12-
.. code:: shell
13+
sed -i 's/\r//g' <file>
1314
14-
sed -i 's/\r//g' <file>
15+
This will fix it for the copy of the file on the brick, but if you plan to edit
16+
it again from Windows, you should configure your editor to use Unix-style
17+
line endings (LF--line-feed). For PyCharm, you can find a guide on doing this
18+
`here <https://www.jetbrains.com/help/pycharm/2016.2/configuring-line-separators.html>`_.
19+
Most other editors have similar options; there may be an option for it in the
20+
status bar at the bottom of the window or in the menu bar at the top.
1521

16-
This will fix it for the copy of the file on the brick, but if you plan to edit
17-
it again from Windows you should configure your editor to use Unix-style endings.
18-
For PyCharm, you can find a guide on doing this `here <https://www.jetbrains.com/help/pycharm/2016.2/configuring-line-separators.html>`_.
19-
Most other editors have similar options; there may be an option for it in the
20-
status bar at the bottom of the window or in the menu bar at the top.
22+
Q: Where can I learn more about the ev3dev operating system?
23+
A: `ev3dev.org`_ is a great resource for finding guides and tutorials on
24+
using ev3dev, straight from the maintainers.
25+
26+
Q: How can I request support on the ev3dev2 Python library?
27+
A: If you are having trouble using this library, please open an issue
28+
at `our Issues tracker`_ so that we can help you. When opening an
29+
issue, make sure to include as much information as possible about
30+
what you are trying to do and what you have tried. The issue template
31+
is in place to guide you through this process.
32+
33+
Q: How can I upgrade the library on my EV3?
34+
A: You can upgrade this library from an Internet-connected EV3 with an
35+
SSH shell as follows. Make sure to type the password
36+
(the default is ``maker``) when prompted.
37+
38+
.. code-block:: bash
39+
40+
sudo apt-get update
41+
sudo apt-get install --only-upgrade python3-ev3dev2
42+
43+
Q: Are there other useful Python modules to use on the EV3?
44+
A: The Python language has a `package repository`_ where you can find
45+
libraries that others have written, including the `latest version of
46+
this package`_.
47+
48+
Q: What compatibility issues are there with the different versions of Python?
49+
A: Some versions of the ev3dev_ distribution come with
50+
`Python 2.x`_, `Python 3.x`_, and `micropython`_ installed,
51+
but this library is compatible only with Python 3 and micropython.
52+
53+
.. _ev3dev: http://ev3dev.org
54+
.. _ev3dev.org: ev3dev_
55+
.. _Getting Started: ev3dev-getting-started_
56+
.. _ev3dev Getting Started guide: ev3dev-getting-started_
57+
.. _ev3dev-getting-started: http://www.ev3dev.org/docs/getting-started/
58+
.. _upgrade the kernel before continuing: http://www.ev3dev.org/docs/tutorials/upgrading-ev3dev/
59+
.. _detailed instructions for USB connections: ev3dev-usb-internet_
60+
.. _via an SSH connection: http://www.ev3dev.org/docs/tutorials/connecting-to-ev3dev-with-ssh/
61+
.. _ev3dev-usb-internet: http://www.ev3dev.org/docs/tutorials/connecting-to-the-internet-via-usb/
62+
.. _our Read the Docs page: http://python-ev3dev.readthedocs.org/en/ev3dev-stretch/
63+
.. _ev3python.com: http://ev3python.com/
64+
.. _FAQ: http://python-ev3dev.readthedocs.io/en/ev3dev-stretch/faq.html
65+
.. _our FAQ page: FAQ_
66+
.. _our Issues tracker: https://github.com/ev3dev/ev3dev-lang-python/issues
67+
.. _EXPLOR3R: demo-robot_
68+
.. _demo-robot: http://robotsquare.com/2015/10/06/explor3r-building-instructions/
69+
.. _robot-square: http://robotsquare.com/
70+
.. _Python 2.x: python2_
71+
.. _python2: https://docs.python.org/2/
72+
.. _Python 3.x: python3_
73+
.. _python3: https://docs.python.org/3/
74+
.. _package repository: pypi_
75+
.. _pypi: https://pypi.python.org/pypi
76+
.. _latest version of this package: pypi-python-ev3dev_
77+
.. _pypi-python-ev3dev: https://pypi.python.org/pypi/python-ev3dev2
78+
.. _ev3dev Visual Studio Code extension: https://github.com/ev3dev/vscode-ev3dev-browser
79+
.. _Python + VSCode introduction tutorial: https://github.com/ev3dev/vscode-hello-python
80+
.. _nano: http://www.ev3dev.org/docs/tutorials/nano-cheat-sheet/
81+
.. _Micropython: http://python-ev3dev.readthedocs.io/en/ev3dev-stretch/micropython.html

0 commit comments

Comments
 (0)