mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 04:36:07 +00:00
a/math: Improve word choice/clarity
This commit is contained in:
parent
56a1c25378
commit
2a54dcdb19
|
@ -2,7 +2,7 @@
|
|||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
* @brief Header with just documentation.
|
||||
* @brief Header with only documentation.
|
||||
* @author Ryan Pavlik <ryan.pavlik@collabora.com>
|
||||
* @ingroup aux_math
|
||||
*/
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
* @brief A fifo that also allows you to dynamically filter.
|
||||
* @brief A fifo that also lets you dynamically filter.
|
||||
* @author Jakob Bornecrantz <jakob@collabora.com>
|
||||
* @ingroup aux_math
|
||||
*/
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
* @brief A fifo that also allows you to dynamically filter.
|
||||
* @brief A fifo that also lets you dynamically filter.
|
||||
* @author Jakob Bornecrantz <jakob@collabora.com>
|
||||
* @ingroup aux_math
|
||||
*/
|
||||
|
@ -94,8 +94,7 @@ void
|
|||
m_ff_f64_push(struct m_ff_f64 *ff, const double *sample, uint64_t timestamp_ns);
|
||||
|
||||
/*!
|
||||
* Return the sample at the index, zero means the last sample push, one second
|
||||
* last and so on.
|
||||
* Return the sample at the index, 0 means the last sample push, 1 second-to-last, etc.
|
||||
*/
|
||||
bool
|
||||
m_ff_f64_get(struct m_ff_f64 *ff, size_t num, double *out_sample, uint64_t *out_timestamp_ns);
|
||||
|
|
|
@ -197,7 +197,8 @@ m_filter_euro_vec2_run_no_commit(struct m_filter_euro_vec2 *f,
|
|||
{
|
||||
|
||||
if (filter_one_euro_handle_first_sample(&f->base, ts, false)) {
|
||||
// First sample - no filtering yet - and we're not committing anything to the filter so just return
|
||||
// First sample - no filtering yet - and we're not committing anything to the filter so return right
|
||||
// away
|
||||
*out_y = *in_y;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ struct m_imu_pre_filter
|
|||
};
|
||||
|
||||
/*!
|
||||
* A simple init function that just takes the two ticks_to_float values, all
|
||||
* A simple init function that takes the two ticks_to_float values, all
|
||||
* other values are set to identity.
|
||||
*/
|
||||
void
|
||||
|
|
|
@ -51,7 +51,7 @@ void
|
|||
m_lowpass_float_add_sample(struct m_lowpass_float *mlf, float sample, timepoint_ns timestamp_ns);
|
||||
|
||||
/*!
|
||||
* Access the filtered value.
|
||||
* Get the filtered value.
|
||||
*
|
||||
* Probably 0 or other meaningless value if it's not initialized: see @ref m_lowpass_float_is_initialized
|
||||
*
|
||||
|
@ -63,7 +63,7 @@ float
|
|||
m_lowpass_float_get_state(const struct m_lowpass_float *mlf);
|
||||
|
||||
/*!
|
||||
* Access the time of last update
|
||||
* Get the time of last update
|
||||
*
|
||||
* @param mlf self-pointer
|
||||
*
|
||||
|
@ -73,7 +73,7 @@ timepoint_ns
|
|||
m_lowpass_float_get_timestamp_ns(const struct m_lowpass_float *mlf);
|
||||
|
||||
/*!
|
||||
* Access whether we have initialized state.
|
||||
* Get whether we have initialized state.
|
||||
*
|
||||
* @param mlf self-pointer
|
||||
*
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace detail {
|
|||
* blocked.
|
||||
*
|
||||
* @param val The value to initialize the filter with. Does not
|
||||
* affect the filter itself: only seen if you access state
|
||||
* affect the filter itself: only seen if you get state
|
||||
* before initializing the filter with the first sample.
|
||||
*/
|
||||
explicit LowPassIIR(Scalar cutoff_hz, Value const &val) noexcept
|
||||
|
@ -53,7 +53,7 @@ namespace detail {
|
|||
{}
|
||||
|
||||
/*!
|
||||
* Reset the filter to just-created state.
|
||||
* Reset the filter to newly-created state.
|
||||
*/
|
||||
void
|
||||
reset(Value const &val) noexcept
|
||||
|
@ -122,7 +122,7 @@ public:
|
|||
|
||||
|
||||
/*!
|
||||
* Reset the filter to just-created state.
|
||||
* Reset the filter to newly-created state.
|
||||
*/
|
||||
void
|
||||
reset() noexcept
|
||||
|
@ -146,7 +146,7 @@ public:
|
|||
}
|
||||
|
||||
/*!
|
||||
* Access the filtered value.
|
||||
* Get the filtered value.
|
||||
*/
|
||||
Scalar
|
||||
getState() const noexcept
|
||||
|
@ -155,7 +155,7 @@ public:
|
|||
}
|
||||
|
||||
/*!
|
||||
* Access the time of last update.
|
||||
* Get the time of last update.
|
||||
*/
|
||||
timepoint_ns
|
||||
getTimestampNs() const noexcept
|
||||
|
@ -164,7 +164,7 @@ public:
|
|||
}
|
||||
|
||||
/*!
|
||||
* Access whether we have initialized state.
|
||||
* Get whether we have initialized state.
|
||||
*/
|
||||
bool
|
||||
isInitialized() const noexcept
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
|
||||
|
||||
/*!
|
||||
* Reset the filter to just-created state.
|
||||
* Reset the filter to newly-created state.
|
||||
*/
|
||||
void
|
||||
reset() noexcept
|
||||
|
@ -68,7 +68,7 @@ public:
|
|||
}
|
||||
|
||||
/*!
|
||||
* Access the filtered value.
|
||||
* Get the filtered value.
|
||||
*/
|
||||
Vector const &
|
||||
getState() const noexcept
|
||||
|
@ -77,7 +77,7 @@ public:
|
|||
}
|
||||
|
||||
/*!
|
||||
* Access the time of last update.
|
||||
* Get the time of last update.
|
||||
*/
|
||||
std::uint64_t
|
||||
getTimestampNs() const noexcept
|
||||
|
@ -86,7 +86,7 @@ public:
|
|||
}
|
||||
|
||||
/*!
|
||||
* Access whether we have initialized state.
|
||||
* Get whether we have initialized state.
|
||||
*/
|
||||
bool
|
||||
isInitialized() const noexcept
|
||||
|
|
|
@ -53,7 +53,7 @@ void
|
|||
m_lowpass_integer_add_sample(struct m_lowpass_integer *mli, int64_t sample);
|
||||
|
||||
/*!
|
||||
* Access the filtered value.
|
||||
* Get the filtered value.
|
||||
*
|
||||
* Probably 0 or other meaningless value if it's not initialized: see @ref m_lowpass_integer_is_initialized
|
||||
*
|
||||
|
@ -65,7 +65,7 @@ int64_t
|
|||
m_lowpass_integer_get_state(const struct m_lowpass_integer *mli);
|
||||
|
||||
/*!
|
||||
* Access whether we have initialized state.
|
||||
* Get whether we have initialized state.
|
||||
*
|
||||
* @param mli self-pointer
|
||||
*
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace detail {
|
|||
* more influence from new input. @p alpha_.isBetweenZeroAndOne() must be true.
|
||||
*
|
||||
* @param val The value to initialize the filter with. Does not
|
||||
* affect the filter itself: only seen if you access state
|
||||
* affect the filter itself: only seen if you get the state
|
||||
* before initializing the filter with the first sample.
|
||||
*/
|
||||
explicit IntegerLowPassIIR(math::Rational<Scalar> alpha_, Value const &val)
|
||||
|
@ -56,7 +56,7 @@ namespace detail {
|
|||
}
|
||||
|
||||
/*!
|
||||
* Reset the filter to just-created state.
|
||||
* Reset the filter to newly-created state.
|
||||
*/
|
||||
void
|
||||
reset(Value const &val) noexcept
|
||||
|
@ -100,7 +100,7 @@ namespace detail {
|
|||
|
||||
/*!
|
||||
* A very simple integer low-pass filter, using a "one-pole infinite impulse response"
|
||||
* design (one-pole IIR), aka exponential filter.
|
||||
* design (one-pole IIR), also known as an exponential filter.
|
||||
*
|
||||
* Configurable in scalar type.
|
||||
*/
|
||||
|
@ -121,7 +121,7 @@ public:
|
|||
}
|
||||
|
||||
/*!
|
||||
* Reset the filter to just-created state.
|
||||
* Reset the filter to newly-created state.
|
||||
*/
|
||||
void
|
||||
reset() noexcept
|
||||
|
@ -144,7 +144,7 @@ public:
|
|||
}
|
||||
|
||||
/*!
|
||||
* Access the filtered value.
|
||||
* Get the filtered value.
|
||||
*/
|
||||
Scalar
|
||||
getState() const noexcept
|
||||
|
@ -154,7 +154,7 @@ public:
|
|||
|
||||
|
||||
/*!
|
||||
* Access whether we have initialized state.
|
||||
* Get whether we have initialized state.
|
||||
*/
|
||||
bool
|
||||
isInitialized() const noexcept
|
||||
|
|
|
@ -88,7 +88,7 @@ quat_exp(Eigen::MatrixBase<Derived> const &vec)
|
|||
return ret.normalized();
|
||||
}
|
||||
|
||||
/// Taylor series expansion of theta over sin(theta), aka cosecant, for
|
||||
/// Taylor series expansion of theta over sin(theta), also known as cosecant, for
|
||||
/// use near 0 when you want continuity and validity at 0.
|
||||
template <typename Scalar>
|
||||
inline Scalar
|
||||
|
@ -112,7 +112,7 @@ quat_ln(Eigen::Quaternion<Scalar> const &quat)
|
|||
{
|
||||
// ln q = ( (phi)/(norm of vec) vec, ln(norm of quat))
|
||||
// When we assume a unit quaternion, ln(norm of quat) = 0
|
||||
// so then we just scale the vector part by phi/sin(phi) to get the
|
||||
// so then we scale the vector part by phi/sin(phi) to get the
|
||||
// result (i.e., ln(qv, qw) = (phi/sin(phi)) * qv )
|
||||
Scalar vecnorm = quat.vec().norm();
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ m_relation_history_push(struct m_relation_history *rh, struct xrt_space_relation
|
|||
// if we aren't empty, we can compare against the latest timestamp.
|
||||
if (rh->impl.empty() || rhe.timestamp > rh->impl.back().timestamp) {
|
||||
// Everything explodes if the timestamps in relation_history aren't monotonically increasing. If
|
||||
// we get a timestamp that's before the most recent timestamp in the buffer, just don't put it
|
||||
// we get a timestamp that's before the most recent timestamp in the buffer, don't put it
|
||||
// in the history.
|
||||
rh->impl.push_back(rhe);
|
||||
ret = true;
|
||||
|
@ -103,7 +103,7 @@ m_relation_history_get(struct m_relation_history *rh, uint64_t at_timestamp_ns,
|
|||
if (it == e) {
|
||||
// lower bound is at the end:
|
||||
// The desired timestamp is after what our buffer contains.
|
||||
// Aka pose-prediction.
|
||||
// (pose-prediction)
|
||||
int64_t diff_prediction_ns = static_cast<int64_t>(at_timestamp_ns) - rh->impl.back().timestamp;
|
||||
double delta_s = time_ns_to_s(diff_prediction_ns);
|
||||
|
||||
|
@ -121,7 +121,7 @@ m_relation_history_get(struct m_relation_history *rh, uint64_t at_timestamp_ns,
|
|||
if (it == b) {
|
||||
// lower bound is at the beginning (and it's not an exact match):
|
||||
// The desired timestamp is before what our buffer contains.
|
||||
// Aka a weird edge case where somebody asks for a really old pose and we do our best.
|
||||
// (an edge case where somebody asks for a really old pose and we do our best)
|
||||
int64_t diff_prediction_ns = static_cast<int64_t>(at_timestamp_ns) - rh->impl.front().timestamp;
|
||||
double delta_s = time_ns_to_s(diff_prediction_ns);
|
||||
U_LOG_T("Extrapolating %f s before the front of the buffer!", delta_s);
|
||||
|
@ -145,7 +145,7 @@ m_relation_history_get(struct m_relation_history *rh, uint64_t at_timestamp_ns,
|
|||
xrt_space_relation result{};
|
||||
result.relation_flags = (enum xrt_space_relation_flags)(predecessor.relation.relation_flags &
|
||||
successor.relation.relation_flags);
|
||||
// First-order implementation - just lerp between the before and after
|
||||
// First-order implementation - lerp between the before and after
|
||||
if (0 != (result.relation_flags & XRT_SPACE_RELATION_POSITION_VALID_BIT)) {
|
||||
result.pose.position = m_vec3_lerp(predecessor.relation.pose.position,
|
||||
successor.relation.pose.position, amount_to_lerp);
|
||||
|
|
|
@ -251,13 +251,13 @@ apply_relation(const struct xrt_space_relation *a,
|
|||
*/
|
||||
|
||||
int new_flags = 0;
|
||||
// Make sure to not drop a orientation, even if just one is valid.
|
||||
// Make sure to not drop a orientation, even if only one is valid.
|
||||
if (af.has_orientation || bf.has_orientation) {
|
||||
new_flags |= XRT_SPACE_RELATION_ORIENTATION_VALID_BIT;
|
||||
}
|
||||
|
||||
/*
|
||||
* Make sure to not drop a position, even if just one is valid.
|
||||
* Make sure to not drop a position, even if only one is valid.
|
||||
*
|
||||
* When position is valid, always set orientation valid to "upgrade"
|
||||
* poses with valid position but invalid orientation to fully valid
|
||||
|
|
Loading…
Reference in a new issue