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.
This commit is contained in:
@@ -122,6 +122,25 @@ bool ObstacleLayer::getParams(const std::string& config_file_name, robot::NodeHa
|
||||
|
||||
// now we need to split the topics based on whitespace which we can use a stringstream for
|
||||
std::stringstream ss(topics_string);
|
||||
|
||||
struct CloudSourceDefinition
|
||||
{
|
||||
boost::shared_ptr<ObservationBuffer> buffer;
|
||||
CloudProcessingConfig processing;
|
||||
std::string topic, data_type;
|
||||
double min_height, max_height, keep_time, expected_period;
|
||||
bool marking, clearing;
|
||||
};
|
||||
struct DepthSourceDefinition
|
||||
{
|
||||
boost::shared_ptr<ObservationBuffer> buffer;
|
||||
DepthFrustumConfig config;
|
||||
std::string topic, data_type;
|
||||
double expected_period;
|
||||
};
|
||||
std::map<std::string, CloudSourceDefinition> cloud_sources;
|
||||
std::vector<DepthSourceDefinition> depth_sources;
|
||||
paired_depth_sources_.clear();
|
||||
|
||||
std::string source;
|
||||
callback_infos_.clear();
|
||||
@@ -225,6 +244,41 @@ bool ObstacleLayer::getParams(const std::string& config_file_name, robot::NodeHa
|
||||
if (priv_nh.hasParam("frustum_depth_camera_topic"))
|
||||
priv_nh.getParam("frustum_depth_camera_topic", depth_camera_data_topic_);
|
||||
|
||||
const auto read_depth_option = [&](const char* key, auto& value) {
|
||||
value = loadParam(layer[source], key, value);
|
||||
if (priv_nh.hasParam(key)) priv_nh.getParam(key, value);
|
||||
};
|
||||
std::string depth_mode = "legacy";
|
||||
read_depth_option("depth_clearing_mode", depth_mode);
|
||||
if (depth_mode != "legacy" && depth_mode != "observed_volume")
|
||||
throw std::invalid_argument("unknown depth_clearing_mode: " + depth_mode);
|
||||
frustum_config.observed_volume_clearing = depth_mode == "observed_volume";
|
||||
read_depth_option("paired_marking_source", frustum_config.paired_marking_source);
|
||||
int pair_queue = 4, projection_margin = 1;
|
||||
read_depth_option("depth_pair_queue_size", pair_queue);
|
||||
read_depth_option("depth_pair_max_wait_s", frustum_config.pair_max_wait_s);
|
||||
read_depth_option("depth_observation_max_age_s", frustum_config.observation_max_age_s);
|
||||
read_depth_option("depth_valid_min_z_m", frustum_config.valid_min_z_m);
|
||||
read_depth_option("depth_valid_max_z_m", frustum_config.valid_max_z_m);
|
||||
read_depth_option("depth_free_margin_m", frustum_config.free_margin_m);
|
||||
read_depth_option("depth_projection_margin_px", projection_margin);
|
||||
read_depth_option("depth_voxel_z_resolution_m", frustum_config.voxel_z_resolution_m);
|
||||
if (pair_queue < 1 || pair_queue > 64 || projection_margin < 0 || projection_margin > 16)
|
||||
throw std::invalid_argument("depth pair queue/projection margin out of bounds");
|
||||
frustum_config.pair_queue_size = static_cast<unsigned int>(pair_queue);
|
||||
frustum_config.projection_margin_px = static_cast<unsigned int>(projection_margin);
|
||||
if (frustum_config.observed_volume_clearing &&
|
||||
(!frustum_clearing_enabled || data_type != "DepthCameraData"))
|
||||
throw std::invalid_argument("observed_volume requires a DepthCameraData frustum source");
|
||||
if (frustum_config.observed_volume_clearing &&
|
||||
(!std::isfinite(frustum_config.valid_min_z_m) || frustum_config.valid_min_z_m <= 0 ||
|
||||
!std::isfinite(frustum_config.valid_max_z_m) || frustum_config.valid_max_z_m <= frustum_config.valid_min_z_m ||
|
||||
!std::isfinite(frustum_config.free_margin_m) || frustum_config.free_margin_m < 0))
|
||||
throw std::invalid_argument("observed_volume requires finite optical depth limits and free margin");
|
||||
if (frustum_config.observed_volume_clearing &&
|
||||
(!std::isfinite(frustum_config.voxel_z_resolution_m) || frustum_config.voxel_z_resolution_m <= 0))
|
||||
throw std::invalid_argument("observed_volume requires finite positive voxel z resolution");
|
||||
|
||||
frustum_config.pixel_step = static_cast<unsigned int>(std::max(1, frustum_pixel_step));
|
||||
frustum_config.clear_left_border_px =
|
||||
static_cast<unsigned int>(std::max(0, frustum_clear_left_border));
|
||||
@@ -252,6 +306,25 @@ bool ObstacleLayer::getParams(const std::string& config_file_name, robot::NodeHa
|
||||
if (priv_nh.hasParam("raytrace_range"))
|
||||
priv_nh.getParam("raytrace_range", raytrace_range);
|
||||
|
||||
CloudProcessingConfig cloud_processing;
|
||||
cloud_processing.transform_at_stamp =
|
||||
loadParam(layer[source], "cloud_transform_at_stamp", false);
|
||||
const YAML::Node voxel_filter = layer[source]["marking_voxel_filter"];
|
||||
if (voxel_filter && voxel_filter.IsMap())
|
||||
{
|
||||
cloud_processing.voxel_filter_enabled = loadParam(voxel_filter, "enabled", false);
|
||||
cloud_processing.voxel_leaf_size = loadParam(voxel_filter, "leaf_size_m", 0.05);
|
||||
}
|
||||
if (priv_nh.hasParam("cloud_transform_at_stamp"))
|
||||
priv_nh.getParam("cloud_transform_at_stamp", cloud_processing.transform_at_stamp);
|
||||
if (priv_nh.hasParam("marking_voxel_filter/enabled"))
|
||||
priv_nh.getParam("marking_voxel_filter/enabled", cloud_processing.voxel_filter_enabled);
|
||||
if (priv_nh.hasParam("marking_voxel_filter/leaf_size_m"))
|
||||
priv_nh.getParam("marking_voxel_filter/leaf_size_m", cloud_processing.voxel_leaf_size);
|
||||
if (cloud_processing.voxel_filter_enabled &&
|
||||
(data_type != "PointCloud2" || !marking || clearing || frustum_clearing_enabled))
|
||||
throw std::invalid_argument("marking_voxel_filter requires a marking-only PointCloud2 source");
|
||||
|
||||
if (!(data_type == "PointCloud2" || data_type == "PointCloud" || data_type == "LaserScan" || data_type == "DepthCameraData"))
|
||||
{
|
||||
robot::log_error("Only topics that use point clouds or laser scans are currently supported\n");
|
||||
@@ -279,6 +352,16 @@ bool ObstacleLayer::getParams(const std::string& config_file_name, robot::NodeHa
|
||||
> (new ObservationBuffer(topic, observation_keep_time, expected_update_rate, min_obstacle_height,
|
||||
max_obstacle_height, obstacle_range, raytrace_range, *tf_, global_frame_,
|
||||
sensor_frame, transform_tolerance)));
|
||||
observation_buffers_.back()->setCloudProcessingConfig(cloud_processing);
|
||||
cloud_sources.emplace(source, CloudSourceDefinition{observation_buffers_.back(), cloud_processing,
|
||||
topic, data_type, min_obstacle_height, max_obstacle_height, observation_keep_time,
|
||||
expected_update_rate, marking, clearing});
|
||||
robot::log_info("source %s: cloud_tf=%s height=[%.3f, %.3f] m range=%.3f m; "
|
||||
"PCL_after_height_range=%s leaf=%.3f m\n", source.c_str(),
|
||||
cloud_processing.transform_at_stamp ? "measurement_stamp" : "latest",
|
||||
min_obstacle_height, max_obstacle_height, obstacle_range,
|
||||
cloud_processing.voxel_filter_enabled ? "true" : "false",
|
||||
cloud_processing.voxel_leaf_size);
|
||||
if (marking)
|
||||
marking_buffers_.push_back(observation_buffers_.back());
|
||||
|
||||
@@ -301,6 +384,8 @@ bool ObstacleLayer::getParams(const std::string& config_file_name, robot::NodeHa
|
||||
max_obstacle_height, obstacle_range, raytrace_range, frustum_config,
|
||||
*tf_, global_frame_,
|
||||
sensor_frame, transform_tolerance)));
|
||||
depth_sources.push_back({depth_observation_buffers_.back(), frustum_config,
|
||||
topic, data_type, expected_update_rate});
|
||||
|
||||
}
|
||||
robot::log_info(
|
||||
@@ -308,7 +393,35 @@ bool ObstacleLayer::getParams(const std::string& config_file_name, robot::NodeHa
|
||||
"expected update rate: %.2f, observation persistence: %.2f\n",
|
||||
topic.c_str(), global_frame_.c_str(), expected_update_rate, observation_keep_time);
|
||||
|
||||
}
|
||||
}
|
||||
for (const auto& depth_source : depth_sources)
|
||||
{
|
||||
if (!depth_source.config.observed_volume_clearing) continue;
|
||||
const auto marker = cloud_sources.find(depth_source.config.paired_marking_source);
|
||||
if (marker == cloud_sources.end() || marker->second.data_type != "PointCloud2" ||
|
||||
!marker->second.marking || marker->second.clearing || marker->second.keep_time != 0 ||
|
||||
!marker->second.processing.transform_at_stamp || getType() != LayerType::VOXEL_LAYER)
|
||||
throw std::invalid_argument("observed_volume needs a timestamped marking-only PointCloud2 pair with persistence=0");
|
||||
for (const auto& other : cloud_sources)
|
||||
if (other.first != marker->first && (other.second.marking || other.second.clearing))
|
||||
throw std::invalid_argument("observed_volume depth must use its own VoxelLayer; mixed sensor ownership is unsupported");
|
||||
if (!paired_depth_sources_.empty() || depth_sources.size() != 1)
|
||||
throw std::invalid_argument("observed_volume supports one depth camera per VoxelLayer");
|
||||
const auto& m = marker->second;
|
||||
double period = m.expected_period;
|
||||
if (period <= 0 || (depth_source.expected_period > 0 && depth_source.expected_period < period))
|
||||
period = depth_source.expected_period;
|
||||
auto paired = boost::make_shared<PairedDepthSource>(depth_source.config, period);
|
||||
paired->cloud_topic = m.topic; paired->depth_topic = depth_source.topic;
|
||||
paired->marking_buffer = m.buffer; paired->depth_buffer = depth_source.buffer;
|
||||
paired->min_height = m.min_height; paired->max_height = m.max_height;
|
||||
paired_depth_sources_.push_back(paired);
|
||||
marking_buffers_.erase(std::remove(marking_buffers_.begin(), marking_buffers_.end(), m.buffer), marking_buffers_.end());
|
||||
robot::log_info("depth clearing observed_volume: paired %s + %s, height=[%.3f, %.3f] m; "
|
||||
"unknown/occluded/outside FOV retained; queue=%u age=%.3f s; one valid free frame\n",
|
||||
paired->cloud_topic.c_str(), paired->depth_topic.c_str(), m.min_height, m.max_height,
|
||||
paired->config.pair_queue_size, paired->config.observation_max_age_s);
|
||||
}
|
||||
}
|
||||
catch (const YAML::BadFile& e) {
|
||||
robot::log_error("Cannot open YAML file: %s\n", e.what());
|
||||
@@ -399,7 +512,11 @@ void ObstacleLayer::handleImpl(const void* data,
|
||||
topic == callback_depth_infos_[i].topic)
|
||||
{
|
||||
// robot::log_error_throttle(1.0,"TEST");
|
||||
depthImageCallback(depth_camera_data_ptr, buffer);
|
||||
bool paired = false;
|
||||
for (const auto& source : paired_depth_sources_)
|
||||
if (source->depth_topic == topic)
|
||||
{ source->pairer.addDepth(depth_camera_data_ptr); paired = true; break; }
|
||||
if (!paired) depthImageCallback(depth_camera_data_ptr, buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -448,7 +565,11 @@ void ObstacleLayer::handleImpl(const void* data,
|
||||
{
|
||||
robot::log_error("obstacle_layer: inf_is_valid option is not applicable to PointCloud observations.\n");
|
||||
}
|
||||
pointCloud2Callback(*static_cast<const robot_sensor_msgs::PointCloud2*>(data), buffer);
|
||||
bool paired = false;
|
||||
for (const auto& source : paired_depth_sources_)
|
||||
if (source->cloud_topic == topic)
|
||||
{ source->pairer.addCloud(*static_cast<const robot_sensor_msgs::PointCloud2*>(data)); paired = true; break; }
|
||||
if (!paired) pointCloud2Callback(*static_cast<const robot_sensor_msgs::PointCloud2*>(data), buffer);
|
||||
}
|
||||
// else
|
||||
// {
|
||||
@@ -744,6 +865,10 @@ bool ObstacleLayer::getFrustumClearingObservations(std::vector<DepthCameraObserv
|
||||
|
||||
for (const boost::shared_ptr<ObservationBuffer>& buffer : depth_observation_buffers_)
|
||||
{
|
||||
bool paired = false;
|
||||
for (const auto& source : paired_depth_sources_)
|
||||
if (source->depth_buffer == buffer) { paired = true; break; }
|
||||
if (paired) continue;
|
||||
buffer->lock();
|
||||
buffer->getDepthObservations(frustum_clearing_observations);
|
||||
current = buffer->isCurrent() && current;
|
||||
@@ -754,6 +879,18 @@ bool ObstacleLayer::getFrustumClearingObservations(std::vector<DepthCameraObserv
|
||||
return current;
|
||||
}
|
||||
|
||||
bool ObstacleLayer::pairedDepthCurrent() const
|
||||
{
|
||||
bool current = true;
|
||||
for (const auto& source : paired_depth_sources_) current = source->pairer.isCurrent() && current;
|
||||
return current;
|
||||
}
|
||||
|
||||
void ObstacleLayer::resetPairedDepth()
|
||||
{
|
||||
for (const auto& source : paired_depth_sources_) source->pairer.reset();
|
||||
}
|
||||
|
||||
void ObstacleLayer::raytraceFreespace(const Observation& clearing_observation, double* min_x, double* min_y,
|
||||
double* max_x, double* max_y)
|
||||
{
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
* David V. Lu!!
|
||||
*********************************************************************/
|
||||
#include <robot_costmap_2d/voxel_layer.h>
|
||||
#include <robot_costmap_2d/depth_visibility.h>
|
||||
#include <robot_sensor_msgs/point_cloud2_iterator.h>
|
||||
#include <robot_tf3_geometry_msgs/tf3_geometry_msgs.h>
|
||||
#include <robot_geometry_msgs/Vector3.h>
|
||||
@@ -45,6 +46,7 @@
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <array>
|
||||
|
||||
#define VOXEL_BITS 16
|
||||
|
||||
@@ -71,6 +73,18 @@ void VoxelLayer::onInitialize()
|
||||
VoxelLayer::~VoxelLayer()
|
||||
{}
|
||||
|
||||
VoxelGrid VoxelLayer::voxelSnapshot()
|
||||
{
|
||||
VoxelGrid out;
|
||||
out.header.frame_id = global_frame_;
|
||||
out.header.stamp = robot::Time::now();
|
||||
out.size_x = size_x_; out.size_y = size_y_; out.size_z = size_z_;
|
||||
out.origin.x = origin_x_; out.origin.y = origin_y_; out.origin.z = origin_z_;
|
||||
out.resolutions.x = out.resolutions.y = resolution_; out.resolutions.z = z_resolution_;
|
||||
out.data.assign(robot_voxel_grid_.getData(), robot_voxel_grid_.getData() + size_x_ * size_y_);
|
||||
return out;
|
||||
}
|
||||
|
||||
bool VoxelLayer::getParams(const std::string& config_file_name, robot::NodeHandle &nh)
|
||||
{
|
||||
try
|
||||
@@ -126,6 +140,16 @@ bool VoxelLayer::getParams(const std::string& config_file_name, robot::NodeHandl
|
||||
if (nh.hasParam("combination_method"))
|
||||
nh.getParam("combination_method", combination_method_);
|
||||
|
||||
if (!paired_depth_sources_.empty())
|
||||
{
|
||||
z_resolution_ = paired_depth_sources_.front()->config.voxel_z_resolution_m;
|
||||
const auto& source = paired_depth_sources_.front();
|
||||
if (!size_z_ || size_z_ > VOXEL_BITS || source->min_height < origin_z_ ||
|
||||
source->max_height > origin_z_ + size_z_ * z_resolution_)
|
||||
throw std::invalid_argument("observed_volume marking height band must fit its voxel grid");
|
||||
robot::log_info("observed_volume grid: z_resolution=%.4f m bins=%u span=[%.3f, %.3f) m\n",
|
||||
z_resolution_, size_z_, origin_z_, origin_z_ + size_z_ * z_resolution_);
|
||||
}
|
||||
this->matchSize();
|
||||
}
|
||||
catch (const YAML::BadFile& e) {
|
||||
@@ -159,6 +183,7 @@ void VoxelLayer::reset()
|
||||
|
||||
void VoxelLayer::resetMaps()
|
||||
{
|
||||
resetPairedDepth();
|
||||
Costmap2D::resetMaps();
|
||||
robot_voxel_grid_.reset();
|
||||
}
|
||||
@@ -170,6 +195,13 @@ void VoxelLayer::updateBounds(double robot_x, double robot_y, double robot_yaw,
|
||||
updateOrigin(robot_x - getSizeInMetersX() / 2, robot_y - getSizeInMetersY() / 2);
|
||||
useExtraBounds(min_x, min_y, max_x, max_y);
|
||||
|
||||
if (!paired_depth_sources_.empty() &&
|
||||
(!static_marking_observations_.empty() || !static_clearing_observations_.empty()))
|
||||
{
|
||||
current_ = false;
|
||||
robot::log_error_throttle(5.0, "observed_volume cannot share its voxel grid with static observations\n");
|
||||
return;
|
||||
}
|
||||
bool current = true;
|
||||
std::vector<Observation> observations, clearing_observations;
|
||||
std::vector<DepthCameraObservation> depth_observations;
|
||||
@@ -196,10 +228,17 @@ void VoxelLayer::updateBounds(double robot_x, double robot_y, double robot_yaw,
|
||||
raytraceFreespace(clearing_observations[i], min_x, min_y, max_x, max_y);
|
||||
}
|
||||
|
||||
// place the new obstacles into a priority queue... each with a priority of zero to begin with
|
||||
for (std::vector<Observation>::const_iterator it = observations.begin(); it != observations.end(); ++it)
|
||||
{
|
||||
const Observation& obs = *it;
|
||||
for (const auto& observation : observations)
|
||||
markObservation(observation, min_x, min_y, max_x, max_y);
|
||||
|
||||
processPairedDepth(min_x, min_y, max_x, max_y);
|
||||
current_ = current_ && pairedDepthCurrent();
|
||||
updateFootprint(robot_x, robot_y, robot_yaw, min_x, min_y, max_x, max_y);
|
||||
}
|
||||
|
||||
void VoxelLayer::markObservation(const Observation& obs, double* min_x, double* min_y,
|
||||
double* max_x, double* max_y)
|
||||
{
|
||||
|
||||
const robot_sensor_msgs::PointCloud2& cloud = *(obs.cloud_);
|
||||
|
||||
@@ -245,8 +284,96 @@ void VoxelLayer::updateBounds(double robot_x, double robot_y, double robot_yaw,
|
||||
touch(double(*iter_x), double(*iter_y), min_x, min_y, max_x, max_y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VoxelLayer::processPairedDepth(double* min_x, double* min_y, double* max_x, double* max_y)
|
||||
{
|
||||
for (const auto& source : paired_depth_sources_)
|
||||
{
|
||||
DepthFramePairer::Candidate pair;
|
||||
while (source->pairer.next(pair))
|
||||
{
|
||||
tf3::TransformStampedMsg pose;
|
||||
try
|
||||
{
|
||||
pose = tf_->lookupTransform(global_frame_, pair.cloud->header.frame_id,
|
||||
data_convert::convertTime(pair.cloud->header.stamp));
|
||||
}
|
||||
catch (const tf3::TransformException& ex)
|
||||
{
|
||||
source->pairer.noteTfWait();
|
||||
robot::log_error_throttle(5.0, "paired depth waiting for measurement TF: %s\n", ex.what());
|
||||
break; // retain occupancy and bounded pending pair, never use latest TF
|
||||
}
|
||||
DepthVisibilityChecker checker;
|
||||
if (!checker.prepare(pair.depth, pose, source->min_height,
|
||||
std::min(source->max_height, max_obstacle_height_), source->config))
|
||||
{
|
||||
source->pairer.discard(pair.stamp);
|
||||
robot::log_error_throttle(5.0, "paired depth rejected invalid image/model/pose\n");
|
||||
continue;
|
||||
}
|
||||
std::vector<Observation> observations;
|
||||
bool buffered;
|
||||
{
|
||||
std::lock_guard<ObservationBuffer> guard(*source->marking_buffer);
|
||||
buffered = source->marking_buffer->tryBufferCloudWithTransform(*pair.cloud, pose);
|
||||
if (buffered) source->marking_buffer->getObservations(observations);
|
||||
}
|
||||
if (!buffered || observations.size() != 1 ||
|
||||
observations.front().cloud_->header.stamp.toNSec() != pair.stamp)
|
||||
{
|
||||
source->pairer.discard(pair.stamp);
|
||||
continue; // no partial clear when marking branch cannot be prepared
|
||||
}
|
||||
|
||||
// No occupied cache: the live voxel grid already contains rolling-window overlap.
|
||||
// Plan all clears before applying this frame; both branches share exactly one pose.
|
||||
std::vector<std::array<unsigned int, 3>> free_voxels;
|
||||
for (unsigned int y = 0; y < size_y_; ++y)
|
||||
for (unsigned int x = 0; x < size_x_; ++x)
|
||||
{
|
||||
if (!(robot_voxel_grid_.getData()[getIndex(x, y)] >> 16)) continue;
|
||||
for (unsigned int z = 0; z < size_z_; ++z)
|
||||
{
|
||||
if (robot_voxel_grid_.getVoxel(x, y, z) != robot_voxel_grid::MARKED) continue;
|
||||
const Eigen::Vector3d lower(origin_x_ + x * resolution_,
|
||||
origin_y_ + y * resolution_, origin_z_ + z * z_resolution_);
|
||||
const Eigen::Vector3d upper = lower + Eigen::Vector3d(resolution_, resolution_, z_resolution_);
|
||||
const auto visibility = checker.classify(lower, upper);
|
||||
if (visibility.state == DepthVisibility::Free)
|
||||
{ free_voxels.push_back({x, y, z}); ++visibility_counts_.free; }
|
||||
else if (visibility.state == DepthVisibility::Surface) ++visibility_counts_.surface;
|
||||
else ++visibility_counts_.unknown;
|
||||
}
|
||||
}
|
||||
for (const auto& voxel : free_voxels)
|
||||
{
|
||||
const auto x = voxel[0], y = voxel[1], z = voxel[2];
|
||||
robot_voxel_grid_.clearVoxel(x, y, z);
|
||||
const auto status = robot_voxel_grid_.getVoxelColumn(x, y, unknown_threshold_, mark_threshold_);
|
||||
costmap_[getIndex(x, y)] = status == robot_voxel_grid::MARKED ? LETHAL_OBSTACLE :
|
||||
status == robot_voxel_grid::FREE ? FREE_SPACE : NO_INFORMATION;
|
||||
// Include whole cell so master/inflation can remove the former obstacle.
|
||||
touch(origin_x_ + x * resolution_, origin_y_ + y * resolution_, min_x, min_y, max_x, max_y);
|
||||
touch(origin_x_ + (x + 1) * resolution_, origin_y_ + (y + 1) * resolution_, min_x, min_y, max_x, max_y);
|
||||
}
|
||||
markObservation(observations.front(), min_x, min_y, max_x, max_y);
|
||||
source->pairer.applied(pair.stamp);
|
||||
++visibility_counts_.frames;
|
||||
}
|
||||
const auto counts = source->pairer.counts();
|
||||
robot::log_info_throttle(5.0, "paired depth [%s]: applied=%llu tf_wait=%llu "
|
||||
"invalid=%llu stale=%llu expired=%llu overflow=%llu duplicate=%llu; "
|
||||
"voxel decisions free=%llu surface=%llu unknown=%llu (cumulative)\n",
|
||||
name_.c_str(), static_cast<unsigned long long>(counts.applied),
|
||||
static_cast<unsigned long long>(counts.tf_wait), static_cast<unsigned long long>(counts.invalid),
|
||||
static_cast<unsigned long long>(counts.stale), static_cast<unsigned long long>(counts.expired),
|
||||
static_cast<unsigned long long>(counts.overflow), static_cast<unsigned long long>(counts.duplicate),
|
||||
static_cast<unsigned long long>(visibility_counts_.free),
|
||||
static_cast<unsigned long long>(visibility_counts_.surface),
|
||||
static_cast<unsigned long long>(visibility_counts_.unknown));
|
||||
}
|
||||
updateFootprint(robot_x, robot_y, robot_yaw, min_x, min_y, max_x, max_y);
|
||||
}
|
||||
|
||||
void VoxelLayer::clearNonLethal(double wx, double wy, double w_size_x, double w_size_y, bool clear_no_info)
|
||||
@@ -606,7 +733,13 @@ bool VoxelLayer::raytraceDepthFrustum(const DepthCameraObservation& observation,
|
||||
tf3::TransformStampedMsg tfm;
|
||||
try
|
||||
{
|
||||
tfm = tf_->lookupTransform(global_frame_, depth_frame, tf3::Time());
|
||||
const robot::Time& depth_stamp = local_origin.header.stamp;
|
||||
const tf3::Time query_time =
|
||||
depth_stamp.isZero()
|
||||
? tf3::Time()
|
||||
: tf3::Time(depth_stamp.sec, depth_stamp.nsec);
|
||||
|
||||
tfm = tf_->lookupTransform(global_frame_, depth_frame, query_time);
|
||||
tf3::doTransform(local_origin, global_origin, tfm);
|
||||
}
|
||||
catch (tf3::TransformException& ex)
|
||||
@@ -977,8 +1110,10 @@ void VoxelLayer::updateOrigin(double new_origin_x, double new_origin_y)
|
||||
cell_size_x, cell_size_x, cell_size_y);
|
||||
}
|
||||
|
||||
// we'll reset our maps to unknown space if appropriate
|
||||
resetMaps();
|
||||
// Shift storage without resetting the paired input queue. A newly received
|
||||
// measurement must still apply after the rolling origin moves this cycle.
|
||||
Costmap2D::resetMaps();
|
||||
robot_voxel_grid_.reset();
|
||||
|
||||
// update the origin with the appropriate world coordinates
|
||||
origin_x_ = new_grid_ox;
|
||||
|
||||
Reference in New Issue
Block a user