Skip to content

Commit 004be56

Browse files
authored
Merge pull request #42 from LaboratoireMecaniqueLille/41-some-examples-in-tutorial-are-not-working
[fix] Bug in example code in the documentation
2 parents 431f60a + c45f1ab commit 004be56

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

.readthedocs.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,18 @@ sphinx:
1010
configuration: docs/source/conf.py
1111

1212
# Optionally set the version of Python and requirements required to build your docs
13+
build:
14+
os: ubuntu-22.04
15+
tools:
16+
python: "3.9"
17+
18+
sphinx:
19+
builder: html
20+
configuration: docs/source/conf.py
21+
fail_on_warning: true
22+
1323
python:
14-
version: "3.8"
15-
install:
16-
- method: setuptools
17-
path: .
18-
- requirements: requirements.txt
24+
install:
25+
- requirements: requirements.txt
26+
- method: pip
27+
path: .

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,4 @@
209209
# -- Options for intersphinx extension ---------------------------------------
210210

211211
# Example configuration for intersphinx: refer to the Python standard library.
212-
intersphinx_mapping = {'https://docs.python.org/': None}
212+
intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}

docs/source/tutorials/gettingstarted.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,7 @@ previous sections:
346346
347347
gen = crappy.blocks.Generator([
348348
{'type': 'constant', 'value': 1000, 'condition': 'delay=3'},
349-
{'type': 'ramp', 'speed': 100, 'condition': 'delay=5',
350-
'cmd': 0},
349+
{'type': 'ramp', 'speed': 100, 'condition': 'delay=5'},
351350
{'type': 'constant', 'value': 1800, 'condition': 'delay=3'},
352351
{'type': 'constant', 'value': 500, 'condition': 'delay=3'},
353352
{'type': 'sine', 'amplitude': 2000, 'offset': 1000, 'freq': .3,
@@ -370,7 +369,7 @@ previous sections:
370369
kd=0.05,
371370
out_max=10,
372371
out_min=-10,
373-
i_limit=0.5,
372+
i_limit=(-5, 5),
374373
target_label='command_speed',
375374
labels=['t(s)', 'voltage'],
376375
input_label='actual_speed')
@@ -389,16 +388,15 @@ outputted by the PID block. Finally the grapher needs to know the current speed
389388
and the command speed, just like the PID. So let's add the appropriate links :
390389

391390
.. code-block:: python
392-
:emphasize-lines: 37-45
391+
:emphasize-lines: 36-44
393392
394393
import crappy
395394
396395
if __name__ == '__main__':
397396
398397
gen = crappy.blocks.Generator([
399398
{'type': 'constant', 'value': 1000, 'condition': 'delay=3'},
400-
{'type': 'ramp', 'speed': 100, 'condition': 'delay=5',
401-
'cmd': 0},
399+
{'type': 'ramp', 'speed': 100, 'condition': 'delay=5'},
402400
{'type': 'constant', 'value': 1800, 'condition': 'delay=3'},
403401
{'type': 'constant', 'value': 500, 'condition': 'delay=3'},
404402
{'type': 'sine', 'amplitude': 2000, 'offset': 1000, 'freq': .3,
@@ -422,7 +420,7 @@ and the command speed, just like the PID. So let's add the appropriate links :
422420
kd=0.05,
423421
out_max=10,
424422
out_min=-10,
425-
i_limit=0.5,
423+
i_limit=(-5, 5),
426424
target_label='command_speed',
427425
labels=['t(s)', 'voltage'],
428426
input_label='actual_speed')

0 commit comments

Comments
 (0)