Big Brother: Difference between revisions

From Unallocated Space
Jump to navigation Jump to search
(Created page with "Big Brother is an AXIS 2130 PTZ Network Camera, located at the ledge atop the bathrooms. == Current and Future Uses == It is currently being used as the data source for the [[...")
 
No edit summary
Line 1: Line 1:
== ''This Code is Deprecated'' ==
Big Brother is an AXIS 2130 PTZ Network Camera, located at the ledge atop the bathrooms.
Big Brother is an AXIS 2130 PTZ Network Camera, located at the ledge atop the bathrooms.



Revision as of 21:34, 24 February 2019

This Code is Deprecated

Big Brother is an AXIS 2130 PTZ Network Camera, located at the ledge atop the bathrooms.


Current and Future Uses

It is currently being used as the data source for the Occupancy Sensor and The Wall.


Python

import urllib2,time,random

camurl="http://***.***.***.***/axis-cgi/com/ptz.cgi?camera=1"

def call(cmd):
    req = urllib2.Request(camurl+'&'+cmd)
    urllib2.urlopen(req)

#0-200
def iris(i):
        call("irisbar=185&alignment=horisontal&barcoord=?"+str(i)+",0")
def zoom(i):
        call("zoombar=185&alignment=horisontal&barcoord=?"+str(i)+",0")
def tilt(i):
        call("tiltbar=180&alignment=vertical&barcoord=?0,"+str(i))
def pan(i):
        call("panbar=200&alignment=horisontal&barcoord=?"+str(i)+",0")

def moveto(x=0,y=200):
    tilt(y)
    pan(x)

def movetorandom():
    moveto(random.randint(0,200),random.randint(150,200))

def sweep(speed=1,pause=0):
    moveto(0,200)
    rang3=200/speed
    while True:
        for i in range(rang3):
            pan((i*speed))
            time.sleep(pause)
        for i in range(rang3):
            pan((200-(i*speed)))
            time.sleep(pause)

def sweeprandom(pause=0):
    while True:
        movetorandom()
        time.sleep(pause)