Communication error when starting sitl

I have managed to install cygwin, MAVProxy and to get airsim running on Unreal Engine, and have also been able to use MAVProxy to control a drone on Airsim. I wanted to use a different board configuration and change the physics a little bit, so I imported a new ardupilot folder and rebuilt the project. However, when I run the SITL command on cygwin ,it results in [WinError 10061] No connection could be made because the target machine actively refused it sleeping, as shown below. I also tried changing the udpip to 0.0.0.0, but it still displayed the same error. Could someone please help me with this issue?

Hi, i have the same Problem!
Do you found some solutions?

Its not exactly a permanent solution but I did figure something out. Disable firewall, and in your settings.json, if the default IP address doesn’t work for LocalHostIP and UdpIP, set them to 0.0.0.0.
In some cases it does manage to open the MAVProxy, Console and Map, but the software running airsim(such as UE4) gets frozen. In this instance you may have to wait for up to 5 minutes if it doesn’t start running. If that happens, make sure your Graphics memory or your RAM isn’t too close to being full.

Hi and thanks for your reply!
The solution for my problem was to start the situation and mavproxy separately from one other. Because the simulation takes more time to start as mavproxy. And mavproxy got time out in this time.

Oh alright. So do you mean to start the airsim simulation first and then start mavproxy?

Yes, at first start the simulator with the parameter - - no-mavproxy. When the simulator started ready, then you can start mavproxy in the separate terminal with the same parameters like it done if you were started mavproxy with simulator together.

Oh okay, I tried this out but I still get that error sometimes. After starting the simulation without mavproxy, did you start mavproxy using something like cygwin/WSL/some similar environment, or did you open MAVProxy directly from your system?

Anything new with this? I have the same problem and I am not sure how to make it work… I start:
simvehicle.py -v ArduCopter -f airsim-copter --map --console

but it hangs up with “No connection could be made”. I am also using TCP:127.0.0.1:5760. What is this ip and port for? I feel like it should be something else. I will only get this message if I do “airsim-copter” doing “quad” starts up everything fine…

Any help is appreciated!

The IP is to establish a connection between the MAVProxy and Airsim, they need t be connected to the same IP address. You can find the IP using LocalHostIP on command prompt, make sure that the IP Address defined in your .json settings file for airsim is the same as that which you’ve connected to. You can also try 0.0.0.0 if you’re unsure of what to use. It also appears that copter 3.6 has an issue relating to the “airsim-copter” frame in some instances. Try using the latest version of copter, if you aren’t doing that already.

Got it! thanks @clev0910. I can run
sim_vehicle.py --map --console
sim_vehicle.py -v ArduCopter --map --console

and they work well. The maps and console pops up and I can hook up Mission planner and direct the drone to takeoff and these things. However, as soon as I try to bring airsim into the loop I get the dreaded

[WinError 10061] No connection could be made because the target machine actively refused it sleeping

I have tried changing the settings.json for airsim to set the LocalHostIp and UdpIp to 127.0.0.1 and also tried 0.0.0.0. I am running the blocks airsim binary to simplify things. Now, apart from the connection error on mavproxy, depending on which IP address i use for the settings.json I get a different behavior on airsim. 127.0.0.1 results in airsim starting correctly and showing the drone in 3rd person view. It is not frozen, but there is no connection to SITL. I can open/close menu and change views. If I use 0.0.0.0 airsim freezes on startup and will never resume. In fact, task manager says that it is non-responsive. The SITL guide says this can happen, but will go away as soon as maxproxy connects, but in my case mavproxy is not connecting so it is stuck. I have tested this procedure on two different systems running slightly different builds of Win10, but pretty up-to-date with the exact same behavior.

I am also using:
Python 3.6.5
Arducopter 3.6.11
MavProxy 1.8.6

I will try the whole thing again, but following your suggestion of going with the latest Arducopter version. Any other suggestions? Thanks a lot!!

Finally got it working by updating the ArduCopter code as @clev0910 suggested. Thanks!!!

@clev0910 do you happen to you more about why copter 3.6 will not work with AirSim in SITL? I am trying to figure out if this is a Windows only issue or firmware issue itself and how would I go about fixing this. I have it working on copter 4, but I use a modified 3.6. I am hoping that maybe you can point me in the right direction?

Thanks!!

@reyes73a I think it has something to do with the process being timed out. The simulation starts much quicker than the time it takes to initialize mavproxy. I believe this would probably only be an issue with windows and specifically with cygwin, which is known to have communication issues, might not be the same with WSL.

@clev0910 I see. I was reading the previous posts where @A_E1 mentions this, but I am having a hard time understanding what he did…

  1. Start AirSim using either the binary or from source (Unreal Editor). This will start the simulator (e.g. see a drone on the ground)

  2. Start the python script to interface with AirSim and ArduCopter, but without mavproxy:
    sim_vehicle.py -v ArduCopter -f airsim-copter --console --map --no-mav-proxy

  3. start mavproxy in a separate terminal. This is the part that confuses me. For me to start mavproxy I need to start mavproxy.exe in a command line window which I can do just fine, but what parameters am I suppose to use so that it connects to the other components?

Thanks!!!

@reyes73a
MAVProxy is designed to be able to pickup the IP address to which an application is connected, so ideally it would pick up your LocalHostIP based on what was set in your settings.json file(this would typically be 127.0.0.1 or 0.0.0.0).Once it does this it loads the default parameters for a quadcopter as defined by ardupilot, but you can load your own parameters defined by a ground control station.
So the connection depends upon what your LocalHostIP and UDPip are set to in your airsim settings.

Hi,
Just saw this topic. I haven’t tested Cygwin till now for using ArduPilot, used WSL to build and run SITL while AirSim runs on Windows. Haven’t had any problems with WSL 1 till now. Note that for WSL2, you’ll need to follow the steps mentioned here, since it uses a different network space.

Hope this helps!