···507507 // If we only have *one* frame, we just reuse the same bounding box and hope the hand
508508 // hasn't moved too much. @todo
509509510510- HistoryBuffer<Eigen::Array<float, 3, 21>, 5> &hh = hgt->history_hands[hand_idx];
510510+ auto &hh = hgt->history_hands[hand_idx];
511511512512513513 if (hh.size() < 2) {
···974974 );
975975976976 hgt->history_hands[hand_idx].push_back(asf);
977977+ hgt->hand_tracked_for_num_frames[hand_idx]++;
977978 }
978979979980 // More hand-size-optimization spaghetti
···993994 hgt->views[0].regions_of_interest_this_frame[hand_idx].found = false;
994995 hgt->views[1].regions_of_interest_this_frame[hand_idx].found = false;
995996 hgt->history_hands[hand_idx].clear();
997997+ hgt->hand_tracked_for_num_frames[hand_idx] = 0;
996998 }
997999 }
9981000···10121014 }
10131015 }
1014101610171017+ for (int hand_idx = 0; hand_idx < 2; hand_idx++) {
10181018+ // Don't send the hand to OpenXR until it's been tracked for 4 frames
10191019+ if (hgt->hand_tracked_for_num_frames[hand_idx] < hgt->tuneable_values.num_frames_before_display) {
10201020+ out_xrt_hands[hand_idx]->is_active = false;
10211021+ }
10221022+ }
1015102310161024 // If the debug UI is active, push to the frame-timing widget
10171025 u_frame_times_widget_push_sample(&hgt->ft_widget, hgt->current_frame_timestamp);
···1194120211951203 u_var_add_i32(hgt, &hgt->tuneable_values.max_num_outside_view,
11961204 "max allowed number of hand joints outside view");
12051205+ u_var_add_u64(hgt, &hgt->tuneable_values.num_frames_before_display,
12061206+ "Number of frames before we show hands to OpenXR");
12071207+1197120811981209 u_var_add_bool(hgt, &hgt->tuneable_values.scribble_predictions_into_next_frame,
11991210 "Scribble pose-predictions into next frame");
+7-4
src/xrt/tracking/hand/mercury/hg_sync.hpp
···303303 // Used to decide whether to run the keypoint estimator/nonlinear optimizer.
304304 bool this_frame_hand_detected[2] = {false, false};
305305306306- // Used to determine pose-predicted regions of interest. Contains the last five hand keypoint positions, or less
306306+ // Used to determine pose-predicted regions of interest. Contains the last 2 hand keypoint positions, or less
307307 // if the hand has just started being tracked.
308308- HistoryBuffer<Eigen::Array<float, 3, 21>, 5> history_hands[2] = {};
308308+ HistoryBuffer<Eigen::Array<float, 3, 21>, 2> history_hands[2] = {};
309309+310310+ // Contains the last 2 timestamps, or less if hand tracking has just started.
311311+ HistoryBuffer<uint64_t, 2> history_timestamps = {};
309312310310- // Contains the last 5 timestamps, or less if hand tracking has just started.
311311- HistoryBuffer<uint64_t, 5> history_timestamps = {};
313313+ // It'd be a staring contest between your hand and the heat death of the universe!
314314+ uint64_t hand_tracked_for_num_frames[2] = {0, 0};
312315313316314317 // left hand, right hand