LeiaSR SDK 720218b2 v1.32.7.6322 2025-02-13T14:55:38Z
Stable
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Example C++

1
5#include "sr/types.h"
9#include <iostream>
10
11SR_point3d myPoint{ 0.0, 1.0, 2.0 };
12
13class MyListener : public SR::HandPoseListener {
14public:
16 // Inherited via HandPoseListener
17 virtual void accept(const SR_handPose& handpose) override
18 {
19 std::cout << handpose.palm.x << "\n";
20 }
21};
22
23int main() {
24 SR::SRContext context;
25 SR::HandTracker* handTracker = SR::HandTracker::create(context);
26 MyListener listener;
27 listener.inputStream.set(handTracker->openHandPoseStream(&listener));
28 context.initialize();
29
30 char c;
31 std::cin >> c;
32}
Interface for listening to SR_handPose updates.
Definition: handposelistener.h:34
virtual void accept(const SR_handPose &handPose)=0
Accept an SR_handPose frame.
Sense class which provides hand tracking functionality to the SR system.
Definition: handtracker.h:41
virtual std::shared_ptr< HandPoseStream > openHandPoseStream(HandPoseListener *listener)=0
Creates a HandPoseStream for listener to be connected to.
static HandTracker * create(SRContext &context)
Creates a functional HandTracker instance.
Template class to wrap data stream to a listener object.
Definition: inputstream.h:20
Maintains WorldObject and Sense objects during the application lifetime.
Definition: srcontext.h:75
void initialize()
Initialize all senses.
C-compatible struct containing the pose of a hand.
Definition: handpose.h:119
SR_point3d palm
Absolute position of the center of the palm.
Definition: handpose.h:127
C-compatible 3d double vector representation.
Definition: types.h:73
double x
First value in the 3d vector.
Definition: types.h:76