diff --git a/.clang-format-ignore b/.clang-format-ignore
new file mode 100644
index 0000000000..edeaea4029
--- /dev/null
+++ b/.clang-format-ignore
@@ -0,0 +1,2 @@
+# Skip json.hpp since it is copied directly from external repo
+AirLib/include/common/common_utils/json.hpp
\ No newline at end of file
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index 01260d75e9..537422de10 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -6,7 +6,7 @@ about: Create a report to help us improve
-
+
## Bug report
diff --git a/.github/stale.yml b/.github/stale.yml
index fb8f2ff744..4ea40f1d47 100644
--- a/.github/stale.yml
+++ b/.github/stale.yml
@@ -1,10 +1,14 @@
-limitPerRun: 30
+limitPerRun: 1
issues:
daysUntilStale: 365
daysUntilClose: 20
exemptProjects: true
exemptMilestones: true
+ # Issues with these labels will never be considered stale
+ exemptLabels:
+ - 'bug'
+ - 'feature request'
staleLabel: stale
markComment: >
@@ -13,4 +17,9 @@ issues:
closed if no further activity occurs within 20 days.
closeComment: >
This issue has been automatically closed because it is has not had activity
- from the community in the last year.
\ No newline at end of file
+ from the community in the last year.
+
+pulls:
+ daysUntilStale: 1000
+ daysUntilClose: 10
+ staleLabel: stale
diff --git a/.github/workflows/clang_format.yml b/.github/workflows/clang_format.yml
index 2ea896d240..c6b7e00211 100644
--- a/.github/workflows/clang_format.yml
+++ b/.github/workflows/clang_format.yml
@@ -5,9 +5,10 @@ jobs:
name: Formatting Check
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Run clang-format style check for C/C++ programs.
uses: jidicula/clang-format-action@v4.4.1
with:
clang-format-version: '11'
check-path: '.'
+ exclude-regex: 'AirLib\/include\/common\/common_utils\/json\.hpp'
diff --git a/.github/workflows/test_docs.yml b/.github/workflows/test_docs.yml
index 7e43a4d07a..587740bf57 100644
--- a/.github/workflows/test_docs.yml
+++ b/.github/workflows/test_docs.yml
@@ -8,10 +8,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Setup Python
- uses: actions/setup-python@v2
+ uses: actions/setup-python@v4
with:
python-version: '3.7'
architecture: 'x64'
@@ -37,10 +37,10 @@ jobs:
- name: Build AirSim Documentation
run: ./build_docs.sh
- # Only on commits to 'master' branch
+ # Only on commits to 'main' branch
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
- if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
+ if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build_docs
diff --git a/.github/workflows/test_macos.yml b/.github/workflows/test_macos.yml
index 147247b507..7259ebc9e8 100644
--- a/.github/workflows/test_macos.yml
+++ b/.github/workflows/test_macos.yml
@@ -12,7 +12,7 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Setup
run: ./setup.sh
diff --git a/.github/workflows/test_ubuntu.yml b/.github/workflows/test_ubuntu.yml
index 9a4348ca6b..446a9579f5 100644
--- a/.github/workflows/test_ubuntu.yml
+++ b/.github/workflows/test_ubuntu.yml
@@ -11,7 +11,7 @@ jobs:
os: [ubuntu-18.04, ubuntu-20.04]
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Setup
run: ./setup.sh
diff --git a/.github/workflows/test_windows.yml b/.github/workflows/test_windows.yml
index 473ae70941..80acfc2ca4 100644
--- a/.github/workflows/test_windows.yml
+++ b/.github/workflows/test_windows.yml
@@ -5,11 +5,11 @@ on: [push, pull_request, workflow_dispatch]
jobs:
build:
- runs-on: windows-2019
+ runs-on: windows-2022
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Enable Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1
diff --git a/.gitignore b/.gitignore
index 64d80d637e..1e3e9ff3d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -399,3 +399,6 @@ PythonClient/docs/_build
# Docker
/docker/Blocks/
+
+# clangd generated folder, for e.g. from VSCode clangd extension
+.cache/
diff --git a/AirLib/AirLib.vcxproj b/AirLib/AirLib.vcxproj
index bb1c4f4a95..0e6d1b948f 100644
--- a/AirLib/AirLib.vcxproj
+++ b/AirLib/AirLib.vcxproj
@@ -205,40 +205,40 @@
StaticLibrary
true
- v142
+ v143
Unicode
StaticLibrary
false
- v142
+ v143
true
Unicode
StaticLibrary
false
- v142
+ v143
true
Unicode
StaticLibrary
true
- v142
+ v143
Unicode
StaticLibrary
false
- v142
+ v143
true
Unicode
StaticLibrary
false
- v142
+ v143
true
Unicode
diff --git a/AirLib/include/api/RpcLibClientBase.hpp b/AirLib/include/api/RpcLibClientBase.hpp
index cc3914b6a1..fd90824524 100644
--- a/AirLib/include/api/RpcLibClientBase.hpp
+++ b/AirLib/include/api/RpcLibClientBase.hpp
@@ -77,9 +77,9 @@ namespace airlib
int simGetSegmentationObjectID(const std::string& mesh_name) const;
void simPrintLogMessage(const std::string& message, std::string message_param = "", unsigned char severity = 0);
- void simAddDetectionFilterMeshName(const std::string& camera_name, const std::string& mesh_name, const std::string& vehicle_name = "", bool external = false);
- void simSetDetectionFilterRadius(const std::string& camera_name, const float radius_cm, const std::string& vehicle_name = "", bool external = false);
- void simClearDetectionMeshNames(const std::string& camera_name, const std::string& vehicle_name = "", bool external = false);
+ void simAddDetectionFilterMeshName(const std::string& camera_name, ImageCaptureBase::ImageType type, const std::string& mesh_name, const std::string& vehicle_name = "", bool external = false);
+ void simSetDetectionFilterRadius(const std::string& camera_name, ImageCaptureBase::ImageType type, const float radius_cm, const std::string& vehicle_name = "", bool external = false);
+ void simClearDetectionMeshNames(const std::string& camera_name, ImageCaptureBase::ImageType type, const std::string& vehicle_name = "", bool external = false);
vector simGetDetections(const std::string& camera_name, ImageCaptureBase::ImageType image_type, const std::string& vehicle_name = "", bool external = false);
void simFlushPersistentMarkers();
@@ -152,8 +152,8 @@ namespace airlib
void simSetKinematics(const Kinematics::State& state, bool ignore_collision, const std::string& vehicle_name = "");
msr::airlib::Environment::State simGetGroundTruthEnvironment(const std::string& vehicle_name = "") const;
std::vector simSwapTextures(const std::string& tags, int tex_id = 0, int component_id = 0, int material_id = 0);
- bool simSetObjectMaterial(const std::string& object_name, const std::string& material_name);
- bool simSetObjectMaterialFromTexture(const std::string& object_name, const std::string& texture_path);
+ bool simSetObjectMaterial(const std::string& object_name, const std::string& material_name, const int component_id = 0);
+ bool simSetObjectMaterialFromTexture(const std::string& object_name, const std::string& texture_path, const int component_id = 0);
// Recording APIs
void startRecording();
diff --git a/AirLib/include/api/WorldSimApiBase.hpp b/AirLib/include/api/WorldSimApiBase.hpp
index e7fc7c3754..833e590d7d 100644
--- a/AirLib/include/api/WorldSimApiBase.hpp
+++ b/AirLib/include/api/WorldSimApiBase.hpp
@@ -74,8 +74,8 @@ namespace airlib
virtual bool setObjectScale(const std::string& object_name, const Vector3r& scale) = 0;
virtual std::unique_ptr> swapTextures(const std::string& tag, int tex_id = 0, int component_id = 0, int material_id = 0) = 0;
virtual bool setLightIntensity(const std::string& light_name, float intensity) = 0;
- virtual bool setObjectMaterial(const std::string& object_name, const std::string& material_name) = 0;
- virtual bool setObjectMaterialFromTexture(const std::string& object_name, const std::string& texture_path) = 0;
+ virtual bool setObjectMaterial(const std::string& object_name, const std::string& material_name, const int component_id = 0) = 0;
+ virtual bool setObjectMaterialFromTexture(const std::string& object_name, const std::string& texture_path, const int component_id = 0) = 0;
virtual vector getMeshPositionVertexBuffers() const = 0;
virtual bool createVoxelGrid(const Vector3r& position, const int& x_size, const int& y_size, const int& z_size, const float& res, const std::string& output_file) = 0;
diff --git a/AirLib/include/common/AirSimSettings.hpp b/AirLib/include/common/AirSimSettings.hpp
index 25108b4b7d..e5442ff223 100644
--- a/AirLib/include/common/AirSimSettings.hpp
+++ b/AirLib/include/common/AirSimSettings.hpp
@@ -193,6 +193,8 @@ namespace airlib
std::map pixel_format_override_settings;
};
+ using CaptureSettingsMap = std::map;
+ using NoiseSettingsMap = std::map;
struct CameraSetting
{
//nan means keep the default values set in components
@@ -200,8 +202,8 @@ namespace airlib
Rotation rotation = Rotation::nanRotation();
GimbalSetting gimbal;
- std::map capture_settings;
- std::map noise_settings;
+ CaptureSettingsMap capture_settings;
+ NoiseSettingsMap noise_settings;
UnrealEngineSetting ue_setting;
@@ -211,6 +213,7 @@ namespace airlib
initializeNoiseSettings(noise_settings);
}
};
+ using CameraSettingMap = std::map;
struct CameraDirectorSetting
{
@@ -271,7 +274,7 @@ namespace airlib
Vector3r position = VectorMath::nanVector(); //in global NED
Rotation rotation = Rotation::nanRotation();
- std::map cameras;
+ CameraSettingMap cameras;
std::map> sensors;
RCSettings rc;
@@ -411,7 +414,7 @@ namespace airlib
std::string speed_unit_label = "m\\s";
std::map> sensor_defaults;
Vector3r wind = Vector3r::Zero();
- std::map external_cameras;
+ CameraSettingMap external_cameras;
std::string settings_text_ = "";
@@ -446,8 +449,8 @@ namespace airlib
loadPawnPaths(settings_json, pawn_paths);
loadOtherSettings(settings_json);
loadDefaultSensorSettings(simmode_name, settings_json, sensor_defaults);
- loadVehicleSettings(simmode_name, settings_json, vehicles, sensor_defaults);
- loadExternalCameraSettings(settings_json, external_cameras);
+ loadVehicleSettings(simmode_name, settings_json, vehicles, sensor_defaults, camera_defaults);
+ loadExternalCameraSettings(settings_json, external_cameras, camera_defaults);
//this should be done last because it depends on vehicles (and/or their type) we have
loadRecordingSetting(settings_json);
@@ -468,7 +471,7 @@ namespace airlib
Settings& settings_json = Settings::singleton();
//write some settings_json in new file otherwise the string "null" is written if all settings_json are empty
- settings_json.setString("SeeDocsAt", "https://github.com/Microsoft/AirSim/blob/master/docs/settings.md");
+ settings_json.setString("SeeDocsAt", "https://github.com/Microsoft/AirSim/blob/main/docs/settings.md");
settings_json.setDouble("SettingsVersion", 1.2);
std::string settings_filename = Settings::getUserDirectoryFullPath("settings.json");
@@ -706,7 +709,7 @@ namespace airlib
}
}
- static void initializeCaptureSettings(std::map& capture_settings)
+ static void initializeCaptureSettings(CaptureSettingsMap& capture_settings)
{
capture_settings.clear();
for (int i = -1; i < Utils::toNumeric(ImageType::Count); ++i) {
@@ -715,9 +718,10 @@ namespace airlib
capture_settings.at(Utils::toNumeric(ImageType::Scene)).target_gamma = CaptureSetting::kSceneTargetGamma;
}
- static void loadCaptureSettings(const Settings& settings_json, std::map& capture_settings)
+ static void loadCaptureSettings(const Settings& settings_json, CaptureSettingsMap& capture_settings)
{
- initializeCaptureSettings(capture_settings);
+ // We don't call initializeCaptureSettings here since it's already called in CameraSettings constructor
+ // And to avoid overwriting any defaults already set from CameraDefaults
Settings json_parent;
if (settings_json.getChild("CaptureSettings", json_parent)) {
@@ -801,7 +805,8 @@ namespace airlib
static std::unique_ptr createVehicleSetting(const std::string& simmode_name, const Settings& settings_json,
const std::string vehicle_name,
- std::map>& sensor_defaults)
+ std::map>& sensor_defaults,
+ const CameraSetting& camera_defaults)
{
auto vehicle_type = Utils::toLower(settings_json.getString("VehicleType", ""));
@@ -843,7 +848,7 @@ namespace airlib
vehicle_setting->position = createVectorSetting(settings_json, vehicle_setting->position);
vehicle_setting->rotation = createRotationSetting(settings_json, vehicle_setting->rotation);
- loadCameraSettings(settings_json, vehicle_setting->cameras);
+ loadCameraSettings(settings_json, vehicle_setting->cameras, camera_defaults);
loadSensorSettings(settings_json, "Sensors", vehicle_setting->sensors, sensor_defaults);
return vehicle_setting;
@@ -887,7 +892,8 @@ namespace airlib
static void loadVehicleSettings(const std::string& simmode_name, const Settings& settings_json,
std::map>& vehicles,
- std::map>& sensor_defaults)
+ std::map>& sensor_defaults,
+ const CameraSetting& camera_defaults)
{
createDefaultVehicle(simmode_name, vehicles, sensor_defaults);
@@ -903,7 +909,7 @@ namespace airlib
for (const auto& key : keys) {
msr::airlib::Settings child;
vehicles_child.getChild(key, child);
- vehicles[key] = createVehicleSetting(simmode_name, child, key, sensor_defaults);
+ vehicles[key] = createVehicleSetting(simmode_name, child, key, sensor_defaults, camera_defaults);
}
}
}
@@ -978,7 +984,7 @@ namespace airlib
}
}
- static void initializeNoiseSettings(std::map& noise_settings)
+ static void initializeNoiseSettings(NoiseSettingsMap& noise_settings)
{
const int image_count = Utils::toNumeric(ImageType::Count);
noise_settings.clear();
@@ -986,9 +992,10 @@ namespace airlib
noise_settings[i] = NoiseSetting();
}
- static void loadNoiseSettings(const Settings& settings_json, std::map& noise_settings)
+ static void loadNoiseSettings(const Settings& settings_json, NoiseSettingsMap& noise_settings)
{
- initializeNoiseSettings(noise_settings);
+ // We don't call initializeNoiseSettings here since it's already called in CameraSettings constructor
+ // And to avoid overwriting any defaults already set from CameraDefaults
Settings json_parent;
if (settings_json.getChild("NoiseSettings", json_parent)) {
@@ -1003,7 +1010,7 @@ namespace airlib
}
}
- static void loadNoiseSetting(const msr::airlib::Settings& settings_json, NoiseSetting& noise_setting)
+ static void loadNoiseSetting(const Settings& settings_json, NoiseSetting& noise_setting)
{
noise_setting.Enabled = settings_json.getBool("Enabled", noise_setting.Enabled);
noise_setting.ImageType = settings_json.getInt("ImageType", noise_setting.ImageType);
@@ -1058,9 +1065,9 @@ namespace airlib
}
}
- static CameraSetting createCameraSetting(const Settings& settings_json)
+ static CameraSetting createCameraSetting(const Settings& settings_json, const CameraSetting& camera_defaults)
{
- CameraSetting setting;
+ CameraSetting setting = camera_defaults;
setting.position = createVectorSetting(settings_json, setting.position);
setting.rotation = createRotationSetting(settings_json, setting.rotation);
@@ -1076,7 +1083,8 @@ namespace airlib
return setting;
}
- static void loadCameraSettings(const Settings& settings_json, std::map& cameras)
+ static void loadCameraSettings(const Settings& settings_json, CameraSettingMap& cameras,
+ const CameraSetting& camera_defaults)
{
cameras.clear();
@@ -1088,7 +1096,7 @@ namespace airlib
for (const auto& key : keys) {
msr::airlib::Settings child;
json_parent.getChild(key, child);
- cameras[key] = createCameraSetting(child);
+ cameras[key] = createCameraSetting(child, camera_defaults);
}
}
}
@@ -1201,7 +1209,7 @@ namespace airlib
{
Settings child_json;
if (settings_json.getChild("CameraDefaults", child_json)) {
- camera_defaults = createCameraSetting(child_json);
+ camera_defaults = createCameraSetting(child_json, camera_defaults);
}
}
@@ -1377,7 +1385,7 @@ namespace airlib
createDefaultSensorSettings(simmode_name, sensors);
}
- static void loadExternalCameraSettings(const Settings& settings_json, std::map& external_cameras)
+ static void loadExternalCameraSettings(const Settings& settings_json, CameraSettingMap& external_cameras, const CameraSetting& camera_defaults)
{
external_cameras.clear();
@@ -1389,7 +1397,7 @@ namespace airlib
for (const auto& key : keys) {
Settings child;
json_parent.getChild(key, child);
- external_cameras[key] = createCameraSetting(child);
+ external_cameras[key] = createCameraSetting(child, camera_defaults);
}
}
}
diff --git a/AirLib/include/common/GeodeticConverter.hpp b/AirLib/include/common/GeodeticConverter.hpp
index cffd886625..cbeb223931 100644
--- a/AirLib/include/common/GeodeticConverter.hpp
+++ b/AirLib/include/common/GeodeticConverter.hpp
@@ -39,10 +39,8 @@ namespace airlib
geodetic2Ecef(home_latitude_, home_longitude_, home_altitude_, &home_ecef_x_, &home_ecef_y_, &home_ecef_z_);
// Compute ECEF to NED and NED to ECEF matrices
- double phiP = atan2(home_ecef_z_, sqrt(pow(home_ecef_x_, 2) + pow(home_ecef_y_, 2)));
-
- ecef_to_ned_matrix_ = nRe(phiP, home_longitude_rad_);
- ned_to_ecef_matrix_ = nRe(home_latitude_rad_, home_longitude_rad_).transpose();
+ ecef_to_ned_matrix_ = nRe(home_latitude_rad_, home_longitude_rad_);
+ ned_to_ecef_matrix_ = ecef_to_ned_matrix_.inverse();
}
void setHome(const GeoPoint& home_geopoint)
@@ -143,10 +141,6 @@ namespace airlib
double x, y, z;
ned2Ecef(north, east, down, &x, &y, &z);
ecef2Geodetic(x, y, z, latitude, longitude, altitude);
-
- //TODO: above returns wrong altitude if down was positive. This is because sqrt return value would be -ve
- //but normal sqrt only return +ve. For now we just override it.
- *altitude = home_altitude_ - down;
}
void ned2Geodetic(const Vector3r& ned_pos, GeoPoint& geopoint)
diff --git a/AirLib/include/common/common_utils/json.hpp b/AirLib/include/common/common_utils/json.hpp
index d48eafaef0..cb27e05811 100644
--- a/AirLib/include/common/common_utils/json.hpp
+++ b/AirLib/include/common/common_utils/json.hpp
@@ -1,11 +1,12 @@
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++
-| | |__ | | | | | | version 2.1.1
+| | |__ | | | | | | version 3.10.5
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License .
-Copyright (c) 2013-2017 Niels Lohmann .
+SPDX-License-Identifier: MIT
+Copyright (c) 2013-2022 Niels Lohmann .
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -26,96 +27,75 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
-#ifndef NLOHMANN_JSON_HPP
-#define NLOHMANN_JSON_HPP
-// clang-format off
-#include // all_of, copy, fill, find, for_each, none_of, remove, reverse, transform
-#include // array
-#include // assert
-#include // isdigit
-#include // and, not, or
-#include // isfinite, labs, ldexp, signbit
+/****************************************************************************\
+ * Note on documentation: The source files contain links to the online *
+ * documentation of the public API at https://json.nlohmann.me. This URL *
+ * contains the most recent documentation and should also be applicable to *
+ * previous versions; documentation for deprecated functions is not *
+ * removed, but marked deprecated. See "Generate documentation" section in *
+ * file doc/README.md. *
+\****************************************************************************/
+
+#ifndef INCLUDE_NLOHMANN_JSON_HPP_
+#define INCLUDE_NLOHMANN_JSON_HPP_
+
+#define NLOHMANN_JSON_VERSION_MAJOR 3
+#define NLOHMANN_JSON_VERSION_MINOR 10
+#define NLOHMANN_JSON_VERSION_PATCH 5
+
+#include // all_of, find, for_each
#include // nullptr_t, ptrdiff_t, size_t
-#include // int64_t, uint64_t
-#include // abort, strtod, strtof, strtold, strtoul, strtoll, strtoull
-#include // strlen
-#include // forward_list
-#include // function, hash, less
+#include // hash, less
#include // initializer_list
-#include // setw
-#include // istream, ostream
-#include // advance, begin, back_inserter, bidirectional_iterator_tag, distance, end, inserter, iterator, iterator_traits, next, random_access_iterator_tag, reverse_iterator
-#include // numeric_limits
-#include // locale
-#include