text stringlengths 1 93.6k |
|---|
hsv = cv2.cvtColor(minimap, cv2.COLOR_RGB2HSV)
|
mask = cv2.inRange(hsv, lower, upper)
|
matches = np.argwhere(mask==255)
|
mean_y = np.mean(matches[:,1])
|
target = minimap.shape[1]/2
|
error = target - mean_y
|
print(error)
|
keys.directMouse(-1*int(error*3), 0)
|
cv2.imshow("cv2screen", mask)
|
cv2.waitKey(10)
|
for i in range(5):
|
print(i)
|
time.sleep(1)
|
keys.directKey("w")
|
# run for just 100 frames.
|
for i in range(100):
|
screen = grab_screen(region=(1280, 0, 3840, 1440)) # region will vary depending on game resolution and monitor resolution
|
screen = cv2.cvtColor(screen, cv2.COLOR_BGR2RGB) # because default will be BGR
|
minimap = screen[81:377, 2181:2469]
|
miniminimap = screen[185:215, 2290:2358]
|
pathing(miniminimap)
|
#screen = cv2.resize(screen, (960,540))
|
#cv2.imshow("cv2screen", screen)
|
#cv2.waitKey(10)
|
keys.directKey("w", keys.key_release)
|
cv2.destroyAllWindows()
|
# <FILESEP>
|
#!/usr/bin/env python3
|
"""
|
List all Cozmo animations on a web page with buttons to try the animations.
|
In order to run this script, you also need all the other files inside the project.
|
If that is the case, running this script will load the interface.
|
Created by: GrinningHermit
|
"""
|
import datetime
|
import os
|
import queue
|
import random
|
import logging
|
from flask import Flask, render_template
|
import flask_socket_helpers
|
import cozmo
|
import event_monitor
|
from viewer import viewer, activate_viewer_if_enabled
|
from remote_control import remote_control, activate_controls
|
from animate import animate, init_animate
|
# logging.basicConfig(format='%(asctime)s animation explorer %(levelname)s %(message)s', level=print)
|
flask_socketio_installed = False
|
try:
|
from flask_socketio import SocketIO, emit, disconnect
|
flask_socketio_installed = True
|
except ImportError:
|
logging.warning('Cannot import from flask_socketio: Do `pip3 install --user flask-socketio` to install\nProgram runs without flask_socketio, but without event monitoring')
|
eventlet_installed = False
|
try:
|
import eventlet
|
eventlet_installed = True
|
except ImportError:
|
logging.warning('Cannot import from eventlet: Do `pip3 install --user eventlet` to install\nEvent monitoring works, but performance is decreased')
|
thread = None
|
robot = None
|
cozmoEnabled = True
|
active_viewer = False
|
lists = []
|
async_mode = 'threading'
|
app = Flask(__name__)
|
app.config['SECRET_KEY'] = 'secret!'
|
app.register_blueprint(viewer)
|
app.register_blueprint(remote_control)
|
app.register_blueprint(animate)
|
rndID = random.randrange(1000000000, 9999999999)
|
q = queue.Queue()
|
abspath = os.path.abspath(__file__)
|
dname = os.path.dirname(abspath)
|
os.chdir(dname)
|
if flask_socketio_installed:
|
socketio = SocketIO(app, async_mode=async_mode)
|
# Functions for event monitoring
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.