Skip to content

Commit

Permalink
Merge branch 'pr/set_kinematics_for_external_physics' of github.com:j…
Browse files Browse the repository at this point in the history
…onyMarino/AirSim into pr/set_kinematics_for_external_physics
  • Loading branch information
zimmy87 committed Oct 7, 2021
2 parents 1ecfe78 + 50efe1b commit ca80d21
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion AirLib/include/api/VehicleSimApiBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Unity/AirLibWrapper/AirsimWrapper/Source/PawnSimApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Unity/AirLibWrapper/AirsimWrapper/Source/PawnSimApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@ void MultirotorPawnSimApi::setPose(const Pose& pose, bool ignore_collision)
pending_pose_status_ = PendingPoseStatus::RenderStatePending;
}

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);
}

//*** Start: UpdatableState implementation ***//
void MultirotorPawnSimApi::resetImplementation()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 msr::airlib::Kinematics::State& state, bool ignore_collision) override;

msr::airlib::MultirotorApiBase* getVehicleApi() const
{
Expand Down
1 change: 1 addition & 0 deletions Unity/build.cmd
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 3 additions & 2 deletions Unreal/Plugins/AirSim/Source/PawnSimApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion Unreal/Plugins/AirSim/Source/PawnSimApi.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ca80d21

Please sign in to comment.