导航

    • 登录
    • 搜索
    • 版块
    • 产品
    • 教程
    • 论坛
    • 淘宝
    1. 主页
    2. 3tg5
    3
    • 举报资料
    • 资料
    • 关注
    • 粉丝
    • 屏蔽
    • 帖子
    • 楼层
    • 最佳
    • 群组

    3tg5

    @3tg5

    0
    声望
    5
    楼层
    1090
    资料浏览
    0
    粉丝
    0
    关注
    注册时间 最后登录

    3tg5 关注

    3tg5 发布的帖子

    • RE: lcd连接数据线的时候能正常显示,外接电源之后中间有一半白屏是怎么回事

      0_1572269094064_852B78E315A605550E330DB196766244.jpg

      发布在 OpenMV Cam
      3
      3tg5
    • RE: lcd连接数据线的时候能正常显示,外接电源之后中间有一半白屏是怎么回事

      THRESHOLD = (51, 100, 0, 21, 12, 33) #线路阈值
      import sensor, image, time,lcd
      from pyb import Servo
      from pid import PID
      rho_pid = PID(p=0.4, i=0) #截距
      theta_pid = PID(p=0.001, i=0) #斜率

      s1 = Servo(3) # P9
      def run(_angle,_range,_sleep): #角度,幅度,间隔延时
      s1.angle(_angle+_range) #角度,转到该角度的时间
      time.sleep(_sleep)
      s1.angle(_angle-_range)
      time.sleep(_sleep)

      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QQVGA) # 80x60 (4,800 pixels) - O(N^2) max = 2,3040,000.
      #sensor.set_windowing([0,20,80,40])
      sensor.skip_frames(time = 2000) # WARNING: If you use QQVGA it may take seconds
      clock = time.clock() # to process a frame sometimes.

      lcd.init()

      while(True):
      clock.tick()
      #img = sensor.snapshot()
      img = sensor.snapshot()
      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(),theta_err)

          #lcd.display(sensor.snapshot())
          lcd.display(img.draw_line(line.line(),color=127))
          if line.magnitude()>0:
              #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
              #output=output*3
              if theta_err>70:        #限制摆动角度
                  theta_err=70
              if theta_err<-70:
                  theta_err=-70
              run(theta_err,15,180)     #角度,幅度,间隔延时
          pass![0_1572269044774_852B78E315A605550E330DB196766244.jpg](https://fcdn.singtown.com/0c8ae143-f07e-48e3-99e2-85338bb96b25.jpg)
      发布在 OpenMV Cam
      3
      3tg5
    • lcd连接数据线的时候能正常显示,外接电源之后中间有一半白屏是怎么回事

      lcd连接数据线的时候能正常显示,外接电源之后中间有一半白屏是怎么回事

      发布在 OpenMV Cam
      3
      3tg5
    • openmv4 lcd和舵机怎么同时控制

      单独使用LCD和单独使用舵机都能动,但是一起的时候舵机就动不了了,该怎么办呢?

      THRESHOLD = (86, 100, -16, 8, -23, 23) #线路阈值
      import sensor, image, time,lcd
      from pyb import Servo
      from pid import PID
      rho_pid = PID(p=0.4, i=0)       #截距
      theta_pid = PID(p=0.001, i=0)   #斜率
      
      s1 = Servo(1) # P7
      def run(_angle,_range,_sleep): #角度,幅度,间隔延时
              s1.angle(_angle+_range)  #角度,转到该角度的时间
              time.sleep(_sleep)
              s1.angle(_angle-_range)
              time.sleep(_sleep)
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QQVGA) # 80x60 (4,800 pixels) - O(N^2) max = 2,3040,000.
      #sensor.set_windowing([0,20,80,40])
      sensor.skip_frames(time = 2000)     # WARNING: If you use QQVGA it may take seconds
      clock = time.clock()                # to process a frame sometimes.
      
      lcd.init()
      
      while(True):
          clock.tick()
          #img = sensor.snapshot()
          img = sensor.snapshot()
          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(),theta_err)
              
              #lcd.display(sensor.snapshot())
              lcd.display(img.draw_line(line.line(),color=127))
              if line.magnitude()>0:
                  #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
                  #output=output*3
                  if theta_err>70:        #限制摆动角度
                      theta_err=70
                  if theta_err<-70:
                      theta_err=-70
                  run(theta_err,15,180)     #角度,幅度,间隔延时
              pass
      
      
      发布在 OpenMV Cam
      3
      3tg5
    • openmv内存不够,MemoryError了怎么解决?
      import sensor, image, time
      import pyb
      pin0 = pyb.Pin('P0', pyb.Pin.OUT_PP) #蜂鸣器低电平端
      pin1 = pyb.Pin('P1', pyb.Pin.OUT_PP) #蜂鸣器高电平端
      
      thresholds = [(9, 41, -13, 39, -2, 31)]     #高水位试验阈值
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QVGA)
      sensor.skip_frames(time = 2000)
      sensor.set_auto_gain(False) # must be turned off for color tracking
      sensor.set_auto_whitebal(False) # must be turned off for color tracking
      clock = time.clock()
      ROI=(0,0,320,130)
      while(1) :
          clock.tick()
          img = sensor.snapshot()
          for blob in img.find_blobs([thresholds[0]],roi=ROI, pixels_threshold=200, area_threshold=200, merge=True):
              img.draw_rectangle(blob.rect())
              img.draw_cross(blob.cx(), blob.cy())
              img.draw_rectangle(ROI)
              blobs = img.find_blobs([thresholds[0]])
              if blobs:
                  pin0.low()
                  #pin1.low()
                  #time.sleep(200)
                  pin1.high()
                  time.sleep(200)
                  pin1.low()
                  #time.sleep(2000)
      
      发布在 OpenMV Cam
      3
      3tg5