# -*- coding: UTF-8 -*-
import sys
import RPi.GPIO as GPIO
import time
import sys
from steering import Steering
import tornado.ioloop
import tornado.web
import tornado.httpserver
import tornado.options
from tornado.options import define,options
import configparser
import RPi.GPIO as GPIO
from tornado.web import Application, RequestHandler
from tornado.ioloop import IOLoop
from tornado.options import define, options, parse_command_line
from tornado.httpserver import HTTPServer
import os.path
define("port",default=80,type=int)
class Camera:
def __init__(self):
config = configparser.ConfigParser()
config.read("./config.ini")
HIntfNum = config.getint("camera", "HIntfNum")
HInitPosition = config.getint("camera", "HInitPosition")
HMinPosition = config.getint("camera", "HMinPosition")
HMaxPosition = config.getint("camera", "HMaxPosition")
HSpeed = config.getint("camera", "HSpeed")
# Vertical direction control parameters
VIntfNum = config.getint("camera", "VIntfNum")
VInitPosition = config.getint("camera", "VInitPosition")
VMinPosition = config.getint("camera", "VMinPosition")
VMaxPosition = config.getint("camera", "VMaxPosition")
VSpeed = config.getint("camera", "VSpeed")
self.HCameraControl = Steering(HIntfNum, HInitPosition,
HMinPosition, HMaxPosition, HSpeed)
self.VCameraControl = Steering(VIntfNum, VInitPosition,
VMinPosition, VMaxPosition, VSpeed)
def cameraRotate(self,direction):
if direction == "A":
self.HCameraControl.forwardRotation()
elif direction == "D":
self.HCameraControl.reverseRotation()
elif direction == "W":
self.VCameraControl.forwardRotation()
elif direction == "S":
self.VCameraControl.reverseRotation()
elif direction == "Q":
self.HCameraControl.reset()
self.VCameraControl.reset()
else:
print("Your input for camera direction is wrong, please input: D, A, W, S or Q(reset)!")
camera = Camera()
def run(dir):
camera.cameraRotate(dir)
class IndexHandler(tornado.web.RequestHandler):
def get(self):
self.render("index.html",encoding="utf8")
def post(self):
# Horiazonal direction control parameters
arg = self.get_argument('k')
if(arg=='w'):
dir = "W"
run(dir)
elif(arg=='s'):
dir = "S"
run(dir)
elif(arg=='a'):
dir = "A"
run(dir)
elif(arg=='d'):
dir = "D"
run(dir)
elif(arg=='q'):
dir = "Q"
run(dir)
else:
return False
self.write(arg)
if __name__ == '__main__':
tornado.options.parse_command_line()
app = tornado.web.Application(handlers=[(r"/",IndexHandler)],static_path=os.path.join(os.path.dirname(__file__), "static"),)
http_server = tornado.httpserver.HTTPServer(app)
http_server.listen(options.port)
tornado.ioloop.IOLoop.instance().start()
没有合适的资源?快使用搜索试试~ 我知道了~
基于python异步io框架Tornado,实现监控遥控命令与web网页指定按键和鼠标(屏幕)点击事件的绑定.zip

共2个文件
html:1个
py:1个

需积分: 50 9 下载量 49 浏览量
2019-08-08
00:57:38
上传
评论
收藏 3KB ZIP 举报
温馨提示
配套文章:https://dengxj.blog.csdn.net/article/details/98736117 ; 基于python异步io框架Tornado,结合JavaScript的onkeydown事件、 jQuery的mousedown、mouseup、touchstart、touchend事件以及Ajax,实现了监控遥控命令与web网页指定按键和鼠标(屏幕)点击事件的绑定,同时也实现了局域网环境下通过网页对摄像头拍摄角度的控制。
资源推荐
资源详情
资源评论




























收起资源包目录




共 2 条
- 1
资源评论



邓大帅
- 粉丝: 1w+
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- modelcontextprotocol_swift-sdk-Swift资源
- 光纤光缆和通信电缆技术发展与思考.doc
- matlab-Matlab资源
- java工程生成可执行文件.doc
- CSDN技术中心-先人DELPHI基础开发技巧.doc
- 基于遗传算法的计算机网络可靠性优化设计.docx
- 计算机网络操作系统.ppt
- 浅析中等职业学校非计算机专业计算机课程教学的改革.docx
- 互动式教学模式在高中计算机教学中的应用探讨.docx
- MXVideo-Kotlin资源
- 数据库课程实施方案报告——图书馆管理信息系统.doc
- 《软件工程》练习题.docx
- 计算机网络安全技术在企业网的应用与研究①.docx
- 计算机硬件故障维护概要.ppt
- 基于虚拟化技术的网络安全管理的研究与实现.docx
- 使用matlab软件进行三维绘图.ppt
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
