Files
costmap_2d/include/robot_costmap_2d/depth_visibility.h
duongtd 2ca0bcc1c1 feat(depth): observed_volume depth clearing as deployed 2026-10-14
Baseline commit of the working-tree refactor built on 2026-10-14 17:24 and
running on the KIT robot, recorded in one commit before further changes.

- VoxelLayer clearing looks up TF at the depth image stamp.
- ObservationBuffer: per-source cloud preparation at the measurement stamp,
  height/range gate before the PCL VoxelGrid.
- DepthFramePairer: pairs the marking cloud with the clearing image by
  source and stamp, bounded queue and age.
- DepthVisibilityChecker and the observed_volume clearing mode in VoxelLayer;
  the legacy frustum mode stays the default.
- Tests: depth_observation_buffer_test, depth_visibility_test.
2026-10-15 11:37:56 +07:00

36 lines
1.2 KiB
C++

#pragma once
#include <robot_costmap_2d/observation.h>
#include <tf3/compat.h>
#include <Eigen/Geometry>
#include <vector>
namespace robot_costmap_2d
{
enum class DepthVisibility { Free, Unknown, Surface };
enum class DepthVisibilityReason { Free, OutsideView, InvalidDepth, Surface, EmptyRegion };
struct DepthVisibilityResult
{
DepthVisibility state{DepthVisibility::Unknown};
DepthVisibilityReason reason{DepthVisibilityReason::OutsideView};
};
// Pure geometry/measurement helper. It never mutates occupancy or queries TF.
class DepthVisibilityChecker
{
public:
bool prepare(robot_sensor_msgs::DepthCameraData::ConstPtr data,
const tf3::TransformStampedMsg& global_from_camera,
double min_height, double max_height, const DepthFrustumConfig& config);
DepthVisibilityResult classify(const Eigen::Vector3d& lower,
const Eigen::Vector3d& upper) const;
private:
robot_sensor_msgs::DepthCameraData::ConstPtr data_;
Eigen::Isometry3d camera_from_global_{Eigen::Isometry3d::Identity()};
double min_height_{0}, max_height_{0};
DepthFrustumConfig config_;
unsigned int bytes_per_pixel_{0};
};
} // namespace robot_costmap_2d