#!/usr/bin/python from PanTiltDriver import PanTiltDriver import time panTilt = PanTiltDriver() # while (True): # panTilt.panLeft() # time.sleep(1) # panTilt.panCenter() # time.sleep(1) # panTilt.panRight() # time.sleep(1) # panTilt.panCenter() # time.sleep(1) currentAngle = 0.0 endAngle = 180.0 panTilt.panTo(currentAngle) time.sleep(1) while currentAngle < endAngle: currentAngle += 15.0 panTilt.panTo(currentAngle) time.sleep(0.5) panTilt.panCenter()
# Set mapping root dir on Desktop # mappingRootDir = os.path.expanduser("~/Desktop/mapping") mappingRootDir = os.path.expanduser("/home/pi/Desktop/mapping") currentMappingDir = mappingRootDir + "/" + str(time.time()) # Make sure the dir exists if not os.path.exists(currentMappingDir): os.makedirs(currentMappingDir) # 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
#!/usr/bin/python from PanTiltDriver import PanTiltDriver import time panTilt = PanTiltDriver() # while (True): # panTilt.panLeft() # time.sleep(1) # panTilt.panCenter() # time.sleep(1) # panTilt.panRight() # time.sleep(1) # panTilt.panCenter() # time.sleep(1) currentAngle = 0.0 endAngle = 180.0 panTilt.panTo(currentAngle) time.sleep(1) while currentAngle < endAngle: currentAngle += 15.0 panTilt.panTo(currentAngle) time.sleep(0.5)
from parse_rest.datatypes import Object, File mappingRootDir = os.path.expanduser("/home/pi/Desktop/mapping") currentMappingDir = mappingRootDir + "/" + str(time.time()) # Make sure the dir exists if not os.path.exists(currentMappingDir): os.makedirs(currentMappingDir) # 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 panStepSize = 10.0 # In Degrees tiltStepSize = 5.0 # In Degrees panStepDuration = 0.5 # In seconds tiltStepDuration = 0.5 # In seconds currentPanAngle = 0.0 currentTiltAngle = 0.0 # Go to initial position panTilt.panLeft() time.sleep(panStepDuration) panTilt.tiltUp() time.sleep(panStepDuration)
#!/usr/bin/python from PanTiltDriver import PanTiltDriver import time panTilt = PanTiltDriver() # while (True): # panTilt.panLeft() # time.sleep(1) # panTilt.panCenter() # time.sleep(1) # panTilt.panRight() # time.sleep(1) # panTilt.panCenter() # time.sleep(1) currentAngle = 0.0 endAngle = 45.0 panTilt.tiltTo(0.0) panTilt.panCenter() time.sleep(1) while currentAngle < endAngle: currentAngle += 5.0 panTilt.tiltTo(currentAngle) time.sleep(0.2) panTilt.panCenter()