When using AirSim’s Multirotor mode or Car mode to record a stereo image pair, the two image sequences are usually unsynchronized. Which is mentioned in issue AirSim#2369. Unsynchronized stereo pairs can’t run efficiently in some SLAM systems, so making image sequences synchronized are essential.

@kminoda proposed a method to record synchronized pairs, I have tried this method and recorded some rosbags. And these bags runs well on VINS-Fusion. And following is detailed procedure:

  1. Use AirSim to record vehicle groundtruth pose and IMU data in Car\Multirotor mode.
  2. Switch to ComputerVision mode, add cameras you want to record to the config.
  3. Read recorded groundtruth poses, then iterate over poses. Use AirSim API to set vehicle’s pose, and use AirSim C++ API to get images and write images to any place you like. (I found that Python API is much more slower than C++ API)

For myself, I am used to work with AirSim’s ROS interface. And I record rosbag like this (Only an example, if you want to try this, please modify the code according to your requirements):

  1. Using some config like following:
    {
        "SimMode": "Car",
        "ClockType": "",
        "ClockSpeed": 1,
        "LocalHostIp": "127.0.0.1",
        "ApiServerPort": 41451
    }
    

and then use rosbag record -a command to record topics. Control simulated car with your keyboard.

  1. Switch to some config like this:

    {
        "SimMode": "ComputerVision",
        "ClockType": "",
        "ClockSpeed": 1,
        "LocalHostIp": "127.0.0.1",
        "ApiServerPort": 41451,
        "Vehicles": {
            "car": {
                "VehicleType": "Car",
                "DefaultVehicleState": "Armed",
                "AutoCreate": true,
                "EnableCollisionPassthrogh": false,
                "EnableCollisions": true,
                "AllowAPIAlways": true,
                "EnableTrace": false,
                "Cameras": {
                    "0": {
                       "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
                            },
                            "X": 0, "Y": 0, "Z": 0,
                            "Pitch": 0, "Roll": 0, "Yaw": 0
                        ],
                    }
                    // more cameras here...
                }
                // more sensors here...
            }
        }
    }
    
  2. start simulation again, and record images after setting pose to groundtruth pose. example code like this: