巡线小车不能按照线走
-
就是按照巡线小车例程里面的步骤开始做,最后运行的时候就是当小车跑偏之后视野中没有线,它原地旋转找到线,但是代码里面是line magnitude()>8,才能运动,每次原地旋转找到线只能找到一点线,达不到这个大于8的要求,所以就会停下来不动,这应该怎么做或者是怎么修改代码?
if line.magnitude()>8: #if -40<b_err<40 and -30<t_err<30: rho_output = rho_pid.get_pid(rho_err,1) theta_output = theta_pid.get_pid(theta_err,1) output = rho_output+theta_output car.run(50+output, 50-output) else: car.run(0,0) else: car.run(50,-50) pass #print(clock.fps())