Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
EV3WebController
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Science Festival 2015
EV3WebController
Commits
3e947ebf
Unverified
Commit
3e947ebf
authored
Oct 31, 2015
by
Cédric Bonhomme
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Detect if we are running as root on the EV3.
parent
04c35974
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
10 deletions
+10
-10
CHANGELOG.md
CHANGELOG.md
+3
-0
bootstrap.py
bootstrap.py
+3
-0
web/__init__.py
web/__init__.py
+2
-4
web/views/views.py
web/views/views.py
+2
-6
No files found.
CHANGELOG.md
View file @
3e947ebf
EV3WebController project news
0.
3 (2015-10-31)
*
detect if we are running on the EV3 as root;
0.
2 (2015-10-29)
*
Beta release. It is possible to control the robot in four directions;
*
minor improvements and bug fixed.
...
...
bootstrap.py
View file @
3e947ebf
...
...
@@ -15,6 +15,9 @@
Required imports and code execution for basic functionning.
"""
import
os
if
os
.
geteuid
()
!=
0
:
raise
Exception
(
'You must run the application as root on the EV3.'
)
import
sys
if
'threading'
in
sys
.
modules
:
raise
Exception
(
'threading module loaded before patching!'
)
...
...
web/__init__.py
View file @
3e947ebf
...
...
@@ -13,7 +13,6 @@
import
os
from
flask
import
Flask
#from ev3.ev3dev import Ev3Dev
from
ev3.ev3dev
import
Key
,
Motor
from
ev3.lego
import
LargeMotor
from
ev3.lego
import
TouchSensor
...
...
@@ -28,7 +27,6 @@ app.debug = True
# Create a random secrey key so we can use sessions
app
.
config
[
'SECRET_KEY'
]
=
os
.
urandom
(
12
)
#Ev3Dev.__init__()
#head = None#Motor(port=Motor.PORT.A)
right_wheel
=
None
left_wheel
=
None
...
...
@@ -39,7 +37,7 @@ try:
left_wheel
=
Motor
(
port
=
Motor
.
PORT
.
C
)
button
=
TouchSensor
()
ir_sensor
=
InfraredSensor
()
except
Exception
:
print
(
"You must run the application as root on the EV3."
)
except
Exception
as
e
:
raise
Exception
(
'You must run the application on the EV3.'
)
from
web
import
views
web/views/views.py
View file @
3e947ebf
...
...
@@ -11,9 +11,9 @@
# ***** END LICENSE BLOCK *****
__author__
=
"Cedric Bonhomme"
__version__
=
"$Revision: 0.
2
$"
__version__
=
"$Revision: 0.
3
$"
__date__
=
"$Date: 2014/12/15$"
__revision__
=
"$Date: 2015/10/
29
$"
__revision__
=
"$Date: 2015/10/
31
$"
__copyright__
=
"Copyright (c) 2014-2015 Cédric BOnhomme"
__license__
=
""
...
...
@@ -47,10 +47,6 @@ def load_user(id):
# Return an instance of the User model
return
models
.
User
.
objects
(
id
=
id
).
first
()
@
app
.
before_request
def
before_request
():
g
.
user
=
current_user
@
app
.
route
(
'/move/<direction>'
,
methods
=
[
'GET'
])
@
app
.
route
(
'/move/<direction>/<speed>'
,
methods
=
[
'GET'
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment