Add Documentation for odometrty and robot class. Remove fast_fifo
This commit is contained in:
parent
c800b30e31
commit
866fac9848
7 changed files with 115 additions and 8 deletions
50
docs/source/lib/Odom.rst
Normal file
50
docs/source/lib/Odom.rst
Normal file
|
@ -0,0 +1,50 @@
|
|||
.. _lib_odom:
|
||||
|
||||
Odometry
|
||||
******
|
||||
|
||||
Class Documentation
|
||||
====================
|
||||
|
||||
.. autoclass:: compLib.Odom.Odometry
|
||||
:members:
|
||||
|
||||
.. autoclass:: compLib.Odom.Odom
|
||||
:members:
|
||||
|
||||
|
||||
Examples
|
||||
=========
|
||||
|
||||
Getting actual distance driven
|
||||
------------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import time
|
||||
import math
|
||||
from compLib.Motor import Motor
|
||||
from compLib.Encoder import Encoder
|
||||
from compLib.Odom import Odom, Odometry
|
||||
|
||||
# distance in meters
|
||||
# speed in % of max speed
|
||||
def drive_example(distance, speed):
|
||||
Odom.update()
|
||||
odom = Odom.get_odom()
|
||||
while abs(odom.get_x()) < distance:
|
||||
Odom.update()
|
||||
odom = Odom.get_odom()
|
||||
|
||||
Motor.power(4, speed)
|
||||
Motor.power(1, -speed)
|
||||
|
||||
print(f" Forward: {odom.get_x()} m")
|
||||
print(f" Right: {odom.get_y()} m")
|
||||
print(f" Turned: {math.degrees(odom.get_orientation())} degrees")
|
||||
|
||||
Motor.active_break(1)
|
||||
Motor.active_break(4)
|
||||
time.sleep(0.1)
|
||||
Encoder.clear_all()
|
||||
Odom.clear()
|
11
docs/source/lib/Robot.rst
Normal file
11
docs/source/lib/Robot.rst
Normal file
|
@ -0,0 +1,11 @@
|
|||
.. _lib_robot:
|
||||
|
||||
Robot
|
||||
******
|
||||
|
||||
Class Documentation
|
||||
====================
|
||||
|
||||
.. autoclass:: compLib.Robot.Robot
|
||||
:members:
|
||||
:private-members:
|
Reference in a new issue