microsoft / AirSim

Open source simulator for autonomous vehicles built on Unreal Engine / Unity, from Microsoft AI & Research
https://microsoft.github.io/AirSim/
Other
16.38k stars 4.56k forks source link

Possibility of simulating more than one vehicle #92

Closed saihv closed 7 years ago

saihv commented 7 years ago

I was wondering if it's possible or supported to simulate more than one quadrotor, where each can be controlled by a separate Pixhawk (or even an SITL instance). As a first step, I was able to add two actors to the level blueprint, so two players (drones) are spawned, but before I delve into the code further, I was hoping to get some thoughts on whether this is doable.

Looks like the ASimModeWorldMultiRotor::createVehicles method has support for more than one vehicle, where the method looks for all existing 'flying pawns' and then assigns fpv_vehicle_connector_ to the active flying pawn, would it be possible to have multiple such VehicleConnectorBase connectors?

sytelus commented 7 years ago

Yes, it is possible to have multiple vehicles in AirSim. The biggest issue you would encounter right now is how to set up PX4. If you are up for the task then you can look up in json that has settings per vehicle and each vehicle is assigned a name. So if you have two instances of FlyingPawn, you can assign different VehicleName in those instances and then put settings for them in json.

The obvious issue in going above route is PX4. So we are hard at work to eliminate dependency on PX4. In our next version, we want to integrate some form of firmware right in AirSim so there is no real hardware or even SITL required. Once that happens, it should be much easier to do multiple vehicles.

saihv commented 7 years ago

@sytelus I was wondering if you'd have any advice about multiple vehicles with regards to the new version. What I tried was duplicating the BP_FlyingPawn asset, and also duplicated the blueprint such that two players will be spawned. Initially, it complained that only one 'player controller' was present, but if I add a CreatePlayer block, the error disappeared and I can see two quadrotors spawned in the level I am playing.

Before I fiddle around with adding the second Pixhawk and its own RC, I was trying to see if I could just fly one and leave the other static to make sure the camera director etc. are working properly. When I take off with the first drone, it flies up for a little bit and suddenly returns to the start position. This happens a few times until it starts spinning in place or does something weird like that, so basically not letting me fly it. Would you have any thoughts on what I might be missing while trying to add the second player?