zoukankan      html  css  js  c++  java
  • AirSim 自动驾驶仿真 (3) setting.json帮助文档解析

    https://blog.csdn.net/Zhaoxi_Li/article/details/107946885

    1 json存储位置

    Windows在DocumentsAirSim,Linux在 ~/Documents/AirSim

    第一次启动Airsim时候将自动创建一个空的setting文件,为了避免其他问题,永远使用ASCII保存文件

    2 如何在车辆Car和旋翼无人机Multirotor之间进行选择

    如果想使用Car则在json文件设置"SimMode": "Car" ,如下所示

    {
      "SettingsVersion": 1.2,
      "SimMode": "Car"
    }
    

     

    选择Multirotor则设置 "SimMode": "Multirotor". 如果设置"SimMode": "".则启动Airsim时候会自动弹出一个对话框询问使用哪个。

    3 可用的设置和对应默认值

    下面是所有可用的设置和其对应默认值,一些默认值为 "" 将会根据实际使用的车辆类型进行选择,比如 ViewMode 为 "" ,对于无人机则使用"FlyWithMe" ,对无人车则使用"SpringArmChase" 。

    注意: 没有必要将所有的设置复制过去,需要什么粘贴什么即可,仅有 "SettingsVersion"是需要设置的。

    {
      "SimMode": "",
      "ClockType": "",
      "ClockSpeed": 1,
      "LocalHostIp": "127.0.0.1",
      "RecordUIVisible": true,
      "LogMessagesVisible": true,
      "ViewMode": "",
      "RpcEnabled": true,
      "EngineSound": true,
      "PhysicsEngineName": "",
      "SpeedUnitFactor": 1.0,
      "SpeedUnitLabel": "m/s",
      "Recording": {
        "RecordOnMove": false,
        "RecordInterval": 0.05,
        "Cameras": [
            { "CameraName": "0", "ImageType": 0, "PixelsAsFloat": false, "Compress": true }
        ]
      },
      "CameraDefaults": {
        "CaptureSettings": [
          {
            "ImageType": 0,
            "Width": 256,
            "Height": 144,
            "FOV_Degrees": 90,
            "AutoExposureSpeed": 100,
            "AutoExposureBias": 0,
            "AutoExposureMaxBrightness": 0.64,
            "AutoExposureMinBrightness": 0.03,
            "MotionBlurAmount": 0,
            "TargetGamma": 1.0,
            "ProjectionMode": "",
            "OrthoWidth": 5.12
          }
        ],
        "NoiseSettings": [
          {
            "Enabled": false,
            "ImageType": 0,
    
            "RandContrib": 0.2,
            "RandSpeed": 100000.0,
            "RandSize": 500.0,
            "RandDensity": 2,
    
            "HorzWaveContrib":0.03,
            "HorzWaveStrength": 0.08,
            "HorzWaveVertSize": 1.0,
            "HorzWaveScreenSize": 1.0,
    
            "HorzNoiseLinesContrib": 1.0,
            "HorzNoiseLinesDensityY": 0.01,
            "HorzNoiseLinesDensityXY": 0.5,
    
            "HorzDistortionContrib": 1.0,
            "HorzDistortionStrength": 0.002
          }
        ],
        "Gimbal": {
          "Stabilization": 0,
          "Pitch": NaN, "Roll": NaN, "Yaw": NaN
        }
        "X": NaN, "Y": NaN, "Z": NaN,
        "Pitch": NaN, "Roll": NaN, "Yaw": NaN
      },
      "OriginGeopoint": {
        "Latitude": 47.641468,
        "Longitude": -122.140165,
        "Altitude": 122
      },
      "TimeOfDay": {
        "Enabled": false,
        "StartDateTime": "",
        "CelestialClockSpeed": 1,
        "StartDateTimeDst": false,
        "UpdateIntervalSecs": 60
      },
      "SubWindows": [
        {"WindowID": 0, "CameraName": "0", "ImageType": 3, "Visible": false},
        {"WindowID": 1, "CameraName": "0", "ImageType": 5, "Visible": false},
        {"WindowID": 2, "CameraName": "0", "ImageType": 0, "Visible": false}
      ],
      "SegmentationSettings": {
        "InitMethod": "",
        "MeshNamingMethod": "",
        "OverrideExisting": false
      },
      "PawnPaths": {
        "BareboneCar": {"PawnBP": "Class'/AirSim/VehicleAdv/Vehicle/VehicleAdvPawn.VehicleAdvPawn_C'"},
        "DefaultCar": {"PawnBP": "Class'/AirSim/VehicleAdv/SUV/SuvCarPawn.SuvCarPawn_C'"},
        "DefaultQuadrotor": {"PawnBP": "Class'/AirSim/Blueprints/BP_FlyingPawn.BP_FlyingPawn_C'"},
        "DefaultComputerVision": {"PawnBP": "Class'/AirSim/Blueprints/BP_ComputerVisionPawn.BP_ComputerVisionPawn_C'"}
      },
      "Vehicles": {
        "SimpleFlight": {
          "VehicleType": "SimpleFlight",
          "DefaultVehicleState": "Armed",
          "AutoCreate": true,
          "PawnPath": "",
          "EnableCollisionPassthrogh": false,
          "EnableCollisions": true,
          "AllowAPIAlways": true,
          "RC": {
            "RemoteControlID": 0,
            "AllowAPIWhenDisconnected": false
          },
          "Cameras": {
            //same elements as CameraDefaults above, key as name
          },
          "X": NaN, "Y": NaN, "Z": NaN,
          "Pitch": NaN, "Roll": NaN, "Yaw": NaN
        },
        "PhysXCar": {
          "VehicleType": "PhysXCar",
          "DefaultVehicleState": "",
          "AutoCreate": true,
          "PawnPath": "",
          "EnableCollisionPassthrogh": false,
          "EnableCollisions": true,
          "RC": {
            "RemoteControlID": -1
          },
          "Cameras": {
            "MyCamera1": {
              //same elements as elements inside CameraDefaults above
            },
            "MyCamera2": {
              //same elements as elements inside CameraDefaults above
            },
          },
          "X": NaN, "Y": NaN, "Z": NaN,
          "Pitch": NaN, "Roll": NaN, "Yaw": NaN
        }
      }
    }
    

      

    SimMode

    SimMode用来确定仿真模式,当前支持以下模式值:

    • "": 启动仿真时候自定义选择模式
    • "Multirotor": 使用旋翼仿真
    • "Car": 使用车辆仿真
    • "ComputerVision": 仅使用相机,无无人机和车辆

    ViewMode

    ViewMode确定将哪个摄影机用作默认摄影机以及摄影机将如何跟随车辆。对于无人机,默认是 "FlyWithMe",而无人车则默认是"SpringArmChase".

    • FlyWithMe: 以6个自由度从后面追赶车辆
    • GroundObserver: 从离地6’处追逐车辆,但在XY平面上保持完全自由。
    • Fpv: 从车辆前摄像头观看场景,就是车辆视角,可以理解为第一人称视角。
    • Manual: 不要自动移动相机。使用箭头键和ASWD键手动移动摄像机。
    • SpringArmChase: 用安装在隐形的手臂上的摄像头追踪车辆,该手臂通过弹簧连接到车辆上(因此它在运动中有一些延迟)。
    • NoDisplay: 就是不可视化仿真器,但是子窗口、录制和API的渲染仍处于活动状态。此模式对于在“无头”模式下保存资源非常有用,在这种模式下,您只对获取图像感兴趣,而不关心在主屏幕上呈现的内容。这也可以提高记录图像的FPS。

    OriginGeopoint

    这个用来记录经纬度和高度,起始原点也是利用这个计算出来的。所有坐标是北东地坐标系,在系统中,每个车辆从(0,0,0)点开始。时间设置也是通过这个算出来的OriginGeopoint(感觉解释很模糊,等以后测试使用后再补充细节吧)

    {
        "OriginGeopoint": {
        "Latitude": 47.641468,
        "Longitude": -122.140165,
        "Altitude": 122
      },
    }
    

      

    SubWindows

    这个设置用来确定当按下0的时候,哪个窗口是可见的。具体用法如下所示。

    "SubWindows": [
        {"WindowID": 0, "ImageType": 0, "CameraName": "3", "Visible": true},
        {"WindowID": 1, "ImageType": 3, "CameraName": "0", "Visible": true},
        {"WindowID": 2, "ImageType": 6, "CameraName": "4", "Visible": true}
      ]
    

      

    "WindowID"表示使用哪个窗口,值在0-2之间。
    "ImageType"表示图像类型,一共有8种类型,分别如下所示
    Scene = 0,
    DepthPlanner = 1,
    DepthPerspective = 2,
    DepthVis = 3,
    DisparityNormalized = 4,
    Segmentation = 5,
    SurfaceNormals = 6,
    Infrared = 7
    "CameraName"相机名称,一共有5个相机,front_center, front_right, front_left, fpv 和back_center,为了向后兼容,用0-4对应。
    

      

    Recording

    按照特定的时间间隔记录数据,比如位置、姿态、速度和对应图像。仿真器上面有按钮可以开始记录。数据存在DocumentsAirSim,对应配置代码如下所示。

    "Recording": {
        "RecordOnMove": false,
        "RecordInterval": 0.05,
        "Cameras": [
            { "CameraName": "0", "ImageType": 0, "PixelsAsFloat": false, "Compress": true }
        ]
      },
    

      

    • RecordInterval 指定采集两张图片的最小时间间隔,就是每隔多少秒采集一张图片。
    • RecordOnMove指定如果车辆不动是否还采集图像
    • Cameras设置相机的属性,默认是使用相机0,并压缩存储。相同属性跟SubWindows一样,如果PixelsAsFloat为true,图像将会存储为pfm格式。

    Camera Settings

    CameraDefaults 在第一级根目录,指定所有相机的默认值,这些默认值在每个Vehicles中的相机Cameras中重写。

    属性ImageType已经在前面介绍过了,除此之外可以设置ImageType: -1应用在外部相机(也就是显示屏成像的相机)。

    "CaptureSettings"设置的是不同种图像属性,比如scene, depth, disparity, surface normals和segmentation 等等。属性Width, Height, FOV就是图像分辨率内参相关。AutoExposureSpeed值较高可以消除图像采集中的伪影。MotionBlurAmount设置为0以避免真值中的伪影。ProjectionMode投影模式,不太能理解,用默认perspective就行(其他参数有的跟参数有关,主要是需要设置前4个,其他默认就好)。

    NoiseSettings允许想特定图像添加噪声,目的是模拟传感器噪声,干扰和伪影。默认是无噪声添加的Enabled: false。如果需要噪声,设置其余属性就行。

    • RandContrib噪声混合比,0表示无噪声,1表示只有噪声。
    • RandSpeed设置噪波波动的速度,1表示无波动,较高的值如1E6表示完全波动。
    • RandSize这决定了噪声的粗糙程度,1表示每个像素都有自己的噪声,而较高的值意味着超过1个像素共享相同的噪声值。
    • RandDensity这决定了有多少像素会有噪声,1表示所有像素,值越高表示像素数越少。
    • HorzWaveContrib添加水平凹凸/闪烁/重影效果,这决定了噪波像素与图像像素的混合比,0表示无噪波,1表示只有噪波。
    • HorzWaveStrength这决定了效果的整体强度。
    • HorzWaveVertSize这决定了有多少垂直像素会受到效果的影响。
    • HorzWaveScreenSize这决定了屏幕有多大程度上受效果的影响。
      其他都是各种方向噪声,感觉用途不多,暂时不分析了,专业人士看文档即可。

    Gimbal允许冻结相机三个轴的方向,这个设置对第三人称视角是无用的,也就是ImageType为-1,当 Stabilization 为0就表示相机随着本体模型的运动而运动,值为1时候,表示完全稳定。值取值范围为0-1,用来与车的角度进行混合,PitchRoll 和Yaw 任何一个值设为NaN,表示这个角度将随车运动。

    "CameraDefaults": {
        "CaptureSettings": [
          {
            "ImageType": 0,
            "Width": 256,
            "Height": 144,
            "FOV_Degrees": 90,
            "AutoExposureSpeed": 100,
            "AutoExposureBias": 0,
            "AutoExposureMaxBrightness": 0.64,
            "AutoExposureMinBrightness": 0.03,
            "MotionBlurAmount": 0,
            "TargetGamma": 1.0,
            "ProjectionMode": "",
            "OrthoWidth": 5.12
          }
        ],
        "NoiseSettings": [
          {
            "Enabled": false,
            "ImageType": 0,
    
            "RandContrib": 0.2,
            "RandSpeed": 100000.0,
            "RandSize": 500.0,
            "RandDensity": 2,
    
            "HorzWaveContrib":0.03,
            "HorzWaveStrength": 0.08,
            "HorzWaveVertSize": 1.0,
            "HorzWaveScreenSize": 1.0,
    
            "HorzNoiseLinesContrib": 1.0,
            "HorzNoiseLinesDensityY": 0.01,
            "HorzNoiseLinesDensityXY": 0.5,
    
            "HorzDistortionContrib": 1.0,
            "HorzDistortionStrength": 0.002
          }
        ],
        "Gimbal": {
          "Stabilization": 0,
          "Pitch": NaN, "Roll": NaN, "Yaw": NaN
        }
        "X": NaN, "Y": NaN, "Z": NaN,
        "Pitch": NaN, "Roll": NaN, "Yaw": NaN
      },
    

      

    Vehicles Settings

    仿真器将遍历"Vehicles"列表创建 "AutoCreate": true的车辆。
    Each simulation mode will go through the list of vehicles specified in this setting and create the ones that has "AutoCreate": true. 指定的每个车辆都有个key,这个key就是车的名字。如果这个设置中不存在这个属性,则使用默认叫“PhysXCar”的车和“SimpleFlight”的无人机来填充。

    "Vehicles": {
        "SimpleFlight": {
          "VehicleType": "SimpleFlight",
          "DefaultVehicleState": "Armed",
          "AutoCreate": true,
          "PawnPath": "",
          "EnableCollisionPassthrogh": false,
          "EnableCollisions": true,
          "AllowAPIAlways": true,
          "RC": {
            "RemoteControlID": 0,
            "AllowAPIWhenDisconnected": false
          },
          "Cameras": {
            //same elements as CameraDefaults above, key as name
          },
          "X": NaN, "Y": NaN, "Z": NaN,
          "Pitch": NaN, "Roll": NaN, "Yaw": NaN
        },
        "PhysXCar": {
          "VehicleType": "PhysXCar",
          "DefaultVehicleState": "",
          "AutoCreate": true,
          "PawnPath": "",
          "EnableCollisionPassthrogh": false,
          "EnableCollisions": true,
          "RC": {
            "RemoteControlID": -1
          },
          "Cameras": {
            "MyCamera1": {
              //same elements as elements inside CameraDefaults above
            },
            "MyCamera2": {
              //same elements as elements inside CameraDefaults above
            },
          },
          "X": NaN, "Y": NaN, "Z": NaN,
          "Pitch": NaN, "Roll": NaN, "Yaw": NaN
        }
      }
    

      

    下面对其中的一些属性进行说明。

    • VehicleType: 这个属性可以选择 PhysXCarSimpleFlightPX4Multirotor 或ComputerVision. 不存在默认值因此这个必须被指定。
    • PawnPath: This allows to override the pawn blueprint to use for the vehicle. For example, you may create new pawn blueprint derived from ACarPawn for a warehouse robot in your own project outside the AirSim code and then specify its path here. See also PawnPaths.
    • DefaultVehicleState: 用于无人机的可能值, Armed 或 Disarmed
    • AutoCreate: 如果为真,则生成此车辆。
    • RC: 指定车辆使用的遥控器
    • RemoteControlID. 控制器选择,值为-1时候使用键盘控制(不支持无人机),值≥0时候指定一个连接在电脑的控制器。
    • X, Y, Z, Yaw, Roll, Pitch: 车辆初始化时候的位置和方向。
    • IsFpvVehicle: 选择那辆车产生第一视角数据,默认是使用第一辆车作为FPV车辆,其实就是数据窗口总共就3个,必须指定一个来采集数据。
    • Cameras: 为每个车辆指定相机,属性和值的使用与 CameraDefaults是一样的。如果改变前置相机的FOV为120°,那么可以按照如下的代码对Vehicles进行修改.
    "Vehicles": {
        "FishEyeDrone": {
          "VehicleType": "SimpleFlight",
          "Cameras": {
            "front-center": {
              "CaptureSettings": [
                {
                  "ImageType": 0,
                  "FOV_Degrees": 120
                }
              ]
            }
          }
        }
    }
    

      

  • 相关阅读:
    web安全
    WCF通信架构
    WCF地址
    WCFContracts(契约)
    分布式中的王者WCF
    SOAP 介绍
    诊所管理软件
    MFC 画图CDC双缓冲
    Linux 启动、关闭、重启网络服务
    C# 除法的小数点问题
  • 原文地址:https://www.cnblogs.com/kekeoutlook/p/14247057.html
Copyright © 2011-2022 走看看