Home › Forums › Legacy SDKs › Analytics SDK (science application)
Tagged: analytics sdk
- This topic has 4 replies, 2 voices, and was last updated 9 years, 7 months ago by alan.
- AuthorPosts
- 11/02/2015 at 22:36 #2520alanParticipant
Hi,
I’ve been playing with the Analytics SDK; the goal is to try to use an X60 tracker to track eye movements as the user moves/zooms/examines digital images, and if possible pass that data to the (Java, unfortunately) application that’s used for viewing and navigating around those images. I’ve just gotten the Python scripts working, I’m just posting to check if I’m on the right path or would be better trying to use the GazeSDK? And has anyone tried interfacing with a Java application before?
25/02/2015 at 13:05 #2607AndersParticipantHi alan,
I’m sorry to say that we don’t have much to offer when it comes to Java support, and it’s not likely to appear in the near future either. So if the Python bindings work for you then I’d suggest that you use them.Our recommendation is to use the Analytics SDK for Tobii Pro products such as the X60.
26/02/2015 at 18:11 #2620alanParticipantThanks for the info Anders, I’d surmised as much from lurking the forums a bit.
Do you think there would be any way to get the Python bindings communicating with a Java app? All we really need are screen X-Y co-ordinates (synced up to X-Y-Z navigation co-ordinates, a la Google Earth or similar), and while it would be feasible to get timestamped eyegaze data and sync that up manually to timestamped X-Y-Z navigation data, it would be messy and much more time consuming. I’m okay with losing platform/OS independence as it will probably only be used on a single computer.
I’ve seen a few posts also about JNI/JNA tunnels using the C++ bindings, do you know if anyone has implemented anything useful? I couldn’t get the C++ examples to compile and run properly and my C++ is weak to non-existant so I’m reluctant to delve into that without a reasonable assurance of success.
05/03/2015 at 14:31 #2661AndersParticipantHi alan,
I think the JNI/JNA route is more accessible than the Python route. But I might be wrong: I don’t know the Python/Java combo well enough.I think the fastest way to get to working code is to use Swig to create a JNI binding. Not for the whole C++ API but for a small subset. Here is a start, based on the tobiictl sample (I actually built it within the tobiictl project):
Wrapper.h (Where the wrapper class is declared)
———————————————–#pragma once #include <string> #include "MainLoopRunner.h" #include "tobii/sdk/cpp/GazeDataItem.hpp" namespace tobii { namespace sdk { namespace cpp { class EyeTracker; } } } namespace wrapper { class EyeTracker { public: static void initLibrary(); EyeTracker(const char *trackerId); virtual ~EyeTracker() {} virtual void onGazeDataReceived(const tobii::sdk::cpp::GazeDataItem& data) { // default implementation does nothing -- override this method to actually do something with the data } tobii::sdk::cpp::error_code_t run(); private: void onGazeDataReceivedTrampoline(tobii::sdk::cpp::GazeDataItem::pointer_t data) { onGazeDataReceived(*data); } private: MainLoopRunner mainLoopRunner_; std::string trackerId_; boost::shared_ptr<tobii::sdk::cpp::EyeTracker> tracker_; }; }
Wrapper.cpp (Implementation of the wrapper class)
————————————————-#include "Wrapper.h" #include "tobii/sdk/cpp/Library.hpp" #include "tobii/sdk/cpp/EyeTrackerBrowserFactory.hpp" #include "tobii/sdk/cpp/EyeTracker.hpp" #include "tobii/sdk/cpp/EyeTrackerException.hpp" using namespace wrapper; void EyeTracker::initLibrary() { tobii::sdk::cpp::Library::init(); } EyeTracker::EyeTracker(const char *trackerId) : trackerId_(trackerId) { mainLoopRunner_.start(); } tobii::sdk::cpp::error_code_t EyeTracker::run() { try { tobii::sdk::cpp::EyeTrackerFactory::pointer_t eyeTrackerFactory = tobii::sdk::cpp::EyeTrackerBrowserFactory::createEyeTrackerFactoryByIpAddressOrHostname(trackerId_, 0, 0); tracker_ = eyeTrackerFactory->createEyeTracker(mainLoopRunner_.getMainLoop()); tracker_->addGazeDataReceivedListener(boost::bind(&EyeTracker::onGazeDataReceivedTrampoline, this, _1)); tracker_->startTracking(); } catch (tobii::sdk::cpp::EyeTrackerException& ex) { return ex.getErrorCode(); } }
And finally the Swig interface file, wrapper.i
———————————————-// enable directors for cross-language polymorphism %module(directors="1") TobiiAnalyticsSdkModule %{ %include "Samples/tobiictl/Wrapper.h" %} %include <typemaps.i> // generate directors for all virtual methods in the EyeTracker class. %feature("director") EyeTracker; %apply int { tobii::sdk::cpp::error_code_t } %include "enums.swg" %include "Samples/tobiictl/Wrapper.h" %include "Include/tobii/sdk/cpp/GazeDataItem.hpp"
I have to admit it’s not super easy to get this up and running, but it’s certainly possible.
05/03/2015 at 19:01 #2667alanParticipantThanks very much Anders, I’m hoping to find a workaround for this as it may kill me but I really appreciate the help!
- AuthorPosts
- You must be logged in to reply to this topic.