Bring main up to the dev_cam_intel line
main had not moved since 11 July, while the depth-camera work continued on
dev_cam_intel for six weeks. The two branches did not diverge by accident: they
ended up holding two different clearing designs for the same layer.
main carried frustum clearing as VoxelLayer members - frustum_clearing_enabled_,
a pixel step and a min/max range - driven from costmap_2d_robot. dev_cam_intel
replaced that with a full-column clearing pass whose configuration lives per
observation, so the layer keeps no frustum state of its own.
This commit takes the dev_cam_intel tree whole. It is the line running on the
robot, the one rb_ws points at, and the one the NUC measurements were taken
against; the frustum design is superseded rather than merged, and stays in
history at 45c8227 if it is ever wanted back.
Squashed deliberately: the nineteen commits behind it are a working diary -
metrics that were added and removed, test toggles, an optimal-run series - and
none of that is worth carrying onto a branch other trees track.
This commit is contained in:
@@ -157,6 +157,35 @@ public:
|
||||
return layered_costmap_->getCostmap();
|
||||
}
|
||||
|
||||
/** @brief Whether readers should work on a snapshot copy instead of the
|
||||
* live master grid (config key "snapshot_for_readers", default false).
|
||||
*
|
||||
* With snapshots on, a reader calls refreshSnapshot() once per cycle and
|
||||
* then reads getCostmapForRead() without holding the master mutex during
|
||||
* its whole computation — the mutex is only held for the memcpy inside
|
||||
* refreshSnapshot(). With snapshots off, getCostmapForRead() returns the
|
||||
* live master grid and the reader must keep the legacy long lock. */
|
||||
inline bool isSnapshotEnabled() const noexcept
|
||||
{
|
||||
return snapshot_enabled_;
|
||||
}
|
||||
|
||||
/** @brief Re-copy the master grid into the internal snapshot.
|
||||
*
|
||||
* Locks the master mutex only for the duration of the copy. Single-consumer
|
||||
* contract: refreshSnapshot() and reads of getCostmapForRead() must happen
|
||||
* on the same thread (the control loop) — the snapshot itself is not
|
||||
* additionally locked. No-op while snapshots are disabled. */
|
||||
void refreshSnapshot();
|
||||
|
||||
/** @brief Grid a reader should compute on: the snapshot when enabled,
|
||||
* otherwise the live master costmap.
|
||||
*
|
||||
* The returned pointer stays stable for the lifetime of this object —
|
||||
* the snapshot buffer is reused between refreshes, never reallocated as an
|
||||
* object. Never returns null. */
|
||||
Costmap2D* getCostmapForRead();
|
||||
|
||||
/**
|
||||
* @brief Returns the global frame of the costmap
|
||||
* @return The global frame of the costmap
|
||||
@@ -174,6 +203,17 @@ public:
|
||||
{
|
||||
return robot_base_frame_;
|
||||
}
|
||||
|
||||
/** @brief Return the TF buffer shared by the costmap and navigation plugins.
|
||||
*
|
||||
* The returned reference is non-owning and remains valid only for the
|
||||
* lifetime of this Costmap2DROBOT instance.
|
||||
*/
|
||||
inline tf3::BufferCore& getTfBuffer() noexcept
|
||||
{
|
||||
return tf_;
|
||||
}
|
||||
|
||||
LayeredCostmap* getLayeredCostmap() const
|
||||
{
|
||||
return layered_costmap_;
|
||||
@@ -279,6 +319,11 @@ private:
|
||||
robot_geometry_msgs::PolygonStamped footprint_;
|
||||
float footprint_padding_;
|
||||
|
||||
// Reader-side snapshot of the master grid (see getCostmapForRead()).
|
||||
// Stable object: refreshed in place, so readers may hold the pointer.
|
||||
Costmap2D costmap_snapshot_;
|
||||
bool snapshot_enabled_ = false;
|
||||
|
||||
private:
|
||||
void getParams(const std::string& config_file_name,const std::string& name, robot::NodeHandle& nh);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user