初遇AirSim(三)

这里介绍下shell控制和settings.json的一些其他配置。
AirSim官方GitHub:https://github.com/Microsoft/AirSim
配置AirSim可以看初遇AirSIm(一)


shell控制

  • 在vs中打开 AirSim 目录下的 Airsim.sln这里写图片描述
  • Solution Explorer 中打开 DroneShellmain.cpp
    初遇AirSim(三)_第1张图片
  • 工具栏配置中设置成 Debugx64 ,然后在确保Pixhawk链接到虚拟环境情况下,运行这个main.cpp。
    这里写图片描述 这里写图片描述
  • 这时会出现命令行界面,输入 arm 解锁,输入 takeoff 就可以看见飞行器正常起飞了,其他命令可以输入 ? 查看。
    初遇AirSim(三)_第2张图片 初遇AirSim(三)_第3张图片

配置settings.json 文件

settings.json文件位于 C:\Users\*\Documents\AirSim 目录下。
第一次设置AirSim时会生成空白的settings.json文件,可以用ASCII编辑它。
在不更改它的情况下是按照默认配置执行。

  • 若要设置汽车模型添加 "SimMode": "Car", 设置飞行器就添加 "SimMode": "Multirotor"
  • 添加PX4为默认配置 "DefaultVehicleConfig": "PX4";
  • 配置PX4端口,"SerialPort":"*", 知道端口时添加"SerialPort":"COM3,115200" ,可以参考初遇AirSim(二)。

e.g.

{
  "SettingsVersion": 1.0,
  "SimMode": "Multirotor",
  "DefaultVehicleConfig": "PX4",
  "PX4": {
    "FirmwareName": "PX4",
    "SerialPort":"*"
   }
}

附所有默认设定:

{
  "DefaultVehicleConfig": "",
  "SimMode": "",
  "ClockType": "",
  "ClockSpeed": "1",
  "LocalHostIp": "127.0.0.1",
  "RecordUIVisible": true,
  "LogMessagesVisible": true,
  "ViewMode": "",
  "UsageScenario": "",
  "RpcEnabled": true,
  "EngineSound": true,
  "PhysicsEngineName": "",
  "EnableCollisionPassthrogh": false,
  "Recording": {
    "RecordOnMove": false,
    "RecordInterval": 0.05,
    "Cameras": [
        { "CameraID": 0, "ImageType": 0, "PixelsAsFloat": false, "Compress": true }
    ]
  },
  "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,
      "Gimble": {
        "Stabilization": 0,
        "Pitch": NaN,
        "Roll": NaN,
        "Yaw": NaN
      }
    }
  ],
  "OriginGeopoint": {
    "Latitude": 47.641468,
    "Latitude": -122.140165,
    "Altitude": 122
  },
  "TimeOfDay": {
    "Enabled": false,
    "StartDateTime": "",
    "CelestialClockSpeed": 1,
    "StartDateTimeDst": false,
    "UpdateIntervalSecs": 60
  },
  "SubWindows": [
    {"WindowID": 0, "CameraID": 0, "ImageType": 3, "Visible": false},
    {"WindowID": 1, "CameraID": 0, "ImageType": 5, "Visible": false},
    {"WindowID": 2, "CameraID": 0, "ImageType": 0, "Visible": false}    
  ],
  "SimpleFlight": {
    "FirmwareName": "SimpleFlight",
    "DefaultVehicleState": "Armed",
    "RC": {
      "RemoteControlID": 0,
      "AllowAPIWhenDisconnected": false,
      "AllowAPIAlways": true
    },
    "ApiServerPort": 41451
  },
  "SegmentationSettings": {
    "InitMethod": "",
    "MeshNamingMethod": "",
    "OverrideExisting": false
  },
  "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
    }
  ],
  "AdditionalCameras": [
    { "X": 0.00, "Y": 0.5, "Z": 0.0, "Roll": 0.0, "Pitch": 0.0, "Yaw": 90.0 }
  ],
  "PawnPaths": {
    "DefaultCar": {"PawnBP":"/AirSim/VehicleAdv/SUV/SuvCarPawn"},
    "DefaultQuadrotor": {"PawnBP":"/AirSim/Blueprints/BP_FlyingPawn"}
  },
  "PX4": {
    "FirmwareName": "PX4",
    "LogViewerHostIp": "127.0.0.1",
    "LogViewerPort": 14388,
    "OffboardCompID": 1,
    "OffboardSysID": 134,
    "QgcHostIp": "127.0.0.1",
    "QgcPort": 14550,
    "SerialBaudRate": 115200,
    "SerialPort": "*",
    "SimCompID": 42,
    "SimSysID": 142,
    "SitlIp": "127.0.0.1",
    "SitlPort": 14556,
    "UdpIp": "127.0.0.1",
    "UdpPort": 14560,
    "UseSerial": true,
    "VehicleCompID": 1,
    "VehicleSysID": 135,
    "ApiServerPort": 41451
  }
}

如果有特别需要,详细可以看https://github.com/Microsoft/AirSim/blob/master/docs/settings.md
有其他问题寻求解决方法可以看https://github.com/Microsoft/AirSim/issues

你可能感兴趣的:(学习日志)