ElishaAz / simple_airsim

GNU General Public License v3.0
31 stars 11 forks source link

Multiple Drones with one gui #2

Closed ProcessorGuy closed 1 year ago

ProcessorGuy commented 1 year ago

Hello,

I wanted to simulate drone swarms by using this code. Is it possible? I tried the following code but it didn't work out.


def square(drone: Drone): drone.takeoff(True) while True: for i in range(4): drone.move_by(50, 0, 0, True) drone.turn_by(0, 0, 90, True) time.sleep(0.1)

if _name == '\main_':

# UAV Swarm size
UAVNum = 4

# pool size
pool_size = UAVNum  

# define worker function before a Pool is instantiated
def worker(item):
    try:
        xx = "man{}".format(item)
        yy = "gui{}".format(item)
        with Manager(coordinate_system.AIRSIM, method=square) as xx:
            with GUIManager(man, 10, 10, 10, 3) as yy:
                yy.start()            
    except:
        print('error with item')  

pool = Pool(pool_size)

for ii in range(1, UAVNum+1, 1):
    pool.apply_async(worker, (ii,))

pool.close()
pool.join()    

How can we fix it?

ElishaAz commented 1 year ago

Sorry, but this is not supported.