This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| import pickle | |
| import time | |
| from matplotlib import style | |
| from GridEnvironment import GridEnvironment | |
| import re | |
| import argparse | |
| import pandas as pd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| from scipy.spatial import distance | |
| from PIL import Image, ImageDraw, ImageFont | |
| import cv2 | |
| import time | |
| class BaseBlob: | |
| game_blobs = [] | |
| wall_blobs = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import datetime | |
| # https://docs.aws.amazon.com/lambda/latest/dg/services-rds-tutorial.html | |
| # pip install sshtunnel | |
| from sshtunnel import SSHTunnelForwarder | |
| # pip install pymysql | |
| import pymysql as db | |
| import logging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if __name__ == '__main__': | |
| signal.signal(signal.SIGINT, signal_handler) | |
| signal.signal(signal.SIGTERM, signal_handler) | |
| run_pid = True | |
| track_face = True # True - cause the Tello to start to track/follow a face | |
| save_video = True | |
| fly = True | |
| parent_conn, child_conn = Pipe() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def show_video(exit_event, pipe_conn): | |
| signal.signal(signal.SIGINT, signal_handler) | |
| signal.signal(signal.SIGTERM, signal_handler) | |
| while True: | |
| frame = pipe_conn.recv() | |
| # display the frame to the screen | |
| cv2.imshow("Drone Face Tracking", frame) | |
| cv2.waitKey(1) | |
| if cv2.waitKey(1) & 0xFF == ord('q'): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def video_recorder(pipe_conn, save_video, height=300, width=400): | |
| global video_writer | |
| # create a VideoWrite object, recoring to ./video.avi | |
| signal.signal(signal.SIGINT, signal_handler) | |
| signal.signal(signal.SIGTERM, signal_handler) | |
| if video_writer is None and save_video == True: | |
| video_file = f"video_{datetime.now().strftime('%d-%m-%Y_%I-%M-%S_%p')}.mp4" | |
| video_writer = cv2.VideoWriter(video_file, cv2.VideoWriter_fourcc(*'MP4V'), 30, (width, height)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from djitellopy import Tello | |
| import time | |
| # see: https://github.com/damiafuentes/DJITelloPy | |
| print("Create Tello object") | |
| tello = Tello() | |
| print("Connect to Tello Drone") | |
| tello.connect() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def track_face_in_video_feed(exit_event, show_video_conn, video_writer_conn, run_pid, track_face, fly=False, | |
| max_speed_limit=40): | |
| """ | |
| :param exit_event: Multiprocessing Event. When set, this event indicates that the process should stop. | |
| :type exit_event: | |
| :param show_video_conn: Pipe to send video frames to the process that will show the video | |
| :type show_video_conn: multiprocessing Pipe | |
| :param video_writer_conn: Pipe to send video frames to the process that will save the video frames | |
| :type video_writer_conn: multiprocessing Pipe |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "path": "/ride", | |
| "httpMethod": "POST", | |
| "headers": { | |
| "Accept": "*/*", | |
| "Authorization": "eyJraWQiOiJLTzRVMWZs", | |
| "content-type": "application/json; charset=UTF-8" | |
| }, | |
| "queryStringParameters": null, | |
| "pathParameters": null, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| POST https://XXX.execute-api.us-east-1.amazonaws.com/test/add-note | |
| Content-Type: application/json | |
| token: eyJraLVmJHQ2JXVjIwdzFxcXNOUHlqb0ZoYXUxTWZTK2k0PSIsThisTokenIsNotValidButItWasWhenWeTested | |
| {"note":"Bring home milk"} | |
| ### | |
| POST https://XXX.execute-api.us-east-1.amazonaws.com/test/add-note |