導語
AirSim中自帶相機嗎?怎麼採集資料進行識別呢?我要單獨新增別的感測器模組嗎?你是否也有相同的疑惑呢,本篇文章帶你瞭解AirSim中的感測器。IMU模組,相機模組還有鐳射雷達等感測器都在AirSim中有相關的配置。
一、AirSim 中的感測器
AirSim 目前支援以下感測器。每個感測器都與指定其感測器型別的整數列舉相關聯。
相機
氣壓計 = 1
IMU = 2
GPS = 3
磁力計 = 4
距離感測器 = 5
鐳射雷達 = 6
注意:相機的配置與其他感測器不同,並且沒有與之關聯的列舉。可以檢視相機配置和API相機影象去進行相關配置。相機配置:https://microsoft。github。io/AirSim/settings/
影象API:https://microsoft。github。io/AirSim/image_apis/
二、預設感測器
如果所需要的感測器在【settings。json】檔案中未指定,則可以在預設情況下改變以下三種sim模式,啟用相關感測器
Multirotor (多旋翼)
IMU
磁力計
GPS
氣壓計
Car(車輛)
GPS
ComputerVision(計算機視覺)
無感測器
除此之外,可以使用“createDefaultSensorSettings”方法在【AirSimSettings。cpp】檔案中設定在預設引數下各個感測器。
配置預設感測器列表可以在【settings。json】中配置預設感測器列表:“DefaultSensors”: { “Barometer”: { “SensorType”: 1, “Enabled” : true, “PressureFactorSigma”: 0。001825, “PressureFactorTau”: 3600, “UncorrelatedNoiseSigma”: 2。7, “UpdateLatency”: 0, “UpdateFrequency”: 50, “StartupDelay”: 0
},“Imu”: { “SensorType”: 2, “Enabled” : true, “AngularRandomWalk”: 0。3, “GyroBiasStabilityTau”: 500, “GyroBiasStability”: 4。6, “VelocityRandomWalk”: 0。24, “AccelBiasStabilityTau”: 800, “AccelBiasStability”: 36},“Gps”: { “SensorType”: 3, “Enabled” : true, “EphTimeConstant”: 0。9, “EpvTimeConstant”: 0。9, “EphInitial”: 25, “EpvInitial”: 25, “EphFinal”: 0。1, “EpvFinal”: 0。1, “EphMin3d”: 3, “EphMin2d”: 4, “UpdateLatency”: 0。2, “UpdateFrequency”: 50, “StartupDelay”: 1},“Magnetometer”: { “SensorType”: 4, “Enabled” : true, “NoiseSigma”: 0。005, “ScaleFactor”: 1, “NoiseBias”: 0, “UpdateLatency”: 0, “UpdateFrequency”: 50, “StartupDelay”: 0},“Distance”: { “SensorType”: 5, “Enabled” : true, “MinDistance”: 0。2, “MaxDistance”: 40, “X”: 0, “Y”: 0, “Z”: -1, “Yaw”: 0, “Pitch”: 0, “Roll”: 0, “DrawDebugPoints”: false},“Lidar2”: { “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”}
},
三、配置車輛專用感測器列表
車輛感測器可以覆蓋上面列出的所有預設感測器。但是在預設情況下,鐳射雷達和距離感測器不會新增到車輛中,需要透過別的方式進行新增。
每個感測器都必須有一個有效的“SensorType”,並且可以定義一個屬性子集來覆蓋上面顯示的預設值。在這裡,可以將Enabled設定為false以禁用特定型別的感測器,比如下面:
“Vehicles”: {
“Drone1”: { “VehicleType”: “SimpleFlight”, “AutoCreate”: true, 。。。 “Sensors”: { “Barometer”:{ “SensorType”: 1, “Enabled”: true, “PressureFactorSigma”: 0。0001825 }, “MyLidar1”: { “SensorType”: 6, “Enabled” : true, “NumberOfChannels”: 16, “PointsPerSecond”: 10000, “X”: 0, “Y”: 0, “Z”: -1, “DrawDebugPoints”: true }, “MyLidar2”: { “SensorType”: 6, “Enabled” : true, “NumberOfChannels”: 4, “PointsPerSecond”: 10000, “X”: 0, “Y”: 0, “Z”: -1, “DrawDebugPoints”: true } }}
}
注意:有關“鐳射雷達感測器”和“距離距離感測器”需要進行特定的設定。
四、除錯 - 伺服器端視覺化
在預設情況下,距離感測器命中的點不會繪製在視窗中,所以要使用下面的程式碼,在【settings。json】檔案中將“DrawDebugPoints”設定為enable,啟用在可視視窗介面繪製命中點。
“Distance”: { “SensorType”: 5, “Enabled” : true, 。。。 “DrawDebugPoints”: true}
五、感測器API
下面將介紹一些感測器API的使用。大家也可以參考上期所給程式碼[hello_drone。py]和[hello_drone。cpp]其中相關例子,或者也可以檢視下面API介紹。(1)晴雨表msr::airlib::BarometerBase::Output getBarometerData(const std::string& barometer_name, const std::string& vehicle_name);
barometer_data = client。getBarometerData(barometer_name = “”, vehicle_name = “”)
(2)IMU單元msr::airlib::ImuBase::Output getImuData(const std::string& imu_name = “”, const std::string& vehicle_name = “”);
imu_data = client。getImuData(imu_name = “”, vehicle_name = “”)
(3)GPSmsr::airlib::GpsBase::Output getGpsData(const std::string& gps_name = “”, const std::string& vehicle_name = “”);
gps_data = client。getGpsData(gps_name = “”, vehicle_name = “”)
(4)磁力計msr::airlib::MagnetometerBase::Output getMagnetometerData(const std::string& magnetometer_name = “”, const std::string& vehicle_name = “”);
magnetometer_data = client。getMagnetometerData(magnetometer_name = “”, vehicle_name = “”)
(5)距離感測器msr::airlib::DistanceSensorData getDistanceSensorData(const std::string& distance_sensor_name = “”, const std::string& vehicle_name = “”);
distance_sensor_data = client。getDistanceSensorData(distance_sensor_name = “”, vehicle_name = “”)
六、鐳射雷達感測器
AirSim支援多旋翼和汽車上配置鐳射雷達感測器。鐳射雷達的啟用和其他通用感測器設定一樣,具體內容可以看上文,這裡就不做過多描述了。
如何在車輛上啟用鐳射雷達
1。系統在預設情況下不啟用鐳射雷達。如若啟用鐳射雷達則在【settings。json】檔案中設定SensorType和Enabled的屬性。
“Lidar1”: { “SensorType”: 6, “Enabled” : true, }
2。可以在車輛上啟用多個鐳射雷達
3。鐳射雷達相關配置
可以在【setting。json】檔案中配置以下引數。
4。參考程式碼例子:
{ “SeeDocsAt”: “https://microsoft。github。io/AirSim/settings/”, “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” } } }}
}
七、除錯伺服器端視覺化
預設情況下,不在視口上會繪製鐳射雷達點。如要在視口上啟用命中鐳射點的繪製,可以透過【setting。json】啟用設定【DrawDebugPoints】。
“Lidar1”: { 。。。 “DrawDebugPoints”: true },
注意:啟動【DrawDebugPoints】可能導致使用過多記憶體而使v1。3。1版本和v1。3。0版本奔潰。但是這些問題已經在master中修復並且在後續版本中也可以正常工作。
** 八、客戶端可用API介面**可以使用getLidarData() API檢索鐳射雷達資料。API返回一個Point-Cloud,作為一個帶有捕獲時間戳和鐳射雷達姿態的平面浮動陣列,
點雲:*
a)浮點數表示上次掃描範圍內每個點的[x,y,z]座標。
b)輸出中的點的幀可以使用“DataFrame”屬性進行配置:
1) “” 或VehicleInertialFrame—— 預設;返回點位於車輛慣性系中(以 NED 為單位,以米為單位)
2)SensorLocalFrame —— 返回點位於鐳射雷達區域性座標系中(以 NED 為單位,以米為單位)
Lidar Pose:a)車輛慣性系中的鐳射雷達姿態(以 NED 為單位,以米為單位)b)可用於將點轉換為其他幀。
Segmentation:對每個鐳射雷達點的碰撞物件進行分割。
一些有關Python的例項:
drone_lidar。py:https://github。com/microsoft/AirSim/blob/master/PythonClient/multirotor/drone_lidar。py
car_lidar。py:https://github。com/microsoft/AirSim/blob/master/PythonClient/car/car_lidar。py
Sensorframe_lidar_pointcloud。py:https://github。com/microsoft/AirSim/blob/master/PythonClient/multirotor/sensorframe_lidar_pointcloud。py
Vehicleframe_lidar_pointcloud。py:https://github。com/microsoft/AirSim/blob/master/PythonClient/multirotor/vehicleframe_lidar_pointcloud。py
官方資料:
1。本期PX4更新內容網址:https://microsoft。github。io/AirSim/sensors/
2。鐳射雷達配置:https://microsoft。github。io/AirSim/lidar/
3。距離感測器配置:https://microsoft。github。io/AirSim/distance_sensor/
4。紅外感測器配置:https://microsoft。github。io/AirSim/InfraredCamera/
End -
技術發展的日新月異,阿木實驗室將緊跟技術的腳步,不斷把機器人行業最新的技術和硬體推薦給大家。看到經過我們培訓的學員在技術上突飛猛進,是我們培訓最大的價值。如果你在機器人行業,就請關注我們的公眾號,我們將持續釋出機器人行業最有價值的資訊和技術。阿木實驗室致力於前沿IT科技的教育和智慧裝備,讓機器人研發更高效!