cmvr-es/cmvr-es/algorithms/collision_detection/include/distance_sampling_policy.h
linbo c571b476a1 feat(arm): sync TCHL motion stack and release build workflow
Integrate lgv_dev_tc_motor arm planning dependencies while retaining linbo_dev capabilities. Configure seven TCHL axes, preserve existing limits and igc startup defaults, and sync build script updates through 08d9a393.
2026-10-27 17:01:20 +08:00

48 lines
1.2 KiB
C++

#ifndef CMVR_ES_DISTANCE_SAMPLING_POLICY_H
#define CMVR_ES_DISTANCE_SAMPLING_POLICY_H
#include <chrono>
#include <string>
#include <vector>
#include "environment/include/robot_model.h"
namespace cmvr {
struct DistanceSamplingOptions {
double max_geometry_displacement_m{0.002};
double max_check_period_s{0.01};
};
class LgvDistanceSamplingPolicy {
public:
using Clock = std::chrono::steady_clock;
bool configure(const DistanceSamplingOptions& options,
std::string* error = nullptr);
bool shouldCheck(const std::vector<CollisionBody>& current,
Clock::time_point now) const;
void markChecked(const std::vector<CollisionBody>& current,
Clock::time_point now);
void reset();
double displacementSinceLastCheck(
const std::vector<CollisionBody>& current) const;
bool hasBaseline() const { return has_baseline_; }
private:
DistanceSamplingOptions options_{};
std::vector<CollisionBody> last_checked_{};
Clock::time_point last_check_time_{};
bool configured_{false};
bool has_baseline_{false};
};
} // namespace cmvr
#endif // CMVR_ES_DISTANCE_SAMPLING_POLICY_H