From 1c547bb36b1ff20bc4b3e0c6f82f66a5e9a9da8e Mon Sep 17 00:00:00 2001 From: Jonathan Date: Fri, 1 Oct 2021 15:07:49 -0300 Subject: [PATCH 1/9] simSetKinematics API added --- AirLib/src/api/RpcLibServerBase.cpp | 5 +++++ Unreal/Plugins/AirSim/Source/PawnSimApi.cpp | 5 +++++ Unreal/Plugins/AirSim/Source/PawnSimApi.h | 1 + .../Vehicles/Multirotor/MultirotorPawnSimApi.cpp | 10 ++++++++++ .../Source/Vehicles/Multirotor/MultirotorPawnSimApi.h | 1 + 5 files changed, 22 insertions(+) diff --git a/AirLib/src/api/RpcLibServerBase.cpp b/AirLib/src/api/RpcLibServerBase.cpp index b566001a8d..73115bb579 100644 --- a/AirLib/src/api/RpcLibServerBase.cpp +++ b/AirLib/src/api/RpcLibServerBase.cpp @@ -381,6 +381,11 @@ namespace airlib return RpcLibAdaptorsBase::KinematicsState(result); }); + pimpl_->server.bind("simSetKinematics", [&](RpcLibAdaptorsBase::KinematicsState state, bool ignore_collision, const std::string& vehicle_name) -> { + *getVehicleSimApi(vehicle_name)->setKinematics(state.to(),ignore_collision); + *getVehicleSimApi(vehicle_name)->setKinematics(state.to(),ignore_collision); + }); + pimpl_->server.bind("simGetGroundTruthEnvironment", [&](const std::string& vehicle_name) -> RpcLibAdaptorsBase::EnvironmentState { const Environment::State& result = (*getVehicleSimApi(vehicle_name)->getGroundTruthEnvironment()).getState(); return RpcLibAdaptorsBase::EnvironmentState(result); diff --git a/Unreal/Plugins/AirSim/Source/PawnSimApi.cpp b/Unreal/Plugins/AirSim/Source/PawnSimApi.cpp index f5c6a71adb..6cf81b6f59 100644 --- a/Unreal/Plugins/AirSim/Source/PawnSimApi.cpp +++ b/Unreal/Plugins/AirSim/Source/PawnSimApi.cpp @@ -528,6 +528,11 @@ const msr::airlib::Kinematics::State* PawnSimApi::getGroundTruthKinematics() con { return &kinematics_->getState(); } + +void PawnSimApi::setKinematics(msr::airlib::Kinematics::State& state ) const +{ + return kinematics_->setState(state); +} const msr::airlib::Environment* PawnSimApi::getGroundTruthEnvironment() const { return environment_.get(); diff --git a/Unreal/Plugins/AirSim/Source/PawnSimApi.h b/Unreal/Plugins/AirSim/Source/PawnSimApi.h index 00a51f7bc6..4aac56fba5 100644 --- a/Unreal/Plugins/AirSim/Source/PawnSimApi.h +++ b/Unreal/Plugins/AirSim/Source/PawnSimApi.h @@ -92,6 +92,7 @@ class PawnSimApi : public msr::airlib::VehicleSimApiBase virtual void updateRenderedState(float dt) override; virtual void updateRendering(float dt) override; virtual const msr::airlib::Kinematics::State* getGroundTruthKinematics() const override; + virtual void setKinematics(msr::airlib::Kinematics::State& state) const; virtual const msr::airlib::Environment* getGroundTruthEnvironment() const override; virtual std::string getRecordFileLine(bool is_header_line) const override; virtual void reportState(msr::airlib::StateReporter& reporter) override; diff --git a/Unreal/Plugins/AirSim/Source/Vehicles/Multirotor/MultirotorPawnSimApi.cpp b/Unreal/Plugins/AirSim/Source/Vehicles/Multirotor/MultirotorPawnSimApi.cpp index cf0d96fa0e..0f27009068 100644 --- a/Unreal/Plugins/AirSim/Source/Vehicles/Multirotor/MultirotorPawnSimApi.cpp +++ b/Unreal/Plugins/AirSim/Source/Vehicles/Multirotor/MultirotorPawnSimApi.cpp @@ -139,6 +139,16 @@ void MultirotorPawnSimApi::setPose(const Pose& pose, bool ignore_collision) pending_pose_status_ = PendingPoseStatus::RenderPending; } +void MultirotorPawnSimApi::setKinematics(const Kinematics::State& state, bool ignore_collision) +{ + multirotor_physics_body_->lock(); + multirotor_physics_body_->updateKinematics(state); + multirotor_physics_body_->setGrounded(false); + multirotor_physics_body_->unlock(); + pending_pose_collisions_ = ignore_collision; + pending_pose_status_ = PendingPoseStatus::RenderPending; +} + //*** Start: UpdatableState implementation ***// void MultirotorPawnSimApi::resetImplementation() { diff --git a/Unreal/Plugins/AirSim/Source/Vehicles/Multirotor/MultirotorPawnSimApi.h b/Unreal/Plugins/AirSim/Source/Vehicles/Multirotor/MultirotorPawnSimApi.h index 9b8c351466..c735028ede 100644 --- a/Unreal/Plugins/AirSim/Source/Vehicles/Multirotor/MultirotorPawnSimApi.h +++ b/Unreal/Plugins/AirSim/Source/Vehicles/Multirotor/MultirotorPawnSimApi.h @@ -43,6 +43,7 @@ class MultirotorPawnSimApi : public PawnSimApi virtual UpdatableObject* getPhysicsBody() override; virtual void setPose(const Pose& pose, bool ignore_collision) override; + virtual void setKinematics(const Kinematics::State& state, bool ignore_collision); virtual void pawnTick(float dt) override; msr::airlib::MultirotorApiBase* getVehicleApi() const From 96eac25be29897f9a858cff40e241ec9e863a065 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Fri, 1 Oct 2021 15:08:56 -0300 Subject: [PATCH 2/9] C++ api for simSetKinematics --- AirLib/include/api/RpcLibClientBase.hpp | 1 + AirLib/src/api/RpcLibClientBase.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/AirLib/include/api/RpcLibClientBase.hpp b/AirLib/include/api/RpcLibClientBase.hpp index 9262120796..8f4e760cc3 100644 --- a/AirLib/include/api/RpcLibClientBase.hpp +++ b/AirLib/include/api/RpcLibClientBase.hpp @@ -128,6 +128,7 @@ namespace airlib bool simCreateVoxelGrid(const Vector3r& position, const int& x_size, const int& y_size, const int& z_size, const float& res, const std::string& output_file); msr::airlib::Kinematics::State simGetGroundTruthKinematics(const std::string& vehicle_name = "") const; + 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); diff --git a/AirLib/src/api/RpcLibClientBase.cpp b/AirLib/src/api/RpcLibClientBase.cpp index 294ed98a6d..a69d2ea845 100644 --- a/AirLib/src/api/RpcLibClientBase.cpp +++ b/AirLib/src/api/RpcLibClientBase.cpp @@ -246,6 +246,11 @@ __pragma(warning(disable : 4239)) pimpl_->client.call("simSetVehiclePose", RpcLibAdaptorsBase::Pose(pose), ignore_collision, vehicle_name); } + void RpcLibClientBase::simSetKinematics(const Kinematics::State& state, bool ignore_collision, const std::string& vehicle_name) + { + pimpl_->client.call("simSetKinematics", RpcLibAdaptorsBase::KinematicsState(state), ignore_collision, vehicle_name); + } + void RpcLibClientBase::simSetTraceLine(const std::vector& color_rgba, float thickness, const std::string& vehicle_name) { pimpl_->client.call("simSetTraceLine", color_rgba, thickness, vehicle_name); From 1504d12726b29b35b7f4b04957a0b84de5d9acf1 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Fri, 1 Oct 2021 17:05:59 -0300 Subject: [PATCH 3/9] fixes and python client --- AirLib/include/api/VehicleSimApiBase.hpp | 1 + AirLib/src/api/RpcLibServerBase.cpp | 7 +++---- PythonClient/airsim/client.py | 13 +++++++++++++ Unreal/Plugins/AirSim/Source/PawnSimApi.cpp | 3 ++- Unreal/Plugins/AirSim/Source/PawnSimApi.h | 2 +- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/AirLib/include/api/VehicleSimApiBase.hpp b/AirLib/include/api/VehicleSimApiBase.hpp index ffa329ec6e..5245f14028 100644 --- a/AirLib/include/api/VehicleSimApiBase.hpp +++ b/AirLib/include/api/VehicleSimApiBase.hpp @@ -54,6 +54,7 @@ namespace airlib virtual Pose getPose() const = 0; virtual void setPose(const Pose& pose, bool ignore_collision) = 0; virtual const Kinematics::State* getGroundTruthKinematics() const = 0; + virtual void setKinematics(const Kinematics::State& state, bool ignore_collision) const = 0; virtual const msr::airlib::Environment* getGroundTruthEnvironment() const = 0; virtual CollisionInfo getCollisionInfo() const = 0; diff --git a/AirLib/src/api/RpcLibServerBase.cpp b/AirLib/src/api/RpcLibServerBase.cpp index 73115bb579..cc086cb9aa 100644 --- a/AirLib/src/api/RpcLibServerBase.cpp +++ b/AirLib/src/api/RpcLibServerBase.cpp @@ -376,14 +376,13 @@ namespace airlib getWorldSimApi()->simPlotTransformsWithNames(conv_poses, names, tf_scale, tf_thickness, text_scale, text_color_rgba, duration); }); - pimpl_->server.bind("simGetGroundTruthKinematics", [&](const std::string& vehicle_name) -> RpcLibAdaptorsBase::KinematicsState { + pimpl_->server.bind("simGetGroundTruthKinematics1", [&](const std::string& vehicle_name) -> RpcLibAdaptorsBase::KinematicsState { const Kinematics::State& result = *getVehicleSimApi(vehicle_name)->getGroundTruthKinematics(); return RpcLibAdaptorsBase::KinematicsState(result); }); - pimpl_->server.bind("simSetKinematics", [&](RpcLibAdaptorsBase::KinematicsState state, bool ignore_collision, const std::string& vehicle_name) -> { - *getVehicleSimApi(vehicle_name)->setKinematics(state.to(),ignore_collision); - *getVehicleSimApi(vehicle_name)->setKinematics(state.to(),ignore_collision); + pimpl_->server.bind("simSetKinematics", [&](const RpcLibAdaptorsBase::KinematicsState& state, bool ignore_collision, const std::string& vehicle_name) { + getVehicleSimApi(vehicle_name)->setKinematics(state.to(),ignore_collision); }); pimpl_->server.bind("simGetGroundTruthEnvironment", [&](const std::string& vehicle_name) -> RpcLibAdaptorsBase::EnvironmentState { diff --git a/PythonClient/airsim/client.py b/PythonClient/airsim/client.py index d62054add8..f66b579692 100644 --- a/PythonClient/airsim/client.py +++ b/PythonClient/airsim/client.py @@ -683,6 +683,19 @@ def simGetGroundTruthKinematics(self, vehicle_name = ''): return KinematicsState.from_msgpack(kinematics_state) simGetGroundTruthKinematics.__annotations__ = {'return': KinematicsState} + def simSetKinematics(self, state, ignore_collision, vehicle_name = ''): + """ + Set the kinematics state of the vehicle + + If you don't want to change position (or orientation) then just set components of position (or orientation) to floating point nan values + + Args: + state (KinematicsState): Desired Pose pf the vehicle + ignore_collision (bool): Whether to ignore any collision or not + vehicle_name (str, optional): Name of the vehicle to move + """ + self.client.call('simSetKinematics', state, ignore_collision, vehicle_name) + def simGetGroundTruthEnvironment(self, vehicle_name = ''): """ Get ground truth environment state diff --git a/Unreal/Plugins/AirSim/Source/PawnSimApi.cpp b/Unreal/Plugins/AirSim/Source/PawnSimApi.cpp index 6cf81b6f59..e84bf7c42f 100644 --- a/Unreal/Plugins/AirSim/Source/PawnSimApi.cpp +++ b/Unreal/Plugins/AirSim/Source/PawnSimApi.cpp @@ -529,9 +529,10 @@ const msr::airlib::Kinematics::State* PawnSimApi::getGroundTruthKinematics() con return &kinematics_->getState(); } -void PawnSimApi::setKinematics(msr::airlib::Kinematics::State& state ) const +void PawnSimApi::setKinematics(const Kinematics::State& state, bool ignore_collision) const { return kinematics_->setState(state); + (void)ignore_collision; } const msr::airlib::Environment* PawnSimApi::getGroundTruthEnvironment() const { diff --git a/Unreal/Plugins/AirSim/Source/PawnSimApi.h b/Unreal/Plugins/AirSim/Source/PawnSimApi.h index 4aac56fba5..7e4750ca72 100644 --- a/Unreal/Plugins/AirSim/Source/PawnSimApi.h +++ b/Unreal/Plugins/AirSim/Source/PawnSimApi.h @@ -92,7 +92,7 @@ class PawnSimApi : public msr::airlib::VehicleSimApiBase virtual void updateRenderedState(float dt) override; virtual void updateRendering(float dt) override; virtual const msr::airlib::Kinematics::State* getGroundTruthKinematics() const override; - virtual void setKinematics(msr::airlib::Kinematics::State& state) const; + virtual void setKinematics(const msr::airlib::Kinematics::State& state, bool ignore_collision) const; virtual const msr::airlib::Environment* getGroundTruthEnvironment() const override; virtual std::string getRecordFileLine(bool is_header_line) const override; virtual void reportState(msr::airlib::StateReporter& reporter) override; From 22da5cad73f283ec344c101981b35d755c6d7bc7 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Mon, 4 Oct 2021 13:43:27 -0300 Subject: [PATCH 4/9] clang format fix --- AirLib/src/api/RpcLibServerBase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AirLib/src/api/RpcLibServerBase.cpp b/AirLib/src/api/RpcLibServerBase.cpp index cc086cb9aa..a9f800df41 100644 --- a/AirLib/src/api/RpcLibServerBase.cpp +++ b/AirLib/src/api/RpcLibServerBase.cpp @@ -376,13 +376,13 @@ namespace airlib getWorldSimApi()->simPlotTransformsWithNames(conv_poses, names, tf_scale, tf_thickness, text_scale, text_color_rgba, duration); }); - pimpl_->server.bind("simGetGroundTruthKinematics1", [&](const std::string& vehicle_name) -> RpcLibAdaptorsBase::KinematicsState { + pimpl_->server.bind("simGetGroundTruthKinematics", [&](const std::string& vehicle_name) -> RpcLibAdaptorsBase::KinematicsState { const Kinematics::State& result = *getVehicleSimApi(vehicle_name)->getGroundTruthKinematics(); return RpcLibAdaptorsBase::KinematicsState(result); }); pimpl_->server.bind("simSetKinematics", [&](const RpcLibAdaptorsBase::KinematicsState& state, bool ignore_collision, const std::string& vehicle_name) { - getVehicleSimApi(vehicle_name)->setKinematics(state.to(),ignore_collision); + getVehicleSimApi(vehicle_name)->setKinematics(state.to(), ignore_collision); }); pimpl_->server.bind("simGetGroundTruthEnvironment", [&](const std::string& vehicle_name) -> RpcLibAdaptorsBase::EnvironmentState { From 82688a4e6e63a2dc4661f3ce419756f6a92fb20c Mon Sep 17 00:00:00 2001 From: zimmy87 Date: Wed, 6 Oct 2021 02:15:14 -0700 Subject: [PATCH 5/9] fix Unity build --- Unity/AirLibWrapper/AirsimWrapper/Source/PawnSimApi.cpp | 6 ++++++ Unity/AirLibWrapper/AirsimWrapper/Source/PawnSimApi.h | 1 + 2 files changed, 7 insertions(+) diff --git a/Unity/AirLibWrapper/AirsimWrapper/Source/PawnSimApi.cpp b/Unity/AirLibWrapper/AirsimWrapper/Source/PawnSimApi.cpp index b51084e70d..707f9009f7 100644 --- a/Unity/AirLibWrapper/AirsimWrapper/Source/PawnSimApi.cpp +++ b/Unity/AirLibWrapper/AirsimWrapper/Source/PawnSimApi.cpp @@ -226,6 +226,12 @@ const msr::airlib::Kinematics::State* PawnSimApi::getGroundTruthKinematics() con return &kinematics_->getState(); } +void PawnSimApi::setKinematics(const Kinematics::State& state, bool ignore_collision) const +{ + unused(ignore_collision); + return kinematics_->setState(state); +} + const msr::airlib::Environment* PawnSimApi::getGroundTruthEnvironment() const { return environment_.get(); diff --git a/Unity/AirLibWrapper/AirsimWrapper/Source/PawnSimApi.h b/Unity/AirLibWrapper/AirsimWrapper/Source/PawnSimApi.h index 83cb525bf8..20cfa92927 100644 --- a/Unity/AirLibWrapper/AirsimWrapper/Source/PawnSimApi.h +++ b/Unity/AirLibWrapper/AirsimWrapper/Source/PawnSimApi.h @@ -85,6 +85,7 @@ class PawnSimApi : public msr::airlib::VehicleSimApiBase virtual void updateRenderedState(float dt) override; virtual void updateRendering(float dt) override; virtual const msr::airlib::Kinematics::State* getGroundTruthKinematics() const override; + virtual void setKinematics(const Kinematics::State& state, bool ignore_collision) const override; virtual const msr::airlib::Environment* getGroundTruthEnvironment() const override; virtual std::string getRecordFileLine(bool is_header_line) const override; virtual void reportState(msr::airlib::StateReporter& reporter) override; From 7a6a6495ecf09e3a5f7eb0ac932aca986db31896 Mon Sep 17 00:00:00 2001 From: zimmy87 Date: Wed, 6 Oct 2021 12:02:21 -0700 Subject: [PATCH 6/9] remove const specifier from setKinematics API --- AirLib/include/api/VehicleSimApiBase.hpp | 2 +- Unity/AirLibWrapper/AirsimWrapper/Source/PawnSimApi.cpp | 2 +- Unity/AirLibWrapper/AirsimWrapper/Source/PawnSimApi.h | 2 +- .../Source/Vehicles/Multirotor/MultirotorPawnSimApi.cpp | 8 ++++++++ .../Source/Vehicles/Multirotor/MultirotorPawnSimApi.h | 1 + Unity/build.cmd | 1 + Unreal/Plugins/AirSim/Source/PawnSimApi.cpp | 5 +++-- Unreal/Plugins/AirSim/Source/PawnSimApi.h | 2 +- .../Source/Vehicles/Multirotor/MultirotorPawnSimApi.h | 2 +- 9 files changed, 18 insertions(+), 7 deletions(-) diff --git a/AirLib/include/api/VehicleSimApiBase.hpp b/AirLib/include/api/VehicleSimApiBase.hpp index 5245f14028..a2a55f6fe7 100644 --- a/AirLib/include/api/VehicleSimApiBase.hpp +++ b/AirLib/include/api/VehicleSimApiBase.hpp @@ -54,7 +54,7 @@ namespace airlib virtual Pose getPose() const = 0; virtual void setPose(const Pose& pose, bool ignore_collision) = 0; virtual const Kinematics::State* getGroundTruthKinematics() const = 0; - virtual void setKinematics(const Kinematics::State& state, bool ignore_collision) const = 0; + virtual void setKinematics(const Kinematics::State& state, bool ignore_collision) = 0; virtual const msr::airlib::Environment* getGroundTruthEnvironment() const = 0; virtual CollisionInfo getCollisionInfo() const = 0; diff --git a/Unity/AirLibWrapper/AirsimWrapper/Source/PawnSimApi.cpp b/Unity/AirLibWrapper/AirsimWrapper/Source/PawnSimApi.cpp index 707f9009f7..bd1c05e527 100644 --- a/Unity/AirLibWrapper/AirsimWrapper/Source/PawnSimApi.cpp +++ b/Unity/AirLibWrapper/AirsimWrapper/Source/PawnSimApi.cpp @@ -226,7 +226,7 @@ const msr::airlib::Kinematics::State* PawnSimApi::getGroundTruthKinematics() con return &kinematics_->getState(); } -void PawnSimApi::setKinematics(const Kinematics::State& state, bool ignore_collision) const +void PawnSimApi::setKinematics(const Kinematics::State& state, bool ignore_collision) { unused(ignore_collision); return kinematics_->setState(state); diff --git a/Unity/AirLibWrapper/AirsimWrapper/Source/PawnSimApi.h b/Unity/AirLibWrapper/AirsimWrapper/Source/PawnSimApi.h index 20cfa92927..7c82da980f 100644 --- a/Unity/AirLibWrapper/AirsimWrapper/Source/PawnSimApi.h +++ b/Unity/AirLibWrapper/AirsimWrapper/Source/PawnSimApi.h @@ -85,7 +85,7 @@ class PawnSimApi : public msr::airlib::VehicleSimApiBase virtual void updateRenderedState(float dt) override; virtual void updateRendering(float dt) override; virtual const msr::airlib::Kinematics::State* getGroundTruthKinematics() const override; - virtual void setKinematics(const Kinematics::State& state, bool ignore_collision) const override; + virtual void setKinematics(const Kinematics::State& state, bool ignore_collision) override; virtual const msr::airlib::Environment* getGroundTruthEnvironment() const override; virtual std::string getRecordFileLine(bool is_header_line) const override; virtual void reportState(msr::airlib::StateReporter& reporter) override; diff --git a/Unity/AirLibWrapper/AirsimWrapper/Source/Vehicles/Multirotor/MultirotorPawnSimApi.cpp b/Unity/AirLibWrapper/AirsimWrapper/Source/Vehicles/Multirotor/MultirotorPawnSimApi.cpp index 517fccc2eb..6eb559a3d2 100644 --- a/Unity/AirLibWrapper/AirsimWrapper/Source/Vehicles/Multirotor/MultirotorPawnSimApi.cpp +++ b/Unity/AirLibWrapper/AirsimWrapper/Source/Vehicles/Multirotor/MultirotorPawnSimApi.cpp @@ -125,6 +125,14 @@ void MultirotorPawnSimApi::setPose(const Pose& pose, bool ignore_collision) pending_pose_status_ = PendingPoseStatus::RenderStatePending; } +void MultirotorPawnSimApi::setKinematics(const Kinematics::State& state, bool ignore_collision) +{ + PawnSimApi::setKinematics(state, ignore_collision); + + msr::airlib::Pose pose(state.pose.position, state.pose.orientation); + setPose(pose, ignore_collision); +} + //*** Start: UpdatableState implementation ***// void MultirotorPawnSimApi::resetImplementation() { diff --git a/Unity/AirLibWrapper/AirsimWrapper/Source/Vehicles/Multirotor/MultirotorPawnSimApi.h b/Unity/AirLibWrapper/AirsimWrapper/Source/Vehicles/Multirotor/MultirotorPawnSimApi.h index 3e63e39e39..4f8aa47df9 100644 --- a/Unity/AirLibWrapper/AirsimWrapper/Source/Vehicles/Multirotor/MultirotorPawnSimApi.h +++ b/Unity/AirLibWrapper/AirsimWrapper/Source/Vehicles/Multirotor/MultirotorPawnSimApi.h @@ -30,6 +30,7 @@ class MultirotorPawnSimApi : public PawnSimApi virtual void reportState(StateReporter& reporter) override; virtual UpdatableObject* getPhysicsBody() override; virtual void setPose(const Pose& pose, bool ignore_collision) override; + virtual void setKinematics(const Kinematics::State& state, bool ignore_collision) override; msr::airlib::MultirotorApiBase* getVehicleApi() const { diff --git a/Unity/build.cmd b/Unity/build.cmd index e2a5b2d511..662e42076f 100644 --- a/Unity/build.cmd +++ b/Unity/build.cmd @@ -1,3 +1,4 @@ +@echo off REM //---------- copy binaries and include for MavLinkCom in deps ---------- msbuild AirLibWrapper\AirsimWrapper.sln /target:Clean /target:Build /property:Configuration=Release /property:Platform=x64 if ERRORLEVEL 1 goto :buildfailed diff --git a/Unreal/Plugins/AirSim/Source/PawnSimApi.cpp b/Unreal/Plugins/AirSim/Source/PawnSimApi.cpp index e84bf7c42f..a1d735ba07 100644 --- a/Unreal/Plugins/AirSim/Source/PawnSimApi.cpp +++ b/Unreal/Plugins/AirSim/Source/PawnSimApi.cpp @@ -529,10 +529,11 @@ const msr::airlib::Kinematics::State* PawnSimApi::getGroundTruthKinematics() con return &kinematics_->getState(); } -void PawnSimApi::setKinematics(const Kinematics::State& state, bool ignore_collision) const +void PawnSimApi::setKinematics(const Kinematics::State& state, bool ignore_collision) { + unused(ignore_collision); + return kinematics_->setState(state); - (void)ignore_collision; } const msr::airlib::Environment* PawnSimApi::getGroundTruthEnvironment() const { diff --git a/Unreal/Plugins/AirSim/Source/PawnSimApi.h b/Unreal/Plugins/AirSim/Source/PawnSimApi.h index 7e4750ca72..717e93a07d 100644 --- a/Unreal/Plugins/AirSim/Source/PawnSimApi.h +++ b/Unreal/Plugins/AirSim/Source/PawnSimApi.h @@ -92,7 +92,7 @@ class PawnSimApi : public msr::airlib::VehicleSimApiBase virtual void updateRenderedState(float dt) override; virtual void updateRendering(float dt) override; virtual const msr::airlib::Kinematics::State* getGroundTruthKinematics() const override; - virtual void setKinematics(const msr::airlib::Kinematics::State& state, bool ignore_collision) const; + virtual void setKinematics(const msr::airlib::Kinematics::State& state, bool ignore_collision) override; virtual const msr::airlib::Environment* getGroundTruthEnvironment() const override; virtual std::string getRecordFileLine(bool is_header_line) const override; virtual void reportState(msr::airlib::StateReporter& reporter) override; diff --git a/Unreal/Plugins/AirSim/Source/Vehicles/Multirotor/MultirotorPawnSimApi.h b/Unreal/Plugins/AirSim/Source/Vehicles/Multirotor/MultirotorPawnSimApi.h index c735028ede..f7db8a8fda 100644 --- a/Unreal/Plugins/AirSim/Source/Vehicles/Multirotor/MultirotorPawnSimApi.h +++ b/Unreal/Plugins/AirSim/Source/Vehicles/Multirotor/MultirotorPawnSimApi.h @@ -43,7 +43,7 @@ class MultirotorPawnSimApi : public PawnSimApi virtual UpdatableObject* getPhysicsBody() override; virtual void setPose(const Pose& pose, bool ignore_collision) override; - virtual void setKinematics(const Kinematics::State& state, bool ignore_collision); + virtual void setKinematics(const Kinematics::State& state, bool ignore_collision) override; virtual void pawnTick(float dt) override; msr::airlib::MultirotorApiBase* getVehicleApi() const From 79fa8eefdf960609f08144da658fe9eba9630802 Mon Sep 17 00:00:00 2001 From: jonyMarino Date: Wed, 6 Oct 2021 19:31:41 -0300 Subject: [PATCH 7/9] Fix Unity build on Ubuntu --- .../Source/Vehicles/Multirotor/MultirotorPawnSimApi.cpp | 2 +- .../Source/Vehicles/Multirotor/MultirotorPawnSimApi.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Unity/AirLibWrapper/AirsimWrapper/Source/Vehicles/Multirotor/MultirotorPawnSimApi.cpp b/Unity/AirLibWrapper/AirsimWrapper/Source/Vehicles/Multirotor/MultirotorPawnSimApi.cpp index 6eb559a3d2..105eb984d1 100644 --- a/Unity/AirLibWrapper/AirsimWrapper/Source/Vehicles/Multirotor/MultirotorPawnSimApi.cpp +++ b/Unity/AirLibWrapper/AirsimWrapper/Source/Vehicles/Multirotor/MultirotorPawnSimApi.cpp @@ -125,7 +125,7 @@ void MultirotorPawnSimApi::setPose(const Pose& pose, bool ignore_collision) pending_pose_status_ = PendingPoseStatus::RenderStatePending; } -void MultirotorPawnSimApi::setKinematics(const Kinematics::State& state, bool ignore_collision) +void MultirotorPawnSimApi::setKinematics(const msr::airlib::Kinematics::State& state, bool ignore_collision) { PawnSimApi::setKinematics(state, ignore_collision); diff --git a/Unity/AirLibWrapper/AirsimWrapper/Source/Vehicles/Multirotor/MultirotorPawnSimApi.h b/Unity/AirLibWrapper/AirsimWrapper/Source/Vehicles/Multirotor/MultirotorPawnSimApi.h index 4f8aa47df9..72bacda6db 100644 --- a/Unity/AirLibWrapper/AirsimWrapper/Source/Vehicles/Multirotor/MultirotorPawnSimApi.h +++ b/Unity/AirLibWrapper/AirsimWrapper/Source/Vehicles/Multirotor/MultirotorPawnSimApi.h @@ -30,7 +30,7 @@ class MultirotorPawnSimApi : public PawnSimApi virtual void reportState(StateReporter& reporter) override; virtual UpdatableObject* getPhysicsBody() override; virtual void setPose(const Pose& pose, bool ignore_collision) override; - virtual void setKinematics(const Kinematics::State& state, bool ignore_collision) override; + virtual void setKinematics(const msr::airlib::Kinematics::State& state, bool ignore_collision) override; msr::airlib::MultirotorApiBase* getVehicleApi() const { From 50efe1b89513bbb1f76880a8eab2c5cdfe1c3026 Mon Sep 17 00:00:00 2001 From: jonyMarino Date: Wed, 6 Oct 2021 21:35:39 -0300 Subject: [PATCH 8/9] fix clang format --- .../Source/Vehicles/Multirotor/MultirotorPawnSimApi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Unity/AirLibWrapper/AirsimWrapper/Source/Vehicles/Multirotor/MultirotorPawnSimApi.cpp b/Unity/AirLibWrapper/AirsimWrapper/Source/Vehicles/Multirotor/MultirotorPawnSimApi.cpp index 105eb984d1..ecc5cafb0d 100644 --- a/Unity/AirLibWrapper/AirsimWrapper/Source/Vehicles/Multirotor/MultirotorPawnSimApi.cpp +++ b/Unity/AirLibWrapper/AirsimWrapper/Source/Vehicles/Multirotor/MultirotorPawnSimApi.cpp @@ -128,7 +128,7 @@ void MultirotorPawnSimApi::setPose(const Pose& pose, bool ignore_collision) void MultirotorPawnSimApi::setKinematics(const msr::airlib::Kinematics::State& state, bool ignore_collision) { PawnSimApi::setKinematics(state, ignore_collision); - + msr::airlib::Pose pose(state.pose.position, state.pose.orientation); setPose(pose, ignore_collision); } From 1ecfe78ce4f1c089fa89e62163e8ed0dbbaa7f2a Mon Sep 17 00:00:00 2001 From: zimmy87 Date: Thu, 7 Oct 2021 09:58:04 -0700 Subject: [PATCH 9/9] fix Ubuntu build break --- Unreal/Plugins/AirSim/Source/PawnSimApi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Unreal/Plugins/AirSim/Source/PawnSimApi.h b/Unreal/Plugins/AirSim/Source/PawnSimApi.h index 7e4750ca72..6d140595c6 100644 --- a/Unreal/Plugins/AirSim/Source/PawnSimApi.h +++ b/Unreal/Plugins/AirSim/Source/PawnSimApi.h @@ -37,6 +37,7 @@ class PawnSimApi : public msr::airlib::VehicleSimApiBase typedef msr::airlib::AirSimSettings::VehicleSetting VehicleSetting; typedef msr::airlib::ImageCaptureBase ImageCaptureBase; typedef msr::airlib::DetectionInfo DetectionInfo; + typedef msr::airlib::Kinematics Kinematics; struct Params { @@ -150,7 +151,6 @@ class PawnSimApi : public msr::airlib::VehicleSimApiBase private: //vars typedef msr::airlib::AirSimSettings AirSimSettings; - typedef msr::airlib::Kinematics Kinematics; typedef msr::airlib::Environment Environment; Params params_;