<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      AirSim在UE4中運行時顯示第一人稱捕獲圖像窗口

      博客地址:http://www.rzrgm.cn/zylyehuo/

      參考鏈接: 【AirSim】

      具體效果可以關注博主的小紅書: 42891122102,上面有效果視頻

      第一種方法

      通過settings.json配置“subwindows”字段去顯示

      image
      image

      settings.json

      {
          "SettingsVersion": 1.2,
          "SeeDocsAt": "https://github.com/Microsoft/AirSim/blob/master/docs/settings.md",
          "SimMode": "Multirotor",
          "ViewMode": "FlyWithMe",
          "SubWindows": [
              {
                  "WindowID": 0,
                  "CameraName": "front_center_custom",
                  "ImageType": 0,
                  "Visible": true,
                  "ImageSize": [480, 270],
                  "CameraPosition": [0.0, 0.0, -2.5],
                  "CameraRotation": [0.0, 0.0, 0.0]
              },
              {
                  "WindowID": 1,
                  "CameraName": "front_center_custom",
                  "ImageType": 3,
                  "Visible": true,
                  "ImageSize": [480, 270],
                  "CameraPosition": [0.0, 0.0, -2.5],
                  "CameraRotation": [0.0, 0.0, 0.0]
              },
              {
                  "WindowID": 2,
                      "CameraName": "front_center_custom",
                      "ImageType": 5,
                      "Visible": true,
                      "ImageSize": [480, 270],
                      "CameraPosition": [0.0, 0.0, -2.5],
                      "CameraRotation": [0.0, 0.0, 0.0]
              }
          ],
          "Vehicles": {
              "Drone": {
                  "VehicleType": "SimpleFlight",
                  "DisplayName": "My First Drone",
                  "AutoCreate": true
              }
          }
      }
      

      第二種方法

      利用pygame繪制窗口并獲取無人機FPV實時圖像呈現

      image

      鍵盤控制及攝像機實時顯示.py

      import sys
      import time
      import airsim
      import pygame
      import cv2
      import numpy as np
      
      # >------>>>  pygame settings   <<<------< #
      pygame.init()
      
      screen = pygame.display.set_mode((800, 144))
      pygame.display.set_caption("screen")
      screen.fill((0, 0, 0))
      
      # >------>>>  AirSim settings   <<<------< #
      # 這里改為你要控制的無人機名稱(settings文件里面設置的)
      vehicle_name = "Drone"
      AirSim_client = airsim.MultirotorClient()
      AirSim_client.confirmConnection()
      AirSim_client.enableApiControl(True, vehicle_name=vehicle_name)
      AirSim_client.armDisarm(True, vehicle_name=vehicle_name)
      AirSim_client.takeoffAsync(vehicle_name=vehicle_name).join()
      image_types = {
          "scene": airsim.ImageType.Scene,
          "depth": airsim.ImageType.DepthVis,
          "seg": airsim.ImageType.Segmentation,
          "normals": airsim.ImageType.SurfaceNormals,
          "segmentation": airsim.ImageType.Segmentation,
          "disparity": airsim.ImageType.DisparityNormalized,
          "Infrared": airsim.ImageType.Infrared
      }
      
      # 基礎的控制速度(m/s)
      vehicle_velocity = 2.0
      # 設置臨時加速比例
      speedup_ratio = 10.0
      # 用來設置臨時加速
      speedup_flag = False
      
      # 基礎的偏航速率
      vehicle_yaw_rate = 5.0
      
      while True:
          yaw_rate = 0.0
          velocity_x = 0.0
          velocity_y = 0.0
          velocity_z = 0.0
      
          time.sleep(0.02)
      
          for event in pygame.event.get():
              if event.type == pygame.QUIT:
                  sys.exit()
      
          scan_wrapper = pygame.key.get_pressed()
      
          # 按下空格鍵加速10倍
          if scan_wrapper[pygame.K_SPACE]:
              scale_ratio = speedup_ratio
          else:
              scale_ratio = speedup_ratio / speedup_ratio
      
          # 根據 "A" 和 "D" 按鍵來設置偏航速率變量
          if scan_wrapper[pygame.K_a] or scan_wrapper[pygame.K_d]:
              yaw_rate = (scan_wrapper[pygame.K_d] - scan_wrapper[pygame.K_a]) * scale_ratio * vehicle_yaw_rate
      
          # 根據 "UP" 和 "DOWN" 按鍵來設置pitch軸速度變量(NED坐標系,x為機頭向前)
          if scan_wrapper[pygame.K_UP] or scan_wrapper[pygame.K_DOWN]:
              velocity_x = (scan_wrapper[pygame.K_UP] - scan_wrapper[pygame.K_DOWN]) * scale_ratio
      
          # 根據 "LEFT" 和 "RIGHT" 按鍵來設置roll軸速度變量(NED坐標系,y為正右方)
          if scan_wrapper[pygame.K_LEFT] or scan_wrapper[pygame.K_RIGHT]:
              velocity_y = -(scan_wrapper[pygame.K_LEFT] - scan_wrapper[pygame.K_RIGHT]) * scale_ratio
      
          # 根據 "W" 和 "S" 按鍵來設置z軸速度變量(NED坐標系,z軸向上為負)
          if scan_wrapper[pygame.K_w] or scan_wrapper[pygame.K_s]:
              velocity_z = -(scan_wrapper[pygame.K_w] - scan_wrapper[pygame.K_s]) * scale_ratio
      
          # print(f": Expectation gesture: {velocity_x}, {velocity_y}, {velocity_z}, {yaw_rate}")
      
          # 設置速度控制以及設置偏航控制
          AirSim_client.moveByVelocityBodyFrameAsync(vx=velocity_x, vy=velocity_y, vz=velocity_z, duration=1,
                                                     yaw_mode=airsim.YawMode(True, yaw_or_rate=yaw_rate),
                                                     vehicle_name=vehicle_name)
      
          temp_image1 = AirSim_client.simGetImage("0", image_types["scene"], vehicle_name=vehicle_name)
          image1 = cv2.imdecode(airsim.string_to_uint8_array(temp_image1), cv2.IMREAD_COLOR)
          cv2.imwrite("/home/yehuo/python_learning/AirSim_learning/screen4/visual1.png", image1)
          # 利用pygame庫加載保存的第一視角圖像,
          screen_image1 = pygame.image.load("/home/yehuo/python_learning/AirSim_learning/screen4/visual1.png")
          # 圖像坐標系,左上角為(0, 0),在此放置圖片
          screen.blit(screen_image1, (0, 0))
          pygame.display.flip()
          pygame.display.update()
      
          temp_image2 = AirSim_client.simGetImage("0", image_types["Infrared"], vehicle_name=vehicle_name)
          image2 = cv2.imdecode(airsim.string_to_uint8_array(temp_image2), cv2.IMREAD_COLOR)
          cv2.imwrite("/home/yehuo/python_learning/AirSim_learning/screen4/visual2.png", image2)
          # 利用pygame庫加載保存的第一視角圖像,
          screen_image2 = pygame.image.load("/home/yehuo/python_learning/AirSim_learning/screen4/visual2.png")
          # 圖像坐標系,左上角為(0, 0),在此放置圖片
          screen.blit(screen_image2, (272, 0))
          pygame.display.flip()
          pygame.display.update()
      
          temp_image3 = AirSim_client.simGetImage("0", image_types["segmentation"], vehicle_name=vehicle_name)
          image3 = cv2.imdecode(airsim.string_to_uint8_array(temp_image3), cv2.IMREAD_COLOR)
          cv2.imwrite("/home/yehuo/python_learning/AirSim_learning/screen4/visual3.png", image3)
          # 利用pygame庫加載保存的第一視角圖像,
          screen_image3 = pygame.image.load("/home/yehuo/python_learning/AirSim_learning/screen4/visual3.png")
          # 圖像坐標系,左上角為(0, 0),在此放置圖片
          screen.blit(screen_image3, (544, 0))
          pygame.display.flip()
          pygame.display.update()
      
          if scan_wrapper[pygame.K_ESCAPE]:
              pygame.quit()
              sys.exit()
      
      
      posted @ 2025-07-27 20:32  zylyehuo  閱讀(36)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 精品日韩亚洲av无码| 99久久国产露脸国语对白| 突泉县| 国产偷人妻精品一区二区在线 | 国产超碰无码最新上传| 高清偷拍一区二区三区| 国产亚洲精品AA片在线播放天| 久久一日本道色综合久久| 人妻系列中文字幕精品| 91色老久久精品偷偷性色| 无码av最新无码av专区| 国产精品一二三区蜜臀av| 国产精品久久久久久久久久久久| 日本激情久久精品人妻热| 麦盖提县| 国产日韩一区二区在线| 国产高清在线精品一本大道| 性无码专区无码| 精品一区二区三区免费视频| 亚洲欧美日本久久网站| 国产一区二区在线观看的| 久久一区二区中文字幕| 国内少妇偷人精品免费| 无码国产偷倩在线播放| 亚洲AV熟妇在线观看| 我要看亚洲黄色太黄一级黄| 国产乱码精品一区二三区| 国产美女久久精品香蕉| 亚洲人成人网站色www| 亚洲aⅴ无码专区在线观看q| 50岁熟妇的呻吟声对白| 国产精品视频一区不卡| 专干老肥熟女视频网站| 在线观看的网站| 国产人妻大战黑人20p| 国色天香成人一区二区| 彝良县| 国产一区二区三区精品综合| 亚洲久悠悠色悠在线播放| 强插少妇视频一区二区三区| 噜噜综合亚洲av中文无码|