AirSim supports Lidar for multirotors and cars.
The enablement of lidar and the other lidar settings can be configured via AirSimSettings json. Please see general sensors for information on configruation of general/shared sensor settings.
- By default, lidars are not enabled. To enable lidar, set the SensorType and Enabled attributes in settings json.
"Lidar1": {
"SensorType": 6,
"Enabled" : true,
- Multiple lidars can be enabled on a vehicle.
The following parameters can be configured right now via settings json.
Parameter | Description |
---|---|
NumberOfChannels | Number of channels/lasers of the lidar |
Range | Range, in meters |
PointsPerSecond | Number of points captured per second |
RotationsPerSecond | Rotations per second |
HorizontalFOVStart | Horizontal FOV start for the lidar, in degrees |
HorizontalFOVEnd | Horizontal FOV end for the lidar, in degrees |
VerticalFOVUpper | Vertical FOV upper limit for the lidar, in degrees |
VerticalFOVLower | Vertical FOV lower limit for the lidar, in degrees |
X Y Z | Position of the lidar relative to the vehicle (in NED, in meters) |
Roll Pitch Yaw | Orientation of the lidar relative to the vehicle (in degrees, yaw-pitch-roll order to front vector +X) |
DataFrame | Frame for the points in output ("VehicleInertialFrame" or "SensorLocalFrame") |
e.g.,
{
"SeeDocsAt": "https://github.com/Microsoft/AirSim/blob/master/docs/settings_json.md",
"SettingsVersion": 1.2,
"SimMode": "Multirotor",
"Vehicles": {
"Drone1": {
"VehicleType": "simpleflight",
"AutoCreate": true,
"Sensors": {
"LidarSensor1": {
"SensorType": 6,
"Enabled" : true,
"NumberOfChannels": 16,
"RotationsPerSecond": 10,
"PointsPerSecond": 100000,
"X": 0, "Y": 0, "Z": -1,
"Roll": 0, "Pitch": 0, "Yaw" : 0,
"VerticalFOVUpper": -15,
"VerticalFOVLower": -25,
"HorizontalFOVStart": -20,
"HorizontalFOVEnd": 20,
"DrawDebugPoints": true,
"DataFrame": "SensorLocalFrame"
},
"LidarSensor2": {
"SensorType": 6,
"Enabled" : true,
"NumberOfChannels": 4,
"RotationsPerSecond": 10,
"PointsPerSecond": 10000,
"X": 0, "Y": 0, "Z": -1,
"Roll": 0, "Pitch": 0, "Yaw" : 0,
"VerticalFOVUpper": -15,
"VerticalFOVLower": -25,
"DrawDebugPoints": true,
"DataFrame": "SensorLocalFrame"
}
}
}
}
}
Be default, the lidar points are not drawn on the viewport. To enable the drawing of hit laser points on the viewport, please enable setting 'DrawDebugPoints' via settings json. e.g.,
"Lidar1": {
...
"DrawDebugPoints": true
},
Use getLidarData()
API to retrieve the Lidar data.
- The API returns a Point-Cloud as a flat array of floats along with the timestamp of the capture and lidar pose.
- Point-Cloud:
- The floats represent [x,y,z] coordinate for each point hit within the range in the last scan.
- The frame for the points in the output is configurable using "DataFrame" attribute "" or "VehicleInertialFrame" -- default; returned points are in vehicle inertial frame (in NED, in meters) "SensorLocalFrame" -- returned points are in lidar local frame (in NED, in meters)
- Lidar Pose:
- Lidar pose in the vehicle inertial frame (in NED, in meters)
- Can be used to transform points to other frames.
- Visualization of lidar data on client side.