Skip to content

Commit

Permalink
Added sphinx comment for encoder __init__ and fixed other small issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ksiegall committed Jul 12, 2023
1 parent efcfe72 commit d4f9f04
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions XRPLib/encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ class Encoder:
ticks_per_rev = _ticks_per_motor_shaft_revolution * _gear_ratio # 585

def __init__(self, index, encAPin, encBPin):
"""
Uses the on board PIO State Machine to keep track of encoder positions.
Only 4 encoders can be instantiated this way.
:param index: The index of the state machine to be used, indexed 0-3.
:type index: int
:param encAPin: The pin the left reflectance sensor is connected to
:type encAPin: int
:param encBPin: The pin the right reflectance sensor is connected to
:type encBPin: int
"""
if(abs(encAPin - encBPin) != 1):
raise Exception("Encoder pins must be successive!")
basePin = machine.Pin(min(encAPin, encBPin))
Expand Down
2 changes: 1 addition & 1 deletion XRPLib/rangefinder.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self, trigger_pin:int, echo_pin:int, timeout_us:int=500*2*30):
Timeouts will return a MAX_VALUE (65535) instead of raising an exception.
:param trigger_pin: The number of the pin on the microcontroller that's connected to the ``Trig`` pin on the HC-SR04.
:type trig_pin: int
:type trigger_pin: int
:param echo_pin: The number of the pin on the microcontroller that's connected to the ``Echo`` pin on the HC-SR04.
:type echo_pin: int
:param timeout_us: Max microseconds seconds to wait for a response from the sensor before assuming it isn't going to answer. By default set to 30,000 us (0.03 s)
Expand Down

0 comments on commit d4f9f04

Please sign in to comment.