Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
crazyflie-clients-python
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
Container registry
Model registry
Operate
Environments
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
Lukas Wegmann
crazyflie-clients-python
Commits
1c52c0c3
Commit
1c52c0c3
authored
11 years ago
by
Marcus Eliasson
Browse files
Options
Downloads
Patches
Plain Diff
More tuning
parent
10437bbd
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/cfclient/utils/leapreader.py
+12
-11
12 additions, 11 deletions
lib/cfclient/utils/leapreader.py
with
12 additions
and
11 deletions
lib/cfclient/utils/leapreader.py
+
12
−
11
View file @
1c52c0c3
...
...
@@ -50,10 +50,10 @@ class LeapListener(leapmotion.Leap.Listener):
logger
.
info
(
"
Connected
"
)
# Enable gestures
controller
.
enable_gesture
(
leapmotion
.
Leap
.
Gesture
.
TYPE_CIRCLE
);
controller
.
enable_gesture
(
leapmotion
.
Leap
.
Gesture
.
TYPE_KEY_TAP
);
controller
.
enable_gesture
(
leapmotion
.
Leap
.
Gesture
.
TYPE_SCREEN_TAP
);
controller
.
enable_gesture
(
leapmotion
.
Leap
.
Gesture
.
TYPE_SWIPE
);
#
controller.enable_gesture(leapmotion.Leap.Gesture.TYPE_CIRCLE);
#
controller.enable_gesture(leapmotion.Leap.Gesture.TYPE_KEY_TAP);
#
controller.enable_gesture(leapmotion.Leap.Gesture.TYPE_SCREEN_TAP);
#
controller.enable_gesture(leapmotion.Leap.Gesture.TYPE_SWIPE);
def
on_disconnect
(
self
,
controller
):
# Note: not dispatched when running in a debugger.
...
...
@@ -72,21 +72,22 @@ class LeapListener(leapmotion.Leap.Listener):
# Get the first hand
hand
=
frame
.
hands
[
0
]
# Get the hand's normal vector and direction
normal
=
hand
.
palm_normal
direction
=
hand
.
direction
#
Calculate the hand's pitch,
roll
,
a
nd yaw angles
pitch
=
direction
.
pitch
*
leapmotion
.
Leap
.
RAD_TO_DEG
/
45.0
roll
=
normal
.
roll
*
leapmotion
.
Leap
.
RAD_TO_DEG
/
45.0
yaw
=
0
#
direction.yaw * leapmotion.Leap.RAD_TO_DEG /
45
.0
thrust
=
(
hand
.
palm_position
[
1
]
-
10
0
)
/
200.0
# Use the elevation of the hand for thrust
#
Pich and
roll a
re mixed up...
roll
=
-
direction
.
pitch
*
leapmotion
.
Leap
.
RAD_TO_DEG
/
45.0
pitch
=
-
normal
.
roll
*
leapmotion
.
Leap
.
RAD_TO_DEG
/
45.0
yaw
=
direction
.
yaw
*
leapmotion
.
Leap
.
RAD_TO_DEG
/
90
.0
thrust
=
(
hand
.
palm_position
[
1
]
-
5
0
)
/
200.0
# Use the elevation of the hand for thrust
if
thrust
<
0.0
:
thrust
=
0.0
;
if
thrust
>
1.0
:
thrust
=
1.0
if
(
len
(
hand
.
fingers
)
<
5
):
# Protect against accidental readings. When tilting the had
# fingers are sometimes lost so only use 4.
if
(
len
(
hand
.
fingers
)
<
4
):
self
.
_dcb
(
0
,
0
,
0
,
0
)
else
:
self
.
_dcb
(
pitch
,
roll
,
yaw
,
thrust
)
...
...
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