Update documentation
This commit is contained in:
parent
0dc9e8e161
commit
e855429a8f
27 changed files with 2505 additions and 672 deletions
|
@ -21,18 +21,16 @@ Simple Linefollower
|
|||
IRSensor.set(4, True)
|
||||
IRSensor.set(5, True)
|
||||
|
||||
DRIVE_SPEED = 85
|
||||
TURN_SPEED = 50
|
||||
COLOR_BREAK = 750
|
||||
KP = 50.0
|
||||
DRIVE_SPEED = 75
|
||||
COLOR_BREAK = 900
|
||||
KP = 10.0
|
||||
KD = 0.0
|
||||
|
||||
def drive(leftSpeed, rightSpeed):
|
||||
leftSpeed *= -1
|
||||
rightSpeed *= 0.906
|
||||
rightSpeed *= -0.906
|
||||
|
||||
Motor.power(1, min(max(-100, leftSpeed), 100))
|
||||
Motor.power(2, min(max(-100, rightSpeed), 100))
|
||||
Motor.power(1, min(max(-100, rightSpeed), 100))
|
||||
Motor.power(4, min(max(-100, leftSpeed), 100))
|
||||
|
||||
def follow(sleepTime = 0.1):
|
||||
lastError = 0
|
||||
|
@ -58,7 +56,7 @@ Simple Linefollower
|
|||
error = 3
|
||||
elif error == -1.5:
|
||||
error = -3
|
||||
|
||||
|
||||
lastError = error
|
||||
|
||||
adjustment = KP * error + KD * (error - lastError)
|
||||
|
|
71
_sources/lib/QC.rst.txt
Normal file
71
_sources/lib/QC.rst.txt
Normal file
|
@ -0,0 +1,71 @@
|
|||
.. _lib_qc:
|
||||
|
||||
Quality Control
|
||||
###############
|
||||
|
||||
Infrared Test
|
||||
-------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from compLib.IRSensor import IRSensor
|
||||
import time
|
||||
|
||||
IRSensor.set(1, True)
|
||||
IRSensor.set(2, True)
|
||||
IRSensor.set(3, True)
|
||||
IRSensor.set(4, True)
|
||||
IRSensor.set(5, True)
|
||||
|
||||
while True:
|
||||
t = time.time()
|
||||
for i in range(1, 6):
|
||||
print(f"{i}: {IRSensor.read(i)}")
|
||||
print("")
|
||||
time.sleep(0.2)
|
||||
|
||||
Motor Test
|
||||
-------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from compLib.Motor import Motor
|
||||
from compLib.Encoder import Encoder
|
||||
import time
|
||||
|
||||
Motor.power(1, -50)
|
||||
Motor.power(4, 50)
|
||||
|
||||
while True:
|
||||
print(f"L:{Encoder.read(4)} R:{Encoder.read(1)}")
|
||||
time.sleep(0.1)
|
||||
|
||||
Servo Test
|
||||
-------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from compLib.Servo import Servo
|
||||
import time
|
||||
|
||||
for i in range(1, 8 + 1):
|
||||
Servo.set_position(i, 45)
|
||||
print(f"{i}")
|
||||
time.sleep(1)
|
||||
|
||||
Servo.setup_position()
|
||||
time.sleep(10)
|
||||
|
||||
Vision Test
|
||||
-------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import cv2
|
||||
from compLib import Vision
|
||||
from compLib.Servo import Servo
|
||||
|
||||
while True:
|
||||
frame = Vision.Streaming.get_frame()
|
||||
Vision.Streaming.publish_frame(frame)
|
||||
Servo.set_position(3, -45)
|
Reference in a new issue