Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wheel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
benjamin.sitbon
wheel
Commits
91ee268c
Commit
91ee268c
authored
5 years ago
by
benjamin.sitbon
Browse files
Options
Downloads
Patches
Plain Diff
Terminé
parent
f5a95ca0
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
__pycache__/gamepad.cpython-38.pyc
+0
-0
0 additions, 0 deletions
__pycache__/gamepad.cpython-38.pyc
gamepad.py
+0
-44
0 additions, 44 deletions
gamepad.py
wheel.py
+2
-2
2 additions, 2 deletions
wheel.py
with
2 additions
and
46 deletions
__pycache__/gamepad.cpython-38.pyc
deleted
100644 → 0
+
0
−
0
View file @
f5a95ca0
File deleted
This diff is collapsed.
Click to expand it.
gamepad.py
deleted
100644 → 0
+
0
−
44
View file @
f5a95ca0
# coding: utf-8
import
threading
import
time
import
uinput
class
Gamepad
:
def
__init__
(
self
,
x_min
:
int
=
-
100
,
x_max
:
int
=
100
,
y_min
:
int
=
-
100
,
y_max
:
int
=
100
):
self
.
events
=
(
uinput
.
ABS_X
+
(
x_min
,
x_max
,
0
,
0
),
uinput
.
ABS_Y
+
(
y_min
,
y_max
,
0
,
0
),
)
self
.
x_min
=
x_min
self
.
x_max
=
x_max
self
.
y_min
=
y_min
self
.
y_max
=
y_max
self
.
x_val
=
0
self
.
y_val
=
0
def
pt
(
self
):
with
uinput
.
Device
(
self
.
events
)
as
device
:
while
True
:
device
.
emit
(
uinput
.
ABS_X
,
self
.
x_val
)
device
.
emit
(
uinput
.
ABS_Y
,
self
.
y_val
)
time
.
sleep
(
0.1
)
def
start
(
self
):
threading
.
Thread
(
target
=
self
.
pt
).
start
()
pad
=
Gamepad
()
pad
.
start
()
while
True
:
for
i
in
range
(
10
):
pad
.
x_val
=
i
*
10
time
.
sleep
(
1
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
wheel.py
+
2
−
2
View file @
91ee268c
...
@@ -169,8 +169,8 @@ while True:
...
@@ -169,8 +169,8 @@ while True:
while
(
1
):
while
(
1
):
if
cv2
.
waitKey
(
1
)
&
0xFF
==
ord
(
'
p
'
):
if
cv2
.
waitKey
(
1
)
&
0xFF
==
ord
(
'
p
'
):
break
break
el
if
cv2
.
waitKey
(
1
)
&
0xFF
==
ord
(
'
q
'
):
if
cv2
.
waitKey
(
1
)
&
0xFF
==
ord
(
'
q
'
):
break
exit
()
cap
.
release
()
cap
.
release
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment