AirSim icon indicating copy to clipboard operation
AirSim copied to clipboard

BaroMeter glitch and GPS reset in HITL

Open yashkaushal opened this issue 8 years ago • 5 comments

Hi,

I monitor the movement of the multirotor using QGroundControl in the HITL mode using PX4 on PixHawk, and after every 10-15 seconds the GPS position is reset to home location(microsoft's office) and the readings from barometer stay in the range of -2 to 10m. PixHawk shows the GPS failure and Barometer glich LEDs on different modes.

Sometimes errors are displayed in AirSim in green text with no apparent pattern to check sensor calibration and navigation failure.

If i make the PX4 take off using QGC, it climbs indefinitely and according to barometer reading it never reaches the required altitude.

Using simpleflight the GPS and altitude readings are not updated at all (monitored using getmultirotor state API)

The drone however flies well in both SimpleFlight using APIs and HITL in manual and stabilised mode using RC.

I have used the source of 14-nov-2018 to build and tried using the prebuilt binaries too,

System specs - i7 4770, 8 GB RAM(around 2gb free while running airsim) and samsung 840 EVO SSD Airsim version 1.2, windows 10, python 2.7.15, unreal engine 4.20, PX4 firmware 1.8.1

yashkaushal avatar Nov 27 '18 05:11 yashkaushal

I found in documentation that SimpleFlight is not expected to have GPS and Barometer readings, so moving on with HITL I did the following.

I tested that with version 1.1 of AirSim and the bug was not there then after going through the source code of AirSim, I commented below two lines in PawnSimAPI::update() in PawnSimApi.cpp

environment_->update();
kinematics_->update();

and added below two lines at the end of updatePhysics(PhysicsBody& body) in FastPhysicsEngine.hpp

body.getEnvironment().setPosition(next.pose.position);
body.getEnvironment().update();

Recompiling after these changes and now the GPS and the Barometer reading are working fine in HITL(tested with multiple HITL as well) and in SITL(single instance).

Shall I create a pull request to add those changes in AirSim on GitHub?

yashkaushal avatar Dec 05 '18 07:12 yashkaushal

Thanks very much for that - very helpful indeed.

In the short term we have had to postpone plans to use AirSim because of this issue. With some luck we may be able to revisit the situation in the new year and will certainly try this fix.

mikeisted avatar Dec 07 '18 09:12 mikeisted

You're welcome Mike, glad this could help you.

yashkaushal avatar Dec 10 '18 08:12 yashkaushal

There were bugs in the multirotor simulator class causing confusion over duplication of state. But these problems should all be fixed now. I've tested that latest AirSim bits work fine with PX4 version 1.8.2.

lovettchris avatar Dec 18 '18 07:12 lovettchris

Thank you Chris, I look forward to trying again in the New Year! Mike

mikeisted avatar Dec 19 '18 08:12 mikeisted