This commit is contained in:
Max 2021-09-21 13:36:33 +01:00
parent 66c19921dc
commit a760d29710

View File

@ -148,7 +148,7 @@ class VisionCargoApproacher:
self.centre_distance_thresh = (-0.2, 0.2) # horizontal tolerance for pallet alignment pre fork alignment
self.centre_angle_thresh = (-0.2, 0.2) # angular tolerance for pallet alignment pre fork alignment
self.horizontal_camera_offset = 0 # In case the camera isn't perfectly straight, we can compansate for that in code
self.steering_log_file = open("slf.file", 'w+')
self.steering_log_file = 'slf.file"
def navigate_to_cargo_vision(self):
self.log.info("Starting vision system")
@ -169,7 +169,9 @@ class VisionCargoApproacher:
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}"
self.log.info(little_log)
self.steering_log_file.writelines([little_log])
with open(self.steering_log_file, 'a+') as myfile:
myfile.writelines([little_log])
if area < self.max_approach_area_thresh: # If we are far enough from the cargo, move towards it
speed_pwm = remap(area, 40000, 1000, 1500, 2000)