Big Brother

From Unallocated Space
Revision as of 20:36, 24 February 2019 by Usako (talk | contribs) (→‎This Code is Deprecated)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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)