导航

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

    15822004929

    @15822004929

    0
    声望
    11
    楼层
    1007
    资料浏览
    0
    粉丝
    0
    关注
    注册时间 最后登录
    电子邮件 657695742@qq.com

    15822004929 关注

    15822004929 发布的帖子

    • MAVLink AprilTags Landing Target 修改分辨率后报错

      报错:OSError:The maximum supported resolution for find_apriltags() is <64k pixels.
      为了增加识别距离,提高了识别率

      # MAVLink AprilTags Landing Target Script.
      #
      # This script sends out AprilTag detections using the MAVLink protocol to
      # an ArduPilot/PixHawk controller for precision landing using your OpenMV Cam.
      #
      # P4 = TXD
      
      import image, math, pyb, sensor, struct, time
      
      
      import time, pyb
      
      led1 = pyb.LED(1) # Red LED = 1, Green LED = 2, Blue LED = 3, IR LEDs = 4.
      led2 = pyb.LED(2)
      led3 = pyb.LED(3)
      
      
      # Parameters #################################################################
      
      uart_baudrate = 115200
      
      MAV_system_id = 1
      MAV_component_id = 0x54
      MAX_DISTANCE_SENSOR_enable = True
      
      lens_mm = 2.8 # Standard Lens.
      lens_to_camera_mm = 22 # Standard Lens.
      sensor_w_mm = 3.984 # For OV7725 sensor - see datasheet.
      sensor_h_mm = 2.952 # For OV7725 sensor - see datasheet.
      
      # Only tags with a tag ID in the dictionary below will be accepted by this
      # code. You may add as many tag IDs to the below dictionary as you want...
      
      # For each tag ID you need to provide then length of the black tag border
      # in mm. Any side of the tag black border square will work.
      
      valid_tag_ids = {
                        0 : 165, # 8.5" x 11" tag black border size in mm
                        1 : 165, # 8.5" x 11" tag black border size in mm
                        2 : 165, # 8.5" x 11" tag black border size in mm
                      }
      
      
      
      
      ##############################################################################
      
      # Camera Setup
      
      sensor.reset()
      sensor.set_pixformat(sensor.GRAYSCALE)
      sensor.set_framesize(sensor.QVGA)
      sensor.skip_frames(time = 2000)
      
      x_res = 320 # QQVGA
      y_res = 240 # QQVGA
      f_x = (lens_mm / sensor_w_mm) * x_res
      f_y = (lens_mm / sensor_h_mm) * y_res
      c_x = x_res / 2
      c_y = y_res / 2
      h_fov = 2 * math.atan((sensor_w_mm / 2) / lens_mm)
      v_fov = 2 * math.atan((sensor_h_mm / 2) / lens_mm)
      
      def z_to_mm(z_translation, tag_size): # z_translation is in decimeters...
          return (((z_translation * 100) * tag_size) / 165) - lens_to_camera_mm
      
      # Link Setup
      
      uart = pyb.UART(3, uart_baudrate, timeout_char = 1000)
      
      # Helper Stuff
      
      packet_sequence = 0
      
      def checksum(data, extra): # https://github.com/mavlink/c_library_v1/blob/master/checksum.h
          output = 0xFFFF
          for i in range(len(data)):
              tmp = data[i] ^ (output & 0xFF)
              tmp = (tmp ^ (tmp << 4)) & 0xFF
              output = ((output >> 8) ^ (tmp << 8) ^ (tmp << 3) ^ (tmp >> 4)) & 0xFFFF
          tmp = extra ^ (output & 0xFF)
          tmp = (tmp ^ (tmp << 4)) & 0xFF
          output = ((output >> 8) ^ (tmp << 8) ^ (tmp << 3) ^ (tmp >> 4)) & 0xFFFF
          return output
      
      MAV_DISTANCE_SENSOR_message_id = 132
      MAV_DISTANCE_SENSOR_min_distance = 1 # in cm
      MAV_DISTANCE_SENSOR_max_distance = 10000 # in cm
      MAV_DISTANCE_SENSOR_type = 0 # MAV_DISTANCE_SENSOR_LASER
      MAV_DISTANCE_SENSOR_id = 0 # unused
      MAV_DISTANCE_SENSOR_orientation = 25 # MAV_SENSOR_ROTATION_PITCH_270
      MAV_DISTANCE_SENSOR_covariance = 0 # unused
      MAV_DISTANCE_SENSOR_extra_crc = 85
      
      # http://mavlink.org/messages/common#DISTANCE_SENSOR
      # https://github.com/mavlink/c_library_v1/blob/master/common/mavlink_msg_distance_sensor.h
      def send_distance_sensor_packet(tag, tag_size):
          global packet_sequence
          temp = struct.pack("<lhhhbbbb",
                             0,
                             MAV_DISTANCE_SENSOR_min_distance,
                             MAV_DISTANCE_SENSOR_max_distance,
                             min(max(int(z_to_mm(tag.z_translation(), tag_size) / 10), MAV_DISTANCE_SENSOR_min_distance), MAV_DISTANCE_SENSOR_max_distance),
                             MAV_DISTANCE_SENSOR_type,
                             MAV_DISTANCE_SENSOR_id,
                             MAV_DISTANCE_SENSOR_orientation,
                             MAV_DISTANCE_SENSOR_covariance)
          temp = struct.pack("<bbbbb14s",
                             14,
                             packet_sequence & 0xFF,
                             MAV_system_id,
                             MAV_component_id,
                             MAV_DISTANCE_SENSOR_message_id,
                             temp)
          temp = struct.pack("<b19sh",
                             0xFE,
                             temp,
                             checksum(temp, MAV_DISTANCE_SENSOR_extra_crc))
          packet_sequence += 1
          uart.write(temp)
      
      MAV_LANDING_TARGET_message_id = 149
      MAV_LANDING_TARGET_min_distance = 1/100 # in meters
      MAV_LANDING_TARGET_max_distance = 10000/100 # in meters
      MAV_LANDING_TARGET_frame = 8 # MAV_FRAME_BODY_NED
      MAV_LANDING_TARGET_extra_crc = 200
      
      # http://mavlink.org/messages/common#LANDING_TARGET
      # https://github.com/mavlink/c_library_v1/blob/master/common/mavlink_msg_landing_target.h
      def send_landing_target_packet(tag, w, h, tag_size):
          global packet_sequence
          temp = struct.pack("<qfffffbb",
                             0,
                             ((tag.cx() / w) - 0.5) * h_fov,
                             ((tag.cy() / h) - 0.5) * v_fov,
                             min(max(z_to_mm(tag.z_translation(), tag_size) / 1000, MAV_LANDING_TARGET_min_distance), MAV_LANDING_TARGET_max_distance),
                             0.0,
                             0.0,
                             0,
                             MAV_LANDING_TARGET_frame)
          temp = struct.pack("<bbbbb30s",
                             30,
                             packet_sequence & 0xFF,
                             MAV_system_id,
                             MAV_component_id,
                             MAV_LANDING_TARGET_message_id,
                             temp)
          temp = struct.pack("<b35sh",
                             0xFE,
                             temp,
                             checksum(temp, MAV_LANDING_TARGET_extra_crc))
          packet_sequence += 1
          uart.write(temp)
      
      # Main Loop
      
      clock = time.clock()
      while(True):
          clock.tick()
          img = sensor.snapshot()
          tags = sorted(img.find_apriltags(fx=f_x, fy=f_y, cx=c_x, cy=c_y), key = lambda x: x.w() * x.h(), reverse = True)
      
          if tags and (tags[0].id() in valid_tag_ids):
              if MAX_DISTANCE_SENSOR_enable: send_distance_sensor_packet(tags[0], valid_tag_ids[tags[0].id()])
              send_landing_target_packet(tags[0], img.width(), img.height(), valid_tag_ids[tags[0].id()])
              img.draw_rectangle(tags[0].rect())
              img.draw_cross(tags[0].cx(), tags[0].cy())
              print("Distance %f mm - FPS %f" % (z_to_mm(tags[0].z_translation(), valid_tag_ids[tags[0].id()]), clock.fps()))
      
              led1.on()
              led2.on()
              time.sleep(100)
              led1.off()
              led2.off()
      
      
      
          else:
              print("FPS %f" % clock.fps())
              led3.on()
              led1.on()
              time.sleep(100)
              led3.off()
              led1.off()
      
      
      请在这里粘贴代码
      
      发布在 OpenMV Cam
      1
      15822004929
    • 用mavlink_apriltags_landing_target代码实现apriltag定点降落不工作

      用mavlink_apriltags_landing_target代码实现apriltag定点降落,和飞控接好线后实测,发现没什么效果
      猜测原因:
      1.apriltag打印的太小,识别距离太近,因为是A4纸打印的,有建议打印的值吗?比如打印1米长宽的图标
      2.基于openMV3自带摄像头,拍摄距离太近,有没有配套的识别远距离的摄像头,可以在更远的高度识别图标?
      3.建议下降速度建议调到多少?下降速度10cm/s?

      0_1557133743300_3edc4ec5-6448-412c-91df-8a9e4c1aa39f.png

      发布在 OpenMV Cam
      1
      15822004929
    • 无人机通过mavlink实现apriltag定点降落,lens_to_camera_mm = 22是指的什么值?

      在mavlink_apriltags_landing_target无人机通过mavlink实现apriltag定点降落代码中:

      lens_mm = 2.8 # Standard Lens,这个值是镜头的焦距
      lens_to_camera_mm = 22 # Standard Lens. 这个值是指的什么值?????

      发布在 OpenMV Cam
      1
      15822004929
    • OpenMV4 H7摄像头 识别距离能达到多远?

      1.做precision landing ,A4值打印的AprilTags,识别距离是多远?
      2.用telem1 端口按图连接好后,需要在地面站设置什么参数吗?比如plnd enabled
      0_1557045663635_3edc4ec5-6448-412c-91df-8a9e4c1aa39f.png

      发布在 OpenMV Cam
      1
      15822004929
    • RE: openMV能用pixhawk飞控上串口的5v供电吗?

      thanks a lot

      发布在 OpenMV Cam
      1
      15822004929
    • openMV能用pixhawk飞控上串口的5v供电吗?

      openMV能用飞控上串口的5v直接供电吗?这样共地也就解决了

      发布在 OpenMV Cam
      1
      15822004929
    • 利用openMV 里面的MAVLink AprilTags Landing 代码,如何在pixhawk中调试和实现

      计划用openmv中的MAVLink AprilTags Landing Target 代码在pixhawk飞控中实现定点降落功能
      1.openmv应该如何和pixhawk飞控接线?
      2.如何进行代码调试,看看是否运行正确,数据是否正确发送?

      发布在 OpenMV Cam
      1
      15822004929
    • RE: OPENMV怎么实现pixhawk无人机定点降落?

      请问问题解决了吗?

      发布在 OpenMV Cam
      1
      15822004929
    • RE: 请问openmv怎么和pixhawk连接?

      请问问题解决了吗?怎么做到了,谢谢

      发布在 OpenMV Cam
      1
      15822004929