Is it possible to manually specify the communication port between the server and the python client?
I want to do this so that I can start multiple instances of the environment and have multiple python clients, each communicating with the corresponding environment instances without affecting each other.
Thanks.
I don't think there's a trivial way to do it (but I'm not sure since I've been working off an older version for a few months) since airsim will try and read the settings file from Documents/AirSim/settings.json. Off the top of my head I can think of a few lazy ways that might work to get around it though:
2). In the master branch, by default the RPC client will begin running on 41451. If you have space on your drive git clone into multiple folders the latest master branch. Then replace https://github.com/Microsoft/AirSim/blob/5223c26f86d93b7a3b5961dab170a829a9d5baab/AirLib/include/api/RpcLibServerBase.hpp#L17 with RpcLibServerBase(ApiProvider* api_provider, const std::string& server_address, uint16_t port = 41451); RpcLibServerBase(ApiProvider* api_provider, const std::string& server_address, uint16_t port = 41452);, etc. in each airsim folder respectively. Do same for https://github.com/Microsoft/AirSim/blob/5223c26f86d93b7a3b5961dab170a829a9d5baab/AirLib/include/api/RpcLibClientBase.hpp#L23 and other RPCLib files (although I think apis still inherit from these so might not be necessary)
3). Run multiple instances on separate virtual machines using virtualbox or something similar (this would be terrible for hard disk memory)
4). Try and use azure VMs as mentioned here: https://github.com/Microsoft/DroneRescue.
5). Modify the source code so that you can pass in the api port and settings file.
I'm not sure if any of these will work but maybe they'll help get you started. Hopefully someone will come up with a far cleaner solution for you
@DavidLSmyth Thanks for your helpful suggestions! I will try some of them.
I was able to accomplish this pretty trivially by modifying AirSimSettings.hpp to read in a port I specified in the settings.json and then modifying SimModeCar.cpp and SimModeWorldMultirotor.cpp to pass that specified port when creating the API server.
fixed in PR above
Most helpful comment
I don't think there's a trivial way to do it (but I'm not sure since I've been working off an older version for a few months) since airsim will try and read the settings file from Documents/AirSim/settings.json. Off the top of my head I can think of a few lazy ways that might work to get around it though:
2). In the master branch, by default the RPC client will begin running on 41451. If you have space on your drive git clone into multiple folders the latest master branch. Then replace https://github.com/Microsoft/AirSim/blob/5223c26f86d93b7a3b5961dab170a829a9d5baab/AirLib/include/api/RpcLibServerBase.hpp#L17 with
RpcLibServerBase(ApiProvider* api_provider, const std::string& server_address, uint16_t port = 41451);RpcLibServerBase(ApiProvider* api_provider, const std::string& server_address, uint16_t port = 41452);, etc. in each airsim folder respectively. Do same for https://github.com/Microsoft/AirSim/blob/5223c26f86d93b7a3b5961dab170a829a9d5baab/AirLib/include/api/RpcLibClientBase.hpp#L23 and other RPCLib files (although I think apis still inherit from these so might not be necessary)3). Run multiple instances on separate virtual machines using virtualbox or something similar (this would be terrible for hard disk memory)
4). Try and use azure VMs as mentioned here: https://github.com/Microsoft/DroneRescue.
5). Modify the source code so that you can pass in the api port and settings file.
I'm not sure if any of these will work but maybe they'll help get you started. Hopefully someone will come up with a far cleaner solution for you