Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run several instances of AirSim in parallel? #64

Closed
yannbouteiller opened this issue Sep 26, 2019 · 11 comments
Closed

How to run several instances of AirSim in parallel? #64

yannbouteiller opened this issue Sep 26, 2019 · 11 comments

Comments

@yannbouteiller
Copy link

Hello,

I am having issues on trying to launch several instances of AirSim in parallel on my machine (say, one per GPU for example) and to communicate with them through the Python API as I will eventually need to do this on a cluster to train RL algorithms. Is there any easy way of doing this, please?

Regards,
Yann.

@yannbouteiller
Copy link
Author

Sorry, I found a partial answer in this issue: microsoft/AirSim#563

I'll try to see if I can do something that works fine out of this.

@yannbouteiller
Copy link
Author

Reopening this issue as it seems there is a mechanism to do this in AirSim according to this issue : microsoft/AirSim#1711 ?

I don't understand how we can change the port of the launched server when executing
./AirSimExe.sh -windowed

Can you help, please ?

@madratman
Copy link
Contributor

Server port is set in settings.json, and that file is automatically read by the unreal binary when you start it via ./AirSimExe.sh -windowed. See this comment for another example : #35 (comment)

Client port can be passed as a param in the constructor of multirotorclient https://microsoft.github.io/AirSim-NeurIPS2019-Drone-Racing/api.html#airsimneurips.client.MultirotorClient

The workaround you mentioned is saying set port to a value - say 41451 - and run one instance, then modify the settings.json to a new port value - say 41452 - and run another instance.
now, you can pass either 41451/41452 to multirotorclient to talk to either instance of airsim.

@yannbouteiller
Copy link
Author

yannbouteiller commented Sep 26, 2019

Well, it works when modifying the LocalHostIp value, for example setting
"LocalHostIp": "127.0.0.1"
for the first run and
"LocalHostIp": "127.0.0.2"
for the second run, but it crashes when trying to do
"ApiServerPort": 41451
and
"ApiServerPort": 41452
instead. Am I doing something wrong?

@madratman
Copy link
Contributor

Here's another workaround.
AirSim gives higher priority to a settings.json lying in the same directory as the linux/windows unreal binary, as compared to the one lying in /home/$USER/Documents/AirSim/settings.json

So, one way to do this is to copy paste the unreal binaries, and have different settings.json in each binary folder.

For example, you can place a settings.json in
PATH_TO/AirSim_1/AirSimExe/Binaries/Linux/settings.json, with a particular port number, and when you run it with ./AirSim_1/AirSimExe.sh -windowed

And then you can copy-paste the unreal engine binaries:
PATH_TO/AirSim_2/AirSimExe/Binaries/Linux/settings.json, with a new port number, and when you run it with ./AirSim_2/AirSimExe.sh -windowed it should use the new port number

I know either workaround is suboptimal. We'll look into passing the path to a json file as a command line arg.

@madratman
Copy link
Contributor

yeah, it's crashing with new port with multiple instances :/. Looking into it.

@madratman
Copy link
Contributor

madratman commented Sep 27, 2019

I just updated the linux v0.3.0's AirSim.zip (pak files are the same)
It shouldn't crash now with different ports.

The new zip also has a fix for the reset bug from your other thread. Let us know if it's fixed now.

@yannbouteiller
Copy link
Author

Well, the port issue seems fixed, thank you.

However, about reset(), I get an error when calling GetObjectPose() after calling reset() apparently, I will report it in the other thread.

@madratman
Copy link
Contributor

Ah, I ll update the pythonclient.

@yannbouteiller
Copy link
Author

Hi @madratman

Did you update it, please? Because nothing happens when I try to pip-install airsimneurips --upgrade and I still get the crash.

@madratman
Copy link
Contributor

This should be updated now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants