# Create xml mapping file mappingFilePath = currentMappingDir + "/mapping.json" open(mappingFilePath, 'w') # Init the hardware sensor = SR04(33, 35) panTilt = PanTiltDriver() piCam = picamera.PiCamera() # Init some params sweepStepSize = 30.0 # In Degrees sweepStepDuration = 0.5 # In seconds currentPanAngle = 0.0 # Go to initial position panTilt.panLeft() time.sleep(sweepStepDuration) panTilt.tiltDown() time.sleep(sweepStepDuration) # Take a 180 degree sweep measurements = [] while currentPanAngle < 180.0: # Take measurement and add it to the list imageFilePath = currentMappingDir + "/" + str(time.time()) + ".jpg" piCam.capture(imageFilePath) distance = sensor.getDistanceCM() measurement = Measurement(currentPanAngle, 0.0, distance, imageFilePath) measurements.append(measurement)