Skip to content

Commit

Permalink
Add Rotation and Grab angle
Browse files Browse the repository at this point in the history
Added hand rotation and grab angle in radiants to the osc output.
  • Loading branch information
NiccoloGranieri committed Nov 11, 2018
1 parent fdca09f commit 8397e03
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
11 changes: 8 additions & 3 deletions Source/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
#include "../JuceLibraryCode/JuceHeader.h"
#include "ReachLookAndFeel.h"
#include "MainComponent.h"
#include "LeapLogger.h"

// Commented out logging feature to avoid filling Desktop with log files.
// #include "LeapLogger.h"

//==============================================================================
class ReachApplication : public JUCEApplication
Expand Down Expand Up @@ -39,7 +41,8 @@ class ReachApplication : public JUCEApplication
{
mainWindow = nullptr;

Logger::setCurrentLogger(nullptr);
// Commented out logger
// Logger::setCurrentLogger(nullptr);
}

//==============================================================================
Expand Down Expand Up @@ -78,7 +81,9 @@ class ReachApplication : public JUCEApplication
private:

std::unique_ptr<MainWindow> mainWindow;
LeapLogger logger;

// Commented out logger
// LeapLogger logger;

ReachLookAndFeel LAF;
};
Expand Down
14 changes: 13 additions & 1 deletion Source/MainComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
MainComponent.cpp
Created: 18 Jan 2018 2:04:28pm
Author: Niccolò
Author: Niccolò
==============================================================================
*/
Expand Down Expand Up @@ -126,6 +126,18 @@ void MainContentComponent::timerCallback()
oscWrist.addFloat32(hand.wristPosition().z);
sender.send(oscWrist);

OSCMessage oscGrab = OSCMessage(handedness + "/grab");
oscGrab.addFloat32(hand.grabAngle());
sender.send(oscGrab);

OSCMessage oscRotation = OSCMessage(handedness + "/rotation");
oscRotation.addFloat32(hand.palmNormal().x);
oscRotation.addFloat32(hand.palmNormal().y);
oscRotation.addFloat32(hand.palmNormal().z);
sender.send(oscRotation);



for (auto& finger : hand.fingers())
{
for (auto i = 0; i <= 3; i++)
Expand Down
2 changes: 1 addition & 1 deletion Source/MainComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
MainComponent.h
Created: 18 Jan 2018 2:04:28pm
Author: Niccolò
Author: Niccolò
==============================================================================
*/
Expand Down

0 comments on commit 8397e03

Please sign in to comment.