-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2abb2a6
Showing
34 changed files
with
1,318 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*,cover | ||
.hypothesis/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# IPython Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# dotenv | ||
.env | ||
|
||
# virtualenv | ||
venv/ | ||
ENV/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
|
||
# Rope project settings | ||
.ropeproject |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Python", | ||
"type": "python", | ||
"request": "launch", | ||
"stopOnEntry": true, | ||
"pythonPath": "${config.python.pythonPath}", | ||
"program": "${file}", | ||
"cwd": "${workspaceRoot}", | ||
"debugOptions": [ | ||
"WaitOnAbnormalExit", | ||
"WaitOnNormalExit", | ||
"RedirectOutput" | ||
] | ||
}, | ||
{ | ||
"name": "PySpark", | ||
"type": "python", | ||
"request": "launch", | ||
"stopOnEntry": true, | ||
"osx": { | ||
"pythonPath": "${env.SPARK_HOME}/bin/spark-submit" | ||
}, | ||
"windows": { | ||
"pythonPath": "${env.SPARK_HOME}/bin/spark-submit.cmd" | ||
}, | ||
"linux": { | ||
"pythonPath": "${env.SPARK_HOME}/bin/spark-submit" | ||
}, | ||
"program": "${file}", | ||
"cwd": "${workspaceRoot}", | ||
"debugOptions": [ | ||
"WaitOnAbnormalExit", | ||
"WaitOnNormalExit", | ||
"RedirectOutput" | ||
] | ||
}, | ||
{ | ||
"name": "Python Module", | ||
"type": "python", | ||
"request": "launch", | ||
"stopOnEntry": true, | ||
"pythonPath": "${config.python.pythonPath}", | ||
"module": "module.name", | ||
"cwd": "${workspaceRoot}", | ||
"debugOptions": [ | ||
"WaitOnAbnormalExit", | ||
"WaitOnNormalExit", | ||
"RedirectOutput" | ||
] | ||
}, | ||
{ | ||
"name": "Integrated Terminal/Console", | ||
"type": "python", | ||
"request": "launch", | ||
"stopOnEntry": true, | ||
"pythonPath": "${config.python.pythonPath}", | ||
"program": "${file}", | ||
"cwd": "null", | ||
"console": "integratedTerminal", | ||
"debugOptions": [ | ||
"WaitOnAbnormalExit", | ||
"WaitOnNormalExit" | ||
] | ||
}, | ||
{ | ||
"name": "External Terminal/Console", | ||
"type": "python", | ||
"request": "launch", | ||
"stopOnEntry": true, | ||
"pythonPath": "${config.python.pythonPath}", | ||
"program": "${file}", | ||
"cwd": "null", | ||
"console": "externalTerminal", | ||
"debugOptions": [ | ||
"WaitOnAbnormalExit", | ||
"WaitOnNormalExit" | ||
] | ||
}, | ||
{ | ||
"name": "Django", | ||
"type": "python", | ||
"request": "launch", | ||
"stopOnEntry": true, | ||
"pythonPath": "${config.python.pythonPath}", | ||
"program": "${workspaceRoot}/manage.py", | ||
"cwd": "${workspaceRoot}", | ||
"args": [ | ||
"runserver", | ||
"--noreload" | ||
], | ||
"debugOptions": [ | ||
"WaitOnAbnormalExit", | ||
"WaitOnNormalExit", | ||
"RedirectOutput", | ||
"DjangoDebugging" | ||
] | ||
}, | ||
{ | ||
"name": "Flask", | ||
"type": "python", | ||
"request": "launch", | ||
"stopOnEntry": false, | ||
"pythonPath": "${config.python.pythonPath}", | ||
"program": "fully qualified path fo 'flask' executable. Generally located along with python interpreter", | ||
"cwd": "${workspaceRoot}", | ||
"env": { | ||
"FLASK_APP": "${workspaceRoot}/quickstart/app.py" | ||
}, | ||
"args": [ | ||
"run", | ||
"--no-debugger", | ||
"--no-reload" | ||
], | ||
"debugOptions": [ | ||
"WaitOnAbnormalExit", | ||
"WaitOnNormalExit", | ||
"RedirectOutput" | ||
] | ||
}, | ||
{ | ||
"name": "Flask (old)", | ||
"type": "python", | ||
"request": "launch", | ||
"stopOnEntry": false, | ||
"pythonPath": "${config.python.pythonPath}", | ||
"program": "${workspaceRoot}/run.py", | ||
"cwd": "${workspaceRoot}", | ||
"args": [], | ||
"debugOptions": [ | ||
"WaitOnAbnormalExit", | ||
"WaitOnNormalExit", | ||
"RedirectOutput" | ||
] | ||
}, | ||
{ | ||
"name": "Watson", | ||
"type": "python", | ||
"request": "launch", | ||
"stopOnEntry": true, | ||
"pythonPath": "${config.python.pythonPath}", | ||
"program": "${workspaceRoot}/console.py", | ||
"cwd": "${workspaceRoot}", | ||
"args": [ | ||
"dev", | ||
"runserver", | ||
"--noreload=True" | ||
], | ||
"debugOptions": [ | ||
"WaitOnAbnormalExit", | ||
"WaitOnNormalExit", | ||
"RedirectOutput" | ||
] | ||
}, | ||
{ | ||
"name": "Attach (Remote Debug)", | ||
"type": "python", | ||
"request": "attach", | ||
"localRoot": "${workspaceRoot}", | ||
"remoteRoot": "${workspaceRoot}", | ||
"port": 3000, | ||
"secret": "my_secret", | ||
"host": "localhost" | ||
} | ||
] | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"python.linting.pylintEnabled": false, | ||
"python.formatting.provider": "yapf" | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2016 穿鞋子的电脑 | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# RaspberryPi | ||
Programming upon it. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -* | ||
|
||
# | ||
# @author XU Kai([email protected]) | ||
# @date 2016-12-04 星期日 | ||
# | ||
# | ||
# | ||
# | ||
# | ||
# | ||
# | ||
|
||
from conf import SERVER | ||
|
||
try: | ||
import RPi.GPIO as GPIO | ||
import atexit | ||
|
||
atexit.register(GPIO.cleanup) | ||
except ImportError: | ||
print('Not the Pi env !') | ||
|
||
import directives | ||
import logging | ||
logging.getLogger('socketIO-client').setLevel(logging.DEBUG) | ||
logging.basicConfig() | ||
|
||
import os, socketIO_client | ||
from socketIO_client import SocketIO, LoggingNamespace | ||
|
||
|
||
def receiveDirectives(args): | ||
directive = args['D'] | ||
if args.has_key('S'): | ||
signal = args['S'] | ||
else: | ||
signal = '' | ||
|
||
global GPIO # Fuck the Global vars cost me severl hours ! :() | ||
try: | ||
GPIO | ||
except NameError: | ||
GPIO = {} | ||
|
||
try: | ||
getattr(__import__('directives.' + directive), directive).run(GPIO, signal) | ||
except ImportError: | ||
print('Directive not found on the CAR !') | ||
|
||
if __name__ == "__main__" : | ||
|
||
socketIO = SocketIO(SERVER['ip'], SERVER['port'], LoggingNamespace, params={'specify': 'CAR'}) | ||
|
||
socketIO.on('directives', receiveDirectives) | ||
socketIO.wait() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -* | ||
|
||
# | ||
# @author XU Kai([email protected]) | ||
# @date 2016-12-04 星期日 | ||
# | ||
# | ||
# @fileOverview 引脚端口的配置文件 | ||
# | ||
# | ||
# | ||
|
||
|
||
PORTS = { | ||
|
||
'CarLeft': [12, 13], | ||
|
||
'CarRight': [15, 16], | ||
|
||
'CameraVertical': 7, | ||
|
||
'CameraHorizontal': 32 | ||
|
||
} | ||
|
||
# Camera init degree as global vars. | ||
DEGREE = { | ||
'vertical': 0, | ||
|
||
'horizontal' : 0 | ||
} | ||
|
||
# Server side address | ||
SERVER = { | ||
'ip': '192.168.199.140', | ||
|
||
'port': '8080' | ||
} |
Oops, something went wrong.