Skip to main content

WrenchTareAccumulator Class

Declaration

class moveit_pro_controllers::WrenchTareAccumulator { ... }

Included Headers

#include <signal_processing.hpp>

Public Member Functions Index

voidstart (std::int64_t num_samples)
voidreset ()
boolinProgress () const noexcept
std::optional< Eigen::Vector6d >addSample (const Eigen::Vector6d &wrench)

Private Member Attributes Index

std::int64_tremaining_samples_ = 0
std::int64_tnum_samples_ = 0
Eigen::Vector6dwrench_sum_ = Eigen::Vector6d::Zero()

Description

Accumulates raw force/torque samples following a tare request and, once the requested number of samples has been collected, returns their average. Averaging several readings prevents a single noisy outlier from biasing the sensor offset, which would otherwise introduce drift in compliant motions.

All operations are allocation-free and lock-free, so the accumulator can be driven directly from the realtime control loop.

Definition at line 101 of file signal_processing.hpp.

Public Member Functions

addSample()

std::optional< Eigen::Vector6d > moveit_pro_controllers::WrenchTareAccumulator::addSample (const Eigen::Vector6d & wrench)

Feeds one raw wrench sample while a tare is in progress.

Parameters
[in] wrench

the raw force/torque measurement for this control cycle.

Returns

the averaged wrench on the call that completes the requested batch, and std::nullopt on every other call (including when no tare is in progress).

Declaration at line 134 of file signal_processing.hpp, definition at line 86 of file signal_processing.cpp.

inProgress()

bool moveit_pro_controllers::WrenchTareAccumulator::inProgress ()
noexcept
Returns

true while a tare is in progress, i.e. start() was called and the requested batch is not yet complete.

Declaration at line 125 of file signal_processing.hpp, definition at line 81 of file signal_processing.cpp.

reset()

void moveit_pro_controllers::WrenchTareAccumulator::reset ()

Cancels any in-progress tare, discarding the partial batch. Samples must come from consecutive control cycles of one control session: callers reset the accumulator on controller activation and deactivation, so a stale partial batch can never be completed with readings taken under different load or pose conditions across an inactive gap.

Declaration at line 119 of file signal_processing.hpp, definition at line 74 of file signal_processing.cpp.

start()

void moveit_pro_controllers::WrenchTareAccumulator::start (std::int64_t num_samples)

Begins a new tare. The next num_samples wrench readings passed to addSample() are averaged into the offset. Calling start() again while a tare is in progress discards the partial batch and restarts the count.

Parameters
[in] num_samples

number of samples to average. Values below 1 are clamped to 1.

Declaration at line 111 of file signal_processing.hpp, definition at line 67 of file signal_processing.cpp.

Private Member Attributes

num_samples_

std::int64_t moveit_pro_controllers::WrenchTareAccumulator::num_samples_ = 0

Definition at line 140 of file signal_processing.hpp.

remaining_samples_

std::int64_t moveit_pro_controllers::WrenchTareAccumulator::remaining_samples_ = 0

Definition at line 138 of file signal_processing.hpp.

wrench_sum_

Eigen::Vector6d moveit_pro_controllers::WrenchTareAccumulator::wrench_sum_ = Eigen::Vector6d::Zero()

Definition at line 143 of file signal_processing.hpp.


The documentation for this class was generated from the following files:


Generated via doxygen2docusaurus 2.2.2 by Doxygen 1.9.8.