Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
thk_LeapControlNode
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
thk_libs
ROS_1
thk_LeapControlNode
Commits
67548ad4
Commit
67548ad4
authored
3 years ago
by
Hannes Tiltmann
Browse files
Options
Downloads
Patches
Plain Diff
new frontend for py3
parent
91f1488d
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
custom_py3/example.py
+6
-0
6 additions, 0 deletions
custom_py3/example.py
custom_py3/leap.py
+41
-0
41 additions, 0 deletions
custom_py3/leap.py
with
48 additions
and
0 deletions
.gitignore
0 → 100644
+
1
−
0
View file @
67548ad4
__pycache__
\ No newline at end of file
This diff is collapsed.
Click to expand it.
custom_py3/example.py
0 → 100644
+
6
−
0
View file @
67548ad4
from
leap
import
LeapController
l
=
LeapController
(
"
127.0.0.1
"
,
logging
=
True
)
l
.
run
()
input
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
custom_py3/leap.py
0 → 100644
+
41
−
0
View file @
67548ad4
import
websocket
import
_thread
import
json
class
LeapController
:
def
__init__
(
self
,
ip
:
str
,
logging
:
bool
=
False
):
self
.
ws
=
websocket
.
WebSocketApp
(
"
ws://
"
+
ip
+
"
:6437
"
)
self
.
ws
.
on_open
=
self
.
__on_open
self
.
ws
.
on_close
=
self
.
__on_close
self
.
ws
.
on_message
=
self
.
__on_message
self
.
logging
=
logging
def
__on_open
(
self
,
ws
):
if
self
.
logging
:
print
(
"
jey, connected to leap
"
)
def
__on_close
(
self
,
ws
,
status
,
message
):
if
self
.
logging
:
print
(
"
autsch, disconnected from leap
"
)
def
__on_message
(
self
,
ws
,
m
):
self
.
frame
=
json
.
loads
(
m
)
if
self
.
logging
:
print
(
"
wow, new frame
"
)
for
h
in
self
.
frame
[
"
hands
"
]:
print
(
json
.
dumps
(
h
[
"
t
"
],
indent
=
3
))
def
close
(
self
):
self
.
ws
.
close
()
def
run
(
self
,
blocking
=
False
):
def
eventloop
():
try
:
self
.
ws
.
run_forever
()
finally
:
self
.
ws
.
close
()
if
not
blocking
:
_thread
.
start_new_thread
(
eventloop
,())
return
eventloop
()
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