Skip to content

Commit

Permalink
added warings for using no_collision.py and scanning.py
Browse files Browse the repository at this point in the history
  • Loading branch information
choeffer committed Oct 31, 2018
1 parent 881aa26 commit 5211d01
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 12 deletions.
22 changes: 18 additions & 4 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,9 @@ Moving standard servo

The following code stears the standard servo stand_data_sheet_ . First
to the middle position, then to the max right, then to max left and finally
to 45 degree. This example is included as ``move_stand_servo.py`` in the
root of the git repository.
to 45 degree (regarding reached max left and max right). See
:class:`lib_scanner.para_standard_servo` how to use it. This example is
included as ``move_stand_servo.py`` in the root of the git repository.

.. code-block:: python
Expand All @@ -227,8 +228,7 @@ root of the git repository.
pi = pigpio.pi()
servo = lib_scanner.para_standard_servo(gpio = 22, pi = pi,
min_pw = 600, max_pw = 2350)
servo = lib_scanner.para_standard_servo(pi = pi, gpio = 22)
servo.middle_position()
time.sleep(2)
Expand All @@ -248,6 +248,13 @@ The following code scans the surrounding of the robot in all five default
angles and prints out the result. This example is included as ``scanning.py``
in the root of the git repository.

.. warning::

Make sure that the ``min_pw`` and ``max_pw`` values are carefully tested
**before** using this example, see **warning** in
:class:`lib_scanner.para_standard_servo`! The default values for the
created ranger object are just valid for the demo implementation!

.. code-block:: python
import pigpio
Expand Down Expand Up @@ -277,6 +284,13 @@ than 40 cm at the five default measuring angles. If not, the robot will
drive 20 cm forward. This loop continues until it is stopped. This example
is included as ``no_collision.py`` in the root of the git repository.

.. warning::

Make sure that the ``min_pw`` and ``max_pw`` values are carefully tested
**before** using this example, see **warning** in
:class:`lib_scanner.para_standard_servo`! The default values for the
created ranger object are just valid for the demo implementation!

.. code-block:: python
import time
Expand Down
6 changes: 2 additions & 4 deletions emergency_stop.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@

pi = pigpio.pi()

servo_l = lib_para_360_servo.write_pwm(pi = pi, gpio = gpio_l,
min_pw = 1280, max_pw = 1720)
servo_l = lib_para_360_servo.write_pwm(pi = pi, gpio = gpio_l)

servo_r = lib_para_360_servo.write_pwm(pi = pi, gpio = gpio_r,
min_pw = 1280, max_pw = 1720)
servo_r = lib_para_360_servo.write_pwm(pi = pi, gpio = gpio_r)

#buffer time for initializing everything
time.sleep(1)
Expand Down
6 changes: 4 additions & 2 deletions lib_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,12 @@ class scanner:
To this GPIO the signal wire of the servo has to be connected.
:param int min_pw:
Min pulsewidth, see **Warning**, carefully test the value before!
**Default:** 1000, taken from set_servo_pulsewidth_ .
**Default:** 600, tested carefully, see warning, value just valid for the
demo implementation!
:param int max_pw:
Max pulsewidth, see **Warning**, carefully test the value before!
**Default:** 2000, taken from set_servo_pulsewidth_ .
**Default:** 2350, tested carefully, see warning, value just valid for the
demo implementation!
:param int min_degree:
Min degree which the servo is able to move.
**Default:** -90, taken from stand_data_sheet_ .
Expand Down
3 changes: 1 addition & 2 deletions move_stand_servo.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

pi = pigpio.pi()

servo = lib_scanner.para_standard_servo(gpio = 22, pi = pi,
min_pw = 600, max_pw = 2350)
servo = lib_scanner.para_standard_servo(pi = pi, gpio = 22)

servo.middle_position()
time.sleep(2)
Expand Down
10 changes: 10 additions & 0 deletions no_collision.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@
pi = pigpio.pi()

robot = lib_motion.motion(pi = pi)

"""
.. warning::
Make sure that the ``min_pw`` and ``max_pw`` values are carefully tested
**before** using this example, see **warning** in
:class:`lib_scanner.para_standard_servo`! The default values for the
created ranger object are just valid for the demo implementation!
"""

ranger = lib_scanner.scanner(pi = pi)

while True:
Expand Down
9 changes: 9 additions & 0 deletions scanning.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@

pi = pigpio.pi()

"""
.. warning::
Make sure that the ``min_pw`` and ``max_pw`` values are carefully tested
**before** using this example, see **warning** in
:class:`lib_scanner.para_standard_servo`! The default values for the
created ranger object are just valid for the demo implementation!
"""

ranger = lib_scanner.scanner(pi = pi)

distances = ranger.read_all_angles()
Expand Down

0 comments on commit 5211d01

Please sign in to comment.