mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-02-06 22:08:09 +00:00
d/ht: Fix header and usages of helpers
This commit is contained in:
parent
acc9683e0f
commit
5b8c869b56
src/xrt/drivers/ht
|
@ -41,17 +41,17 @@ htProcessJoint(struct ht_device *htd,
|
|||
}
|
||||
|
||||
static float
|
||||
errHistory2D(HandHistory2DBBox *past, Palm7KP *present)
|
||||
errHistory2D(const HandHistory2DBBox &past, const Palm7KP &present)
|
||||
{
|
||||
if (!past->htAlgorithm_approves) {
|
||||
if (!past.htAlgorithm_approves) {
|
||||
// U_LOG_E("Returning big number because htAlgorithm told me to!");
|
||||
return 100000000000000000000000000000.0f;
|
||||
}
|
||||
float sum_of_lengths = m_vec2_len(past->wrist_unfiltered.back() - past->middle_unfiltered.back()) +
|
||||
m_vec2_len(present->kps[WRIST_7KP] - present->kps[MIDDLE_7KP]);
|
||||
float sum_of_lengths = m_vec2_len(past.wrist_unfiltered.back() - past.middle_unfiltered.back()) +
|
||||
m_vec2_len(present.kps[WRIST_7KP] - present.kps[MIDDLE_7KP]);
|
||||
|
||||
float sum_of_distances = (m_vec2_len(past->wrist_unfiltered.back() - present->kps[WRIST_7KP]) +
|
||||
m_vec2_len(past->middle_unfiltered.back() - present->kps[MIDDLE_7KP]));
|
||||
float sum_of_distances = (m_vec2_len(past.wrist_unfiltered.back() - present.kps[WRIST_7KP]) +
|
||||
m_vec2_len(past.middle_unfiltered.back() - present.kps[MIDDLE_7KP]));
|
||||
|
||||
|
||||
float final = sum_of_distances / sum_of_lengths;
|
||||
|
@ -499,7 +499,7 @@ htRunAlgorithm(struct ht_device *htd)
|
|||
cur_hand.idx_r = idx_r;
|
||||
|
||||
// Calculate a y-disparity for this combination
|
||||
cur_hand.y_disparity_error = errHandDisparity(&left_2d, &right_2d);
|
||||
cur_hand.y_disparity_error = errHandDisparity(left_2d, right_2d);
|
||||
|
||||
possible_3d_hands.push_back(cur_hand);
|
||||
}
|
||||
|
@ -517,7 +517,7 @@ htRunAlgorithm(struct ht_device *htd)
|
|||
// See if this pair is suspiciously close together.
|
||||
// If it is, then this pairing is wrong - this is what was causing the "hands smushing together"
|
||||
// issue - we weren't catching these reliably.
|
||||
float errr = sumOfHandJointDistances(&possible_3d_hands[idx_one], &possible_3d_hands[idx_two]);
|
||||
float errr = sumOfHandJointDistances(possible_3d_hands[idx_one], possible_3d_hands[idx_two]);
|
||||
HT_TRACE(htd, "%zu %zu is smush %f", idx_one, idx_two, errr);
|
||||
if (errr < 0.03f * 21.0f) {
|
||||
possible_3d_hands[idx_one].rejected_by_smush = true;
|
||||
|
|
|
@ -346,7 +346,7 @@ handEuroFiltersRun(struct ht_device *htd, HandHistory3D *f, Hand3D *out_hand)
|
|||
dt = (double)(ts - f->prev_ts_for_alpha) / U_TIME_1S_IN_NS;
|
||||
|
||||
double abs_dy =
|
||||
(sumOfHandJointDistances(&f->last_hands_unfiltered.back(), &f->last_hands_filtered.back()) / 21.0f) * 0.7f;
|
||||
(sumOfHandJointDistances(f->last_hands_unfiltered.back(), f->last_hands_filtered.back()) / 21.0f) * 0.7f;
|
||||
alpha_d = calc_smoothing_alpha(htd->dynamic_config.hand_fc_min_d.val, dt);
|
||||
|
||||
double alpha, fc_cutoff;
|
||||
|
|
|
@ -17,12 +17,12 @@ struct ht_device;
|
|||
struct xrt_hand_joint_set;
|
||||
|
||||
float
|
||||
sumOfHandJointDistances(Hand3D *one, Hand3D *two);
|
||||
sumOfHandJointDistances(const Hand3D &one, const Hand3D &two);
|
||||
|
||||
float
|
||||
errHandHistory(HandHistory3D *history_hand, Hand3D *present_hand);
|
||||
errHandHistory(const HandHistory3D &history_hand, const Hand3D &present_hand);
|
||||
float
|
||||
errHandDisparity(Hand2D *left_rays, Hand2D *right_rays);
|
||||
errHandDisparity(const Hand2D &left_rays, const Hand2D &right_rays);
|
||||
|
||||
void
|
||||
applyJointWidths(struct xrt_hand_joint_set *set);
|
||||
|
|
|
@ -49,7 +49,7 @@ naive_sort_permutation_by_error(
|
|||
std::vector<size_t> &out_indices_2,
|
||||
std::vector<float> &out_errs,
|
||||
|
||||
float (*calc_error)(Tp_1 *one, Tp_2 *two),
|
||||
float (*calc_error)(const Tp_1 &one, const Tp_2 &two),
|
||||
float max_err = std::numeric_limits<float>::max())
|
||||
{
|
||||
used_1 = std::vector<bool>(in_1.size()); // silly? Unsure.
|
||||
|
@ -64,7 +64,7 @@ naive_sort_permutation_by_error(
|
|||
|
||||
for (size_t idx_1 = 0; idx_1 < in_1.size(); idx_1++) {
|
||||
for (size_t idx_2 = 0; idx_2 < in_2.size(); idx_2++) {
|
||||
float err = calc_error(&in_1[idx_1], &in_2[idx_2]);
|
||||
float err = calc_error(in_1[idx_1], in_2[idx_2]);
|
||||
if (err > 0.0f) {
|
||||
// Negative error means the error calculator thought there was something so bad with
|
||||
// these that they shouldn't be considered at all.
|
||||
|
|
Loading…
Reference in a new issue