# Serve a socket on the port indicated in the first command-line argument client = serve_socket(int(argv[1])) # Receive working directory path from client pyquadsim_directory = receiveString(client) # Create logs folder if needed logdir = pyquadsim_directory + '/logs' if not os.path.exists(logdir): os.mkdir(logdir) # Open logfile named by current date, time logfile = LogFile(logdir) # Create an FMU object, passing it the logfile object in case it needs to write to the logfile. fmu = FMU(logfile) # Loop ========================================================================================================== prevtime = time.time() # Forever loop will be halted by VREP client or by exception while True: try: currtime = time.time() print(currtime - prevtime) prevtime = currtime # Get core data from client
particleInfo = receiveFloats(client, 6) particleSizes = particleInfo[0:4] particleDensity = particleInfo[4] particleCountPerSecond = particleInfo[5] # Create logs folder if needed logdir = pyquadsim_directory + '/logs' if not os.path.exists(logdir): os.mkdir(logdir) # Open logfile named by current date, time logfile = LogFile(logdir) # Create an FMU object for pitch, roll, yaw, altitude correction. # Pass it the logfile object in case it needs to write to the logfile. fmu = FMU(logfile) # Create coordinate calculator for GPS simulation coordcalc = CoordinateCalculator() # Loop ========================================================================================================== # Forever loop will be halted by VREP client or by exception while True: try: # Get core data from client clientData = receiveFloats(client, 55) if not clientData: