-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Update multi_vehicle.md with python API example #664
Comments
Are you already instantiating multiple vehicles with different API ports? If yes, I have a really barebones script that can send commands to multiple drones at my fork, which you can probably extend based on the functionality you need: +1 for an official Python API as well! |
No, I cannot instantiate multiple vehicles with different API ports yet. I outlined some problems I was having in #230. I have a similar script to yours which should be able to control the drones once they are instantiated, I'm just having trouble getting drones that are not marked as Is Fpv Vehicle to create a socket to connect to via the python API |
@saihv I cloned your fork and managed to instantiate multiple vehicles running on separate ports which I can access via the API, if someone could advise how to deal with the missing "Vehicle Config Name" in the latest version of AirSim that would be very helpful. (edited incorrect tagging of saipv, sorry!) |
Notifying @saihv as @DavidLSmyth might have mistakenly looped me in :) |
EDIT: Just tested this, and while the API ports are now different, I am unable to connect to any vehicles apart from the first (irrespective of the port numbers) Perhaps an ugly way of doing it, but in the newest version, you can probably 'append' the index of the vehicle to the new wrapper structure that is in AirSim, in order to differentiate between vehicles and use multiple API ports.: I believe the reason for the wrapper is to use the same method for instantiating both cars and drones. The following is a quick modification of the code from SimModeMultiRotor.cpp, and I think this can be extended to create custom numbering..
And then of course, you'd have to match these Vehicle0, Vehicle1 tags with stuff in settings.json Looks like the difference between the old and new versions is that the new version has a wrapper structure, which stores vehicle configuration data internally, but the older versions had a UPROPERTY that allowed you to change the fields from Unreal. |
Fixed it: after the API ports are changed, startApiServer() needs to be called for each vehicle in the list. Which means fpv_vehicle_connector needs to be an array of pointers instead of just one: https://gist.github.com/saihv/1611ae5d34fbdb52c814efb1023eb154 Needs to be declared in SimModeMultiRotor.h as
|
That makes sense, I had been working on this and noticed that the connections weren't being created but didn't have time to figure it out, thanks for sharing the fix. I think this should be submitted as a pull request, it's listed as p0 on the trello: https://trello.com/b/1t2qCeaA/todo |
Ah, I didn't even notice there was a Trello! I will wrap my changes up into a commit and submit it. EDIT: Submitted. #706 |
@saihv How can I set the subwidows for Multiple Vehicles? |
Hello, I'm a new AirSim user. I have a question about multiple vehicles. Now I can add multiple cars in the Moutains Landscape Evenvironment , but I can just control only on car while the other one accepts the same control . I want to achieve that the "host" car is controled and the other cars run around the "host " car . How can I achieve this ? @saihv |
closed to age and lack of activity. this also looks like it's fixed at this point |
Would it be possible to update multi_vehicle.md to reflect recent changes? For example, there is no longer a VehicleConfig section under BP_Flying_Pawn details. An full example of creating multiple vehicles and controlling them via the python API on separate ports with simple flight as well as PX4 firmware would be highly appreciated.
I have tried to run AirSim with multiple vehicles in the environment but have only ever managed to get the first vehicle listed in settings.json to connect via the python API. Opening a fresh issue because I couldn't figure out the correct configuration from #230
The text was updated successfully, but these errors were encountered: