Exemple #1
0
	def __init__(self):

		# initialize controlls
		self.camera = camera.CameraController()
		self.inferface = interface.InterfaceController()
		self.motor = motor.MotorController()
		self.joystick = joystick.JoystickController()
		self.ai = jetson_ai.JetsonAI()
		self.ultrasonic = ultrasonic.UltrasonicController()
Exemple #2
0
    # IDLE INTERFACE MODE:
    # 	-check interface input
    # 	-update interface output
    #	-update mode frome input

    # AUTONOMOUS MODE:
    #	-check ultrasonic proximity
    #	-check for remote kill signal
    #	-capture image
    #	-generate motor output from image and ai model
    #	-activate motors

    # DATA CAPTURE MODE:
    #	-get joystick output
    # 	-capture image
    # 	-save data
    #	-convert to motor controll
    #	-activate motors
    #	-check kill signal

    # DIAGNOSTIC MODE:
    #	-check image capture
    #	-check ultrasonic capture
    #	-check remote controll
    # 	-check joystick

    pass

cam = camera.CameraController()
Exemple #3
0
    def __init__(self):
        ShowBase.__init__(self)
        wp = core.WindowProperties()
        wp.setTitle("Dorfdelf")
        self.win.requestProperties(wp)

        self.render.setAntialias(core.AntialiasAttrib.MAuto)
        self.setBackgroundColor(0.5, 0.5, 0.5)
        self.disableMouse()
        self.enableParticles()

        font = self.loader.loadFont('media/calibri.ttf')
        font.setPixelsPerUnit(120)
        font.setPageSize(512, 1024)
        loading = OnscreenText(text='Loading...',
                               scale=0.2,
                               pos=(0.0, 0.0),
                               fg=(1, 1, 1, 1),
                               shadow=(0.3, 0.3, 0.3, 1.0),
                               align=core.TextNode.ACenter,
                               mayChange=True,
                               font=font,
                               parent=self.aspect2d)

        self.graphicsEngine.renderFrame()
        self.graphicsEngine.renderFrame()

        loading.setText('Generating world')
        self.graphicsEngine.renderFrame()
        self.graphicsEngine.renderFrame()

        self.world = world.World(128, 128, 100)
        self.world.generate()

        loading.setText('Creating world geometry')
        self.graphicsEngine.renderFrame()
        self.graphicsEngine.renderFrame()

        self.world_geometry = geometry.WorldGeometry(self.world)

        self.camLens.setFocalLength(1)
        self.camera.setPos(0, 0, 100)
        self.camera.lookAt(self.world.midpoint.x, self.world.midpoint.y, 100)
        self.cam.setPos(0, 0, 0)
        self.cam.setHpr(0, -45, 0)

        self.cc = camera.CameraController(self.world.size,
                                          self.mouseWatcherNode, self.camera,
                                          self.cam)
        self.gui = gui.GUI(self.pixel2d, font)
        self.world_geometry.node.setPos(0, 0, 0)
        self.world_geometry.node.reparentTo(self.render)

        self.explore_mode = True
        self.current_slice = int(self.world.midpoint.z)

        self.accept_keyboard()
        self.accept('mouse1', self.toggle_block)

        self.accept('console-command', self.console_command)

        self.designation = designation.Designation()

        self.dorfs = []
        self.tool = lambda w, x, y, z: None
        self.toolargs = ()
        self.tools = {
            'bomb': tools.bomb,
            'block': tools.block,
            'd': self.designation.add
        }

        self.console = console.Console(self)
        self.picker = block_picker.BlockPicker(self.world, self)
        self.zmap = zmap.ZMap(self.world, self)

        self.change_slice(0)

        arrow = LineNodePath()
        arrow.reparentTo(self.render)
        arrow.drawArrow2d(Vec3(-5, -5, self.world.midpoint.z),
                          Vec3(15, -5, self.world.midpoint.z), 30, 3)
        arrow.create()
        loading.hide()
Exemple #4
0
from flask import Flask
from flask import jsonify, render_template
import os

app = Flask(__name__, template_folder='.')
import camera

os.environ['DEVICE'] = "/dev/video0"
#os.environ['MJPG_STREAMER_URL'] = ""

camera = camera.CameraController(os.environ['DEVICE'])
mpg_url = os.environ.get(
    'MJPG_STREAMER_URL',
    "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBwgHBgkIBwgUFQkVFhkVFhYYGBUaGRAhGB0iIiAWHx8kKDEjJCYsJx8fLT0tOTAuOjowIys/QDY4TzQ5OjQBCgoKDQ0OGBAPFzUeHSUtNS0tLSstKy0rMC83KzcuLTUrNS0tLS8tKy01Ny03LysrLSsxNTc2MC0rLS0rLSsrLf/AABEIAKgBLQMBIgACEQEDEQH/xAAbAAEBAQADAQEAAAAAAAAAAAAABgECBAUHA//EAC4QAQACAgEDAwIDCQEAAAAAAAABAgMRBBITIQYiMQVBFjJRFSMkQkNhcY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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//2Q=="
)
pan = 0
tilt = 0
focus = 0


@app.route("/settings")
def settings():
    return jsonify({"mpg_url": mpg_url, "device": os.environ['DEVICE']})


@app.route("/buttons")
def buttons():
    return render_template('./buttons.html',
                           stream_url=mpg_url,
                           focus_min=0,
                           focus_max=1440,