AirSim icon indicating copy to clipboard operation
AirSim copied to clipboard

Problem connecting to Pixhawk (SITL PX4 simulation)

Open Timebutt opened this issue 9 years ago • 9 comments

Hi,

I'm currently trying to get my setup running without having a Pixhawk connected, so I'm following the SITL instructions. So far, I've set up the entire Linux environment required, built the posix SITL PX4 version and started it on my machine. This is what it looks like, running on my machine:

bash

As per the instructions, I have edited the settings.json file (located in Documents/AirSim, where I cloned the AirSim project). My file is currently showing this (shown is the entire settings.json content):

settings

Comparing this to the settings.json used in this instructional video, I notice quite a difference here. Are these settings required for correct functionality of AirSim, and why would these be missing with me?

reference

In any case, I have set up an Unreal project as described in this video. Now, when I launch the Unreal in SimGameMode, my machine renders about one second of video and then Unreal completely freezes. In the top left corner, it's saying to check my json settings, and that it can't connect to my PX4 simulation for some reason. When I look at the output of my bash, no messages are appearing, so no connection is being set up.

unreal

So, two questions:

  1. Is there any way to get a more detailed output of exactly what's going wrong? Am I missing something here? Why can't my Unreal environment connect to the Pixhawk simulation?

  2. Why does my Unreal editor freeze after about 1s of rendering? I only get this when using the SimGameMode, the other modes are just fine and it can't be my machine (Intel i7 6900K, Nvidia GTX980 TI, 16Gb RAM, SSD, ...). Is this because no connection can be set up to the PX4?

All help is greatly appreciated!

Timebutt avatar Feb 28 '17 13:02 Timebutt

This is probably our bug, we did some big refactoring recently, I'll look into this right away, thanks for reporting it.

lovettchris avatar Mar 01 '17 01:03 lovettchris

Ok great news! Keep me posted when the issue gets fixed, I will verify straight after.

Timebutt avatar Mar 01 '17 08:03 Timebutt

@Timebutt I'm testing the fix and would push it soon.

sytelus avatar Mar 01 '17 12:03 sytelus

so can anyone make a video to show how to realize the SITL with gamepad ? I'm stuck at it too! Thank you very much

fmzhu avatar Mar 01 '17 12:03 fmzhu

The setup I'm trying to run is using SITL and a PS3 controller (may have to emulate an Xbox 360 controller, don't know yet). Once this issue is fixed and I get everything running, I will be contributing to the documentation on getting it up and running.

Timebutt avatar Mar 01 '17 12:03 Timebutt

@Timebutt @lovettchris I've pushed the change to put back missing settings in json file. So you should be now be able to modify LocalHostIp as in the video.

sytelus avatar Mar 02 '17 00:03 sytelus

Hi @sytelus, thanks for committing the fixes. Unfortunately, I can't verify the functionality yet because I'm still experiencing the crashing Unreal Editor environment. The good news however, is that I found out what's exactly going on. The environment isn't crashing, but rather rendering extremely slow. I started looking through the logs and found this:

capture

So apparently Unreal Editor finds three eligible GPUs, and decides somehow to always select the Intel HD530 GPU. This is why I can perfectly use the other game modes (but even there I get sub par frame rate, the HD530 isn't exactly a powerful GPU), but as soon as I start the SimGameMode the HD530 can't keep up and generates one frame per minute (or even less!).

I found this possible solution, written by an Unreal Engine developer but can't seem to get it right just yet.

I'm glad I found out why my environment is crashing, now to find the solution. As soon as I get everything working, I will write down extensively what I have found, hopefully to help other people. And then to verify the fixes for the SITL communication problem ;)

Timebutt avatar Mar 02 '17 10:03 Timebutt

You will also need this fix.

lovettchris avatar Mar 02 '17 11:03 lovettchris

Confirmed: the two fixes correct the SITL functionality! The drone correctly connects to the virtualized PX4 instance, as can be seen in the following screenshot:

capture

Thank you very much for the quick fixes @lovettchris and @sytelus! This will definitely help other people out as well. Issue can be closed.

Now to find out why the Unreal Editor considers my GTX 980 TI an expensive paperweight and prefers to run the application on the integrated GPU ...

Timebutt avatar Mar 02 '17 12:03 Timebutt