-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMain.py
More file actions
21 lines (15 loc) · 902 Bytes
/
Main.py
File metadata and controls
21 lines (15 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import airsim
import logging
from LoggerThread import LoggerThread
from Server_ControlDrone import ServerThread
if __name__ == '__main__':
serverThread = ServerThread() # Initiating connection to clientPC
client: airsim.MultirotorClient = serverThread.client
loggerThread = LoggerThread(client) # Initiate logger class instance
logger: logging.Logger = loggerThread.getLogger() # Getting logger from the loggerThread instance
serverThread.logger = logger # Assignment of logger to server thread (to be able to log from it to the same file and with the same settings)
logger.info("Connected to instance of Airsim, simulation ready to start...") # Logging
loggerThread.start() # Start continuous logging to appropriate file and console
serverThread.start() # Start continuous receiving of commands to the drone
serverThread.join()
loggerThread.stop()