This commit is contained in:
Max 2021-09-21 14:35:05 +01:00
parent b0a74fc585
commit 180b2f49bc

View File

@ -128,8 +128,8 @@ class VisionSystem:
class CargoApproachingSystem:
def __init__(self) -> None:
self.ky = 5
self.kt = -1
self.ky = 2
self.kt = -0.5
def calculate(self, ey, et):
delta = self.ky * math.atan(ey) + self.kt * et
@ -170,7 +170,7 @@ class VisionCargoApproacher:
delta = self.steering_law.calculate(error_x, error_theta) # getting the steering angle from the control law
# delta_PWM = remap(delta, -0.8, 0.8, 1000, 2000)
delta_PWM = remap(delta, 0.7, -0.7, 1900, 1100) # Converting steering law output into PWM values
little_log = f"Error y: {delta} | error theta {error_x} | steering_raw {error_theta} | steering_conv: {delta_PWM}, tag_area: {area};;;"
little_log = f"Error y: {delta} | error theta {error_x} | steering_raw {error_theta} | steering_conv: {delta_PWM}, tag_area: {area};;;\n"
self.log.info(little_log)
with open(self.steering_log_file, 'a+') as myfile: