summaryrefslogtreecommitdiffhomepage
path: root/logic/tracker.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-10-08 13:45:07 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-10-08 13:45:07 +0200
commit48503f483f29450eca0f5a33381e0b64ef509d80 (patch)
tree4244f578599044a278f48f09e4f3d33c9c148e2b /logic/tracker.cpp
parente2d5245359de0cd419d49b1f3c8e1392c5d9342a (diff)
logic: add extension support
It's missing a dialog and testing.
Diffstat (limited to 'logic/tracker.cpp')
-rw-r--r--logic/tracker.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/logic/tracker.cpp b/logic/tracker.cpp
index 798b2cac..d979b0b2 100644
--- a/logic/tracker.cpp
+++ b/logic/tracker.cpp
@@ -33,8 +33,9 @@ using namespace time_units;
constexpr double Tracker::r2d;
constexpr double Tracker::d2r;
-Tracker::Tracker(Mappings& m, runtime_libraries& libs, TrackLogger& logger) :
+Tracker::Tracker(Mappings& m, runtime_libraries& libs, event_handler& ev, TrackLogger& logger) :
m(m),
+ ev(ev),
libs(libs),
logger(logger),
backlog_time(ns(0)),
@@ -110,6 +111,7 @@ constexpr double Tracker::c_div;
void Tracker::logic()
{
using namespace euler;
+ using EV = event_handler::event_ordinal;
logger.write_dt();
logger.reset_dt();
@@ -121,10 +123,11 @@ void Tracker::logic()
{
Pose tmp;
libs.pTracker->data(tmp);
+ ev.run_events(EV::ev_raw, tmp);
if (get(f_enabled_p) ^ !get(f_enabled_h))
for (int i = 0; i < 6; i++)
- newpose[i] = elide_nan(tmp(i), newpose(i));
+ newpose(i) = elide_nan(tmp(i), newpose(i));
}
Pose value, raw;
@@ -249,6 +252,8 @@ void Tracker::logic()
}
}
+ ev.run_events(EV::ev_before_filter, value);
+
logger.write_pose(value); // "corrected" - after various transformations to account for camera position
nanp |= is_nan(value);
@@ -268,6 +273,8 @@ void Tracker::logic()
nanp |= is_nan(value);
{
+ ev.run_events(EV::ev_before_mapping, value);
+
euler_t neck, rel;
if (s.neck_enable)
@@ -347,6 +354,8 @@ void Tracker::logic()
for (int i = 0; i < 6; i++)
value(i) += m(i).opts.zero * (m(i).opts.invert ? -1 : 1);
+ ev.run_events(EV::ev_finished, value);
+
if (!nanp)
libs.pProtocol->pose(value);