예제 #1
0
파일: monitor.py 프로젝트: febret/ecto
def setup_master():
    missionControlPort = int(sys.argv[1])
    webServerPort = int(sys.argv[2])
    
    # do a cleanup, and also register kill_slaves to be called on exit.
    kill_slaves(nodeNames)
    import atexit
    atexit.register(kill_slaves, nodeNames)

    # Launch the monitor slaves
    for node in nodeNames:
        cmd = "ssh -n {0} cd {1}; {2} -c system/headless.cfg monitor.py --mc @{3}:{4} -N {5} -L off --interactive-off".format(
            node, os.getcwd(), ogetexecpath(), serverName, missionControlPort, node)
        olaunch(cmd)
        sleep(0.1)

    # Launch the web server
    global ps
    porthole.initialize(webServerPort, './index.html')
    ps = porthole.getService()
예제 #2
0
def setup_master():
    missionControlPort = int(sys.argv[1])
    webServerPort = int(sys.argv[2])

    # do a cleanup, and also register kill_slaves to be called on exit.
    kill_slaves(nodeNames)
    import atexit
    atexit.register(kill_slaves, nodeNames)

    # Launch the monitor slaves
    for node in nodeNames:
        cmd = "ssh -n {0} cd {1}; {2} -c system/headless.cfg monitor.py --mc @{3}:{4} -N {5} -L off --interactive-off".format(
            node, os.getcwd(), ogetexecpath(), serverName, missionControlPort,
            node)
        olaunch(cmd)
        sleep(0.1)

    # Launch the web server
    global ps
    porthole.initialize(webServerPort, './index.html')
    ps = porthole.getService()
예제 #3
0
파일: chat.py 프로젝트: omega-hub/porthole
# Basic porthole example
import porthole

# Setup porthole
porthole.initialize(4080, './chat.html')
ps = porthole.getService()


# Client call this function when posting a message.
def postMessage(message, sender):
    print("{0}: {1}".format(sender, message) )
    ps.broadcastjs("messageReceived('{0}: {1}')".format(sender, message), '')
예제 #4
0
#-------------------------------------------------------------------------------
# setup mission control and porthole
from omega import *
import porthole
import sys

missionControlPort = getMissionControlServer().getPort()
webServerPort = 5005

# Launch the web server
porthole.initialize(webServerPort, './index.html')
webServer = porthole.getService()

#-------------------------------------------------------------------------------
# choose what services to launch here
#import monitor
import launcher
예제 #5
0
# This example shows how to do basic camera streaming to 
# a web interface using porthole.
# opena browser to http://127.0.0.1:4080
import porthole

# Setup porthole
porthole.initialize('porthole/default.xml')
porthole.getService().setServerStartedCommand("print('porthole web server ready! connect to http://localhost:4080')")
porthole.getService().setCameraCreatedCommand("onCameraCreated(%id%)")

def onCameraCreated(camId):
    global clientCamera
    camera = getCameraById(camId);
    #camera.setOverlayEnabled(False)
    camera.setHeadOffset(getDefaultCamera().getHeadOffset())
    print("camera created " + camera.getName())
    getDefaultCamera().addChild(camera)
예제 #6
0
파일: monitor.py 프로젝트: omega-hub/cami
def requestUpdate(clientId):
    porthole.getService().sendjs("data = {0}; update()".format(data), clientId)
예제 #7
0
import porthole

box = BoxShape.create(0.8, 0.8, 0.8)
box.setPosition(Vector3(0, 2, -3))

# Apply an emissive textured effect (no lighting)
box.setEffect("colored -d green")

l1 = Light.create()
l1.setColor(Color('white'))
l1.setPosition(-1, 2, 0)

# Setup porthole
porthole.initialize('colorPicker.xml')
porthole.getService().setConnectedCommand("print('client connected: %id%')")
porthole.getService().setDisconnectedCommand("print('client disconnected: %id%')")

def onColorChanged(id):
	box.getMaterial()

def onPortholeCameraDestroyed(id):
	cam = getCameraById(id)
	getDefaultCamera().removeChild(cam)

# Spin the box!
def onUpdate(frame, t, dt):
	global btn
	box.pitch(dt)
	box.yaw(dt / 3)
	
예제 #8
0
import porthole
porthole.initialize()
porthole.getService().load('porthole/portholePointer.xml')
porthole.getService().setServerStartedCommand(
    "print('porthole web server ready! connect to http://localhost:4080')")
예제 #9
0
import porthole

box = BoxShape.create(0.8, 0.8, 0.8)
box.setPosition(Vector3(0, 2, -3))

# Apply an emissive textured effect (no lighting)
box.setEffect("colored -d green")

l1 = Light.create()
l1.setColor(Color('white'))
l1.setPosition(-1, 2, 0)

# Setup porthole
porthole.initialize('colorPicker.xml')
porthole.getService().setConnectedCommand("print('client connected: %id%')")
porthole.getService().setDisconnectedCommand(
    "print('client disconnected: %id%')")


def onColorChanged(id):
    box.getMaterial()


def onPortholeCameraDestroyed(id):
    cam = getCameraById(id)
    getDefaultCamera().removeChild(cam)


# Spin the box!
def onUpdate(frame, t, dt):
예제 #10
0
파일: pointer.py 프로젝트: cruxeon/porthole
import porthole
porthole.initialize()
porthole.getService().load('porthole/portholePointer.xml')
porthole.getService().setServerStartedCommand("print('porthole web server ready! connect to http://localhost:4080')")
예제 #11
0
# Basic example showing use of the porthole streaming HTML5 interface
from omega import *
from cyclops import *

import porthole

porthole.initialize()
porthole.getService().setConnectedCommand("print('client connected: %id%')")
porthole.getService().setDisconnectedCommand("print('client disconnected: %id%')")
porthole.getService().setCameraCreatedCommand("onPortholeCameraCreated(%id%)")
porthole.getService().setCameraDestroyedCommand("onPortholeCameraDestroyed(%id%)")

def onPortholeCameraCreated(id):
	print('Porthole camera created: ' + str(id))
	cam = getCameraById(id)
	# Diable overlay (2D) stuff for the porthole camera. Just draw the 3D scene.
	cam.setOverlayEnabled(False)
	# Attach the porthole camera to the default one, to follow it.
	getDefaultCamera().addChild(cam)

def onPortholeCameraDestroyed(id):
	cam = getCameraById(id)
	getDefaultCamera().removeChild(cam)

box = BoxShape.create(0.8, 0.8, 0.8)
box.setPosition(Vector3(0, 2, -3))

# Apply an emissive textured effect (no lighting)
box.setEffect("textured -v emissive -d cyclops/test/omega-transparent.png")

# Spin the box!
예제 #12
0
# Basic example showing use of the porthole streaming HTML5 interface
from omega import *
from cyclops import *

import porthole

porthole.initialize()
porthole.getService().setConnectedCommand("print('client connected: %id%')")
porthole.getService().setDisconnectedCommand(
    "print('client disconnected: %id%')")
porthole.getService().setCameraCreatedCommand("onPortholeCameraCreated(%id%)")
porthole.getService().setCameraDestroyedCommand(
    "onPortholeCameraDestroyed(%id%)")


def onPortholeCameraCreated(id):
    print('Porthole camera created: ' + str(id))
    cam = getCameraById(id)
    # Diable overlay (2D) stuff for the porthole camera. Just draw the 3D scene.
    cam.setOverlayEnabled(False)
    # Attach the porthole camera to the default one, to follow it.
    getDefaultCamera().addChild(cam)


def onPortholeCameraDestroyed(id):
    cam = getCameraById(id)
    getDefaultCamera().removeChild(cam)


box = BoxShape.create(0.8, 0.8, 0.8)
box.setPosition(Vector3(0, 2, -3))
예제 #13
0
def onOrientationChanged(pitch, yaw, roll, clientId):
    box.setOrientation(quaternionFromEulerDeg(pitch, yaw, roll))
    # Update slider state on all connected clients.
    porthole.getService().broadcastjs('updateSliders({0}, {1}, {2})'.format(pitch,yaw,roll), clientId)
    
예제 #14
0
# create a box that will be oriented through sliders
box = BoxShape.create(1,1,1)
box.setEffect('colored -d red')
box.setPosition(0, 2, -4)
l = Light.create()
l.setPosition(0, 4, 0)
l.setColor(Color('white'))
l.setAmbient(Color(0.2, 0.2, 0.2, 1))

def createUi():
    global bw
    # create a webView to show the porthole interface.
    width = 440
    height = 200
    ui = UiModule.createAndInitialize()
    uiroot = ui.getUi()
    bw = BrowserWindow('Box Orientation', uiroot, width, height)
    bw.loadUrl("http://127.0.0.1:4080")
    bw.setDraggable(True)
        
# Setup porthole
porthole.initialize('syncSlider.xml')
porthole.getService().setServerStartedCommand("createUi()")

# Web interface callbacks
def onOrientationChanged(pitch, yaw, roll, clientId):
    box.setOrientation(quaternionFromEulerDeg(pitch, yaw, roll))
    # Update slider state on all connected clients.
    porthole.getService().broadcastjs('updateSliders({0}, {1}, {2})'.format(pitch,yaw,roll), clientId)
    
예제 #15
0
# Basic porthole example
import porthole

# Setup porthole
porthole.initialize(4080, './input.html')
ps = porthole.getService()


# print input events
def onEvent():
    e = getEvent()
    if (e.getServiceType() == ServiceType.Keyboard):
        if (e.getType() == EventType.Down):
            print("Key down: " + chr(e.getSourceId()))
    if (e.getServiceType() == ServiceType.Pointer):
        if (e.getType() == EventType.Down):
            print("Pointer button down")
        elif (e.getType() == EventType.Up):
            print("Pointer button up")
        elif (e.getType() == EventType.Move):
            print("Pointer move:" + str(e.getPosition()))


setEventFunction(onEvent)
예제 #16
0
    box.getMaterial().setColor(Color(colorString), Color('black'))

# Spin the box!
def onUpdate(frame, t, dt):
	global btn
	box.pitch(dt)
	box.yaw(dt / 3)
	
setUpdateFunction(onUpdate)

bw = None

def createWebUi():
	global bw
	# create a webView to show the porthole interface.
	width = 240
	height = 240

	ui = UiModule.createAndInitialize()
	uiroot = ui.getUi()
	
	bw = BrowserWindow('browser', uiroot, width, height)
	bw.loadUrl("http://127.0.0.1:4080")
	bw.setDraggable(True)
		
# Setup porthole
porthole.initialize('colorPicker.xml')
porthole.getService().setConnectedCommand("print('client connected: %id%')")
porthole.getService().setDisconnectedCommand("print('client disconnected: %id%')")
porthole.getService().setServerStartedCommand("createWebUi()")
예제 #17
0
    global btn
    box.pitch(dt)
    box.yaw(dt / 3)


setUpdateFunction(onUpdate)

bw = None


def createWebUi():
    global bw
    # create a webView to show the porthole interface.
    width = 240
    height = 240

    ui = UiModule.createAndInitialize()
    uiroot = ui.getUi()

    bw = BrowserWindow('browser', uiroot, width, height)
    bw.loadUrl("http://127.0.0.1:4080")
    bw.setDraggable(True)


# Setup porthole
porthole.initialize('colorPicker.xml')
porthole.getService().setConnectedCommand("print('client connected: %id%')")
porthole.getService().setDisconnectedCommand(
    "print('client disconnected: %id%')")
porthole.getService().setServerStartedCommand("createWebUi()")