openMV摄像头循迹小车

您所在的位置:网站首页 循迹小车代码 openMV摄像头循迹小车

openMV摄像头循迹小车

2023-10-08 17:57| 来源: 网络整理| 查看: 265

主控MSP430F5529,电机驱动模块L298N,openMV摄像头 一、总体思路

使用openMV线性回归,然后使用pid输出,使用串口发送到MSP430,在经过处理输出PWM到车轮,实现循迹

二、openMV代码 THRESHOLD = (0, 20, -128, 127, -128, 127) # Grayscale threshold for dark things... import sensor, image, time from pyb import UART,LED from pid import PID import ustruct rho_pid = PID(p=0.17, i=0 , d=0)#y=ax+b b截距 theta_pid = PID(p=0.001, i=0, d=0)#a斜率 sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QQQVGA) # 80x60 (4,800 pixels) - O(N^2) max = 2,3040,000. sensor.skip_frames(time = 2000) # 跳过2s帧 clock = time.clock() # to process a frame sometimes. uart = UART(3,115200) #定义串口3变量 uart.init(115200, bits=8, parity=None, stop=1) # init with given parameters def sending_data(xw): global uart; data = ustruct.pack("


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3