Andrew T.
Published © CC BY-ND

Smart Office ِAssistant A. I Robots Network

A company assistant robot that can deliver docs, food to employees, autonomously map and navigate the whole office with a chatting system.

AdvancedFull instructions provided12 hours2,242
Smart Office ِAssistant A. I Robots Network

Things used in this project


Read more


Mapping process MP4

Mapping process MP4 just in case the gif was not loading


modified file to remotly record a screenshot of the current location and map from the master laptop while driving the car
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
Created on Sat Jun 24 20:10:44 2017

@author: wroscoe

The client and web server needed to control a car remotely.

import random
from paramiko.client import SSHClient

import os
import time

import tornado
import tornado.ioloop
import tornado.web
import tornado.gen

from donkeycar import util

class LocalWebController(tornado.web.Application):
    port = 8887
    def __init__(self, use_chaos=False):
        Create and publish variables needed on many of
        the web handlers.
        print('Starting Donkey Server...')
        print('Connecting To Ros Master')
        client = SSHClient()
        client.connect('', username='user', password='pass')

        this_dir = os.path.dirname(os.path.realpath(__file__))
        self.static_file_path = os.path.join(this_dir, 'templates', 'static')

        self.angle = 0.0
        self.throttle = 0.0
        self.mode = 'user'
        self.recording = False
        self.ip_address = util.web.get_ip_address()
        self.access_url = 'http://{}:{}'.format(self.ip_address, self.port)

        self.chaos_on = False
        self.chaos_counter = 0
        self.chaos_frequency = 1000 #frames
        self.chaos_duration = 10

        if use_chaos:
            self.run_threaded = self.run_chaos
            self.run_threaded = self._run_threaded

        handlers = [
            (r"/", tornado.web.RedirectHandler, dict(url="/drive")),
            (r"/drive", DriveAPI),
            (r"/video", VideoAPI),
            (r"/static/(.*)", tornado.web.StaticFileHandler, {"path": self.static_file_path}),

        settings = {'debug': True}
        super().__init__(handlers, **settings)

    def run_chaos(self, img_arr=None):
        Run function where steering is made random to add corrective
        self.img_arr = img_arr
        if self.chaos_counter == self.chaos_frequency:
            self.chaos_on = True
            random_steering = random.random()
        elif self.chaos_counter == self.chaos_duration:
            self.chaos_on = False

        if self.chaos_on:
            return random_steering, self.throttle, self.mode, False
            return self.angle, self.throttle, self.mode, self.recording

    def say_hello(self):
        Print friendly message to user
        print("You can now go to {} to drive your car.".format(self.access_url))

    def update(self):
        """ Start the tornado web server. """
        self.port = int(self.port)
        instance = tornado.ioloop.IOLoop.instance()

    def _run_threaded(self, img_arr=None):
        self.img_arr = img_arr
        return self.angle, self.throttle, self.mode, self.recording

    def run(self, img_arr=None):
        return self.run_threaded(img_arr)

class DriveAPI(tornado.web.RequestHandler):
    def get(self):
        data = {}
        self.render("templates/vehicle.html", **data)

    def post(self):
        Receive post requests as user changes the angle
        and throttle of the vehicle on a the index webpage
        data = tornado.escape.json_decode(self.request.body)
        self.application.angle = data['angle']
        self.application.throttle = data['throttle']
        self.application.mode = data['drive_mode']
        self.application.recording = data['recording']
           stdin, stdout, stderr = client.exec_command('python /home/your_user/your/path/to/')

class VideoAPI(tornado.web.RequestHandler):
    Serves a MJPEG of the images posted from the vehicle.

    def get(self):

        ioloop = tornado.ioloop.IOLoop.current()
        self.set_header("Content-type", "multipart/x-mixed-replace;boundary=--boundarydonotcross")

        self.served_image_timestamp = time.time()
        my_boundary = "--boundarydonotcross"
        while True:

            interval = .1
            if self.served_image_timestamp + interval < time.time():

                img = util.img.arr_to_binary(self.application.img_arr)

                self.write("Content-type: image/jpeg\r\n")
                self.write("Content-length: %s\r\n\r\n" % len(img))
                self.served_image_timestamp = time.time()
                yield tornado.gen.Task(self.flush)
                yield tornado.gen.Task(ioloop.add_timeout, ioloop.time() + interval)


python file that is remotly work from the script on the master laptop to take the screenshot of the current location and map to process it for autonomus driving in autopilot mode
# import the necessary packages
import pyautogui
import imutils
import time

im = pyautogui.screenshot(region=(600,150, 600, 600))"screenshot"+str(int(time.time()))+".png")


Andrew T.

Andrew T.

8 projects • 14 followers
A Doctor Hobbyist Electronics and Intermediate to advanced Programmer in multiple Fields from web ,mobile and Game Dev to Microcontrollers