refactor(depth): keep DepthCameraObstacleLayer, drop the legacy depth clearing
Two depth-image clearing designs lived in this package: the frustum ray
clearing inherited from dev_cam_intel (DepthCameraData sources of
ObstacleLayer/VoxelLayer, frustum_* and column_* keys) and the observed_volume
evidence clearing (ROC) on top of it. Both are replaced on the robot by
DepthCameraObstacleLayer, a port of costmap_depth_camera that takes the
filtered PointCloud2 directly, so both are removed and the tree is rebuilt
from main (a63c084) plus the plugin.
- observation.h / observation_buffer: DepthFrustumConfig, DepthCameraObservation
and the depth buffering API are gone; buffers hold point clouds only.
- ObstacleLayer/VoxelLayer: no frustum ray casting, column clearing or depth
ray cache. A DepthCameraData source or frustum_clearing_enabled: true now
fails at startup with a message pointing to DepthCameraObstacleLayer
instead of silently dropping the camera; DepthCameraData reaching the layer
through the gateway is ignored.
- copyParentParameters no longer forwards the frustum_* / column_* keys.
- ROC files (depth_evidence_store, depth_visibility, depth_frame_pairer) and
their tests are not carried over; CloudProcessingConfig goes with them.
- PCL is needed by the plugin library only. The plugin test moves under
BUILD_COSTMAP_TESTS; BUILD_DEPTH_MARKING_TESTS is gone.
- README documents DepthCameraObstacleLayer and its known limits.
The plugin code is unchanged from the version running on the KIT robot.
This commit is contained in:
@@ -34,7 +34,6 @@
|
||||
|
||||
#include <robot_geometry_msgs/Point.h>
|
||||
#include <robot_sensor_msgs/PointCloud2.h>
|
||||
#include <robot_sensor_msgs/DepthCameraData.h>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <utility>
|
||||
@@ -42,184 +41,6 @@
|
||||
namespace robot_costmap_2d
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief A depth frame and its per-source frustum-clearing configuration.
|
||||
*
|
||||
* The message is shared so returning buffered observations does not copy the
|
||||
* full depth image on every costmap update.
|
||||
*/
|
||||
/// Per-observation-source configuration of the depth-image frustum clearing,
|
||||
/// loaded by ObstacleLayer from the source's YAML/ROS params and carried with
|
||||
/// each DepthCameraObservation.
|
||||
struct DepthFrustumConfig
|
||||
{
|
||||
unsigned int pixel_step = 0;
|
||||
double min_range = 0.0;
|
||||
double max_range = 0.0;
|
||||
/// 3D clearing rays stop this far [m] before the measured surface.
|
||||
/// Negative: legacy 2 * costmap resolution.
|
||||
double skip_distance = -1.0;
|
||||
/// Full-column clearing from the per-pixel-column nearest in-band return.
|
||||
bool column_clearing = false;
|
||||
/// Height band [m] used for the in-band test; floor returns below min do
|
||||
/// not shorten the beam. max < 0: use the layer max_obstacle_height.
|
||||
double column_min_height = 0.10;
|
||||
double column_max_height = -1.0;
|
||||
/// Column beams stop this far [m] before the nearest in-band return.
|
||||
double column_skip_distance = 0.02;
|
||||
/// Full columns are only cleared beyond this distance [m]. Negative:
|
||||
/// derive each frame from the camera intrinsics and mounting pose.
|
||||
double column_cover_distance = -1.0;
|
||||
/// Depth-image columns at the LEFT edge excluded from clearing [px]. Covers
|
||||
/// the stereo no-disparity strip that is permanently invalid there: those
|
||||
/// pixels carry no free-space evidence, so clearing through them erases
|
||||
/// obstacles that rotate out of the FOV on that side. Set to the measured
|
||||
/// width of the black strip in the raw depth image (a few px margin). 0
|
||||
/// disables. Invalid pixels ELSEWHERE still clear (needed for ghost removal).
|
||||
unsigned int clear_left_border_px = 0;
|
||||
/// Same as clear_left_border_px but for the RIGHT edge, for cameras whose
|
||||
/// stereo no-disparity strip sits on the right instead of the left. Measured
|
||||
/// from the last image column inward. 0 disables.
|
||||
unsigned int clear_right_border_px = 0;
|
||||
// Opt-in observed-volume mode. Legacy range/column keys are not used by it.
|
||||
bool observed_volume_clearing = false;
|
||||
double voxel_z_resolution_m = 0.0625; // depth-only grid: low objects must not occupy an entire 20 cm slab
|
||||
std::string paired_marking_source;
|
||||
unsigned int pair_queue_size = 4;
|
||||
double pair_max_wait_s = 0.25;
|
||||
double observation_max_age_s = 0.5;
|
||||
double valid_min_z_m = 0.1;
|
||||
double valid_max_z_m = 3.0;
|
||||
double free_margin_m = 0.02;
|
||||
unsigned int projection_margin_px = 1;
|
||||
/// Certify the measured evidence points of each marked voxel instead of the whole
|
||||
/// voxel box. A box cut by the image edge can never be certified, while the points
|
||||
/// that marked it were inside the image when they were seen.
|
||||
bool evidence_points_enabled = false;
|
||||
/// [points] evidence kept per voxel: 6 per-axis extremes plus the most recent ones.
|
||||
unsigned int evidence_points_per_voxel = 8;
|
||||
/// [px] with evidence points, marking drops points that project closer than this to
|
||||
/// the usable image edge, so each kept point has a full projection patch in view.
|
||||
unsigned int marking_border_px = 0;
|
||||
/// With evidence points, a valid return deeper than valid_max_z_m counts as behind a point
|
||||
/// that lies at least free_margin_m inside the trusted range: the ray passed the point.
|
||||
bool far_return_is_behind = false;
|
||||
/// Re-observe-or-clear rule (needs evidence points). A marked voxel in view must be measured
|
||||
/// again at one of its points each frame; seen through for miss_frames frames in a row frees
|
||||
/// it. Occluded, out-of-view and no-return frames keep it, so nothing expires out of the FOV.
|
||||
/// false: a voxel is freed only when every pixel of every point proves free space.
|
||||
bool reobserve_clearing = false;
|
||||
/// [m] Re-observe: |measured - point depth| within this means the surface is still there.
|
||||
/// Nearer than that is an occluder, deeper is free space seen through. Replaces free_margin_m.
|
||||
double confirm_tolerance_m = 0.05;
|
||||
/// [frames] Re-observe: seen-through frames in a row that free a voxel.
|
||||
unsigned int miss_frames = 3;
|
||||
/// [0..1] Re-observe: miss added by a frame whose patch pixels are all invalid. 0 keeps invalid
|
||||
/// depth as unknown; > 0 lets voxels in view expire where the camera returns nothing.
|
||||
double no_return_weight = 0.0;
|
||||
/// [m] Stereo baseline of the left no-disparity band, fx * baseline / z + stereo_band_margin_px
|
||||
/// wide at depth z. Points inside it cannot be re-checked: they are out of view and are not
|
||||
/// marked. 0 disables (only clear_left_border_px applies).
|
||||
double stereo_baseline_m = 0.0;
|
||||
/// [px] Added to the stereo band width.
|
||||
unsigned int stereo_band_margin_px = 10;
|
||||
};
|
||||
|
||||
class DepthCameraObservation
|
||||
{
|
||||
public:
|
||||
DepthCameraObservation()
|
||||
: data_handle_(),
|
||||
data_(nullptr),
|
||||
topic_()
|
||||
{
|
||||
}
|
||||
|
||||
DepthCameraObservation(
|
||||
const robot_sensor_msgs::DepthCameraData& data,
|
||||
std::string topic,
|
||||
const robot::Time& received_time,
|
||||
const DepthFrustumConfig& frustum)
|
||||
: data_handle_(boost::make_shared<robot_sensor_msgs::DepthCameraData>(data)),
|
||||
data_(data_handle_.get()),
|
||||
topic_(std::move(topic)),
|
||||
received_time_(received_time),
|
||||
frustum_(frustum)
|
||||
{
|
||||
}
|
||||
|
||||
DepthCameraObservation(
|
||||
robot_sensor_msgs::DepthCameraData::ConstPtr data,
|
||||
std::string topic,
|
||||
const robot::Time& received_time,
|
||||
const DepthFrustumConfig& frustum)
|
||||
: data_handle_(std::move(data)),
|
||||
data_(data_handle_.get()),
|
||||
topic_(std::move(topic)),
|
||||
received_time_(received_time),
|
||||
frustum_(frustum)
|
||||
{
|
||||
}
|
||||
|
||||
DepthCameraObservation(const DepthCameraObservation& other)
|
||||
: data_handle_(other.data_handle_),
|
||||
data_(data_handle_.get()),
|
||||
topic_(other.topic_),
|
||||
received_time_(other.received_time_),
|
||||
frustum_(other.frustum_)
|
||||
{
|
||||
}
|
||||
|
||||
DepthCameraObservation(DepthCameraObservation&& other) noexcept
|
||||
: data_handle_(std::move(other.data_handle_)),
|
||||
data_(data_handle_.get()),
|
||||
topic_(std::move(other.topic_)),
|
||||
received_time_(other.received_time_),
|
||||
frustum_(other.frustum_)
|
||||
{
|
||||
other.data_ = nullptr;
|
||||
other.frustum_ = DepthFrustumConfig();
|
||||
}
|
||||
|
||||
DepthCameraObservation& operator=(const DepthCameraObservation& other)
|
||||
{
|
||||
if (this == &other)
|
||||
return *this;
|
||||
|
||||
data_handle_ = other.data_handle_;
|
||||
data_ = data_handle_.get();
|
||||
topic_ = other.topic_;
|
||||
received_time_ = other.received_time_;
|
||||
frustum_ = other.frustum_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
DepthCameraObservation& operator=(DepthCameraObservation&& other) noexcept
|
||||
{
|
||||
if (this == &other)
|
||||
return *this;
|
||||
|
||||
data_handle_ = std::move(other.data_handle_);
|
||||
data_ = data_handle_.get();
|
||||
topic_ = std::move(other.topic_);
|
||||
received_time_ = other.received_time_;
|
||||
frustum_ = other.frustum_;
|
||||
|
||||
other.data_ = nullptr;
|
||||
other.frustum_ = DepthFrustumConfig();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
~DepthCameraObservation() = default;
|
||||
|
||||
robot_sensor_msgs::DepthCameraData::ConstPtr data_handle_;
|
||||
const robot_sensor_msgs::DepthCameraData* data_;
|
||||
std::string topic_;
|
||||
robot::Time received_time_;
|
||||
DepthFrustumConfig frustum_;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Stores an observation in terms of a point cloud and the origin of the source
|
||||
* @note Tried to make members and constructor arguments const but the compiler would not accept the default
|
||||
|
||||
Reference in New Issue
Block a user