导航

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

    6iln

    @6iln

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

    6iln 关注

    6iln 发布的帖子

    • RE: 您好,如下串口通信代码,每次发一个字符?

      不好意思,没有说完,uart通信px4端,px4端代码,read(openmv_b,&data_b_r,1); //读取上位机信息,每次是读到一个字符吗?

      发布在 星瞳AI视觉模组
      6
      6iln
    • 您好,如下串口通信代码,每次发一个字符?
      while(True):
          clock.tick()  # Track elapsed milliseconds between snapshots().
          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):
              print_args = (tags[0].x_translation(), tags[0].y_translation(), tags[0].z_translation())
              # 位置的单位是未知的,旋转的单位是角度
              print("Tx: %f, Ty %f, Tz %f" % print_args)
              order_position='1'
              if tags[0].x_translation()>2:
                  order_position='D'; #偏左需向右
              elif tags[0].x_translation()<-2:
                  order_position='A'; #偏右需向左
              elif tags[0].y_translation()>2:
                  order_position='S';  #偏后需向前
              elif tags[0].y_translation()<-2:
                  order_position='W'; #偏前需向后
              else:
                  order_position='L'; #降落
              #output_str="[%c,%c]" % (order_position[0],order_position[1]) #方式1
              print('you send:',order_position)
              uart.write(order_position+'\r\n')
      
      发布在 星瞳AI视觉模组
      6
      6iln