File tree Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Original file line number Diff line number Diff line change 4
4
5
5
leap_ranges = Array (
6
6
Array (
7
- Array ( - 250 , 100 ) ,
8
- Array ( 70 , 550 ) ,
9
- Array ( - 100 , 250 )
7
+ Array ( - 250 , - 70 ) ,
8
+ Array ( 50 , 500 ) ,
9
+ Array ( - 100 , 200 )
10
10
) ,
11
11
Array (
12
- Array ( - 350 , 270 ) ,
13
- Array ( 40 , 550 ) ,
14
- Array ( - 80 , 250 )
12
+ Array ( 40 , 300 ) ,
13
+ Array ( 50 , 500 ) ,
14
+ Array ( - 100 , 200 )
15
15
)
16
16
) ;
17
17
@@ -64,9 +64,19 @@ board.on('ready', function() {
64
64
// extract centre palm position in mm [x,y,z]
65
65
palm [ 0 ] = frame . hands [ 0 ] . palmPosition ;
66
66
palm [ 1 ] = frame . hands [ 1 ] . palmPosition ;
67
+
68
+ // make sure the 0th palm is always the left one
69
+ if ( palm [ 1 ] [ 0 ] < ( palm [ 0 ] [ 0 ] ) ) {
70
+ var newpalm = Array ( ) ;
71
+ newpalm [ 1 ] = palm [ 0 ] ;
72
+ newpalm [ 0 ] = palm [ 1 ] ;
73
+ palm = newpalm ;
74
+ }
67
75
// map x,y,z positions of leap to servos
68
- //console.log("input",palm[0]);
69
76
//console.log("output", palm[0].map(1,2))
77
+ //console.log("left:", palm[0][2]);
78
+ //console.log("right:", palm[1][2]);
79
+
70
80
for ( hand = 0 ; hand < 2 ; hand ++ ) {
71
81
for ( axis = 0 ; axis < 3 ; axis ++ ) {
72
82
servos [ hand ] [ axis ] . to ( palm [ hand ] [ axis ] . map ( hand , axis ) ) ;
You can’t perform that action at this time.
0 commit comments