So I am running AirSim and I have an API that gathers data and writes it to a file. I want to limit the frequency of the write speed to 60 Hz (or write 60 times every second). How would I do this. Currently I just have the write command in a while loop.
while True:
gps_data = client.getGpsData().gnss.geo_point
alt = (gps_data.altitude)
lat = (gps_data.latitude)
lon = (gps_data.longitude)
gps_data_struct = [lat,lon,alt]
with open(output_file,'a') as gpscsvfile:
gpscsvwriter = csv.writer(gpscsvfile)
gpscsvwriter = gpscsvwriter.writerow(gps_data_struct)
#print("Altitude: %s\nLatitude %s\nLongitude %s" %(alt,lat,lon) )
if False:
break