print(output)那行ide里是对齐的,但是粘贴之后是不对齐的?
THRESHOLD = (36, 83, -43, 49, 60, -73)
import sensor, image, time
from pyb import LED
from pyb import UART
from pyb import delay
from pid import PID
uart = UART(3, 9600, timeout_char=1000)
rho_pid = PID(p=0.4, i=0)
theta_pid = PID(p=0.001, i=0)
LED(1).on()
LED(2).on()
LED(3).on()
sensor.reset()
sensor.set_vflip(True)
sensor.set_hmirror(True)
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQQVGA)
sensor.skip_frames(time = 2000)
clock = time.clock()
while(True):
clock.tick()
img = sensor.snapshot().binary([THRESHOLD])
line = img.get_regression([(100,100,0,0,0,0)], robust = True)
if (line):
rho_err = abs(line.rho())-img.width()/2
if line.theta()>90:
theta_err = line.theta()-180
else:
theta_err = line.theta()
img.draw_line(line.line(), color = 127)
#print(rho_err,line.magnitude(),rho_err)
if line.magnitude()>8:
rho_output = rho_pid.get_pid(rho_err,1)
theta_output = theta_pid.get_pid(theta_err,1)
output = rho_output+theta_output
uart.write('$'+str(int(output))+'&')
print(output)
delay(50)
else:
pass
L
lg5x
@lg5x
0
声望
2
楼层
381
资料浏览
0
粉丝
0
关注
lg5x 发布的帖子
-
报错是unindent does not match any outer indentation level?