update
This commit is contained in:
@@ -174,6 +174,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_;
|
||||
|
||||
@@ -602,36 +602,21 @@ bool VoxelLayer::raytraceDepthFrustum(const DepthCameraObservation& observation,
|
||||
local_origin.point.y = 0.0;
|
||||
local_origin.point.z = 0.0;
|
||||
|
||||
// Look up the sensor pose at the depth image's CAPTURE time, not the latest
|
||||
// transform. The costmap update runs later than the frame was captured, so
|
||||
// during rotation the latest pose orients the clearing frustum where the depth
|
||||
// pixels were never measured from; the fan's free rays then sweep across and
|
||||
// erase freshly marked cells, and the trailing side that gets erased flips
|
||||
// with rotation direction. A stamped lookup keeps the frustum geometrically
|
||||
// consistent with its own pixels. If the transform at that stamp is
|
||||
// unavailable (stale / would extrapolate), skip clearing this cycle instead of
|
||||
// clearing from a wrong pose. Falls back to latest only when the frame carries
|
||||
// no stamp.
|
||||
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);
|
||||
|
||||
robot_geometry_msgs::PointStamped global_origin;
|
||||
tf3::TransformStampedMsg tfm;
|
||||
try
|
||||
{
|
||||
tfm = tf_->lookupTransform(global_frame_, depth_frame, query_time);
|
||||
tfm = tf_->lookupTransform(global_frame_, depth_frame, tf3::Time());
|
||||
tf3::doTransform(local_origin, global_origin, tfm);
|
||||
}
|
||||
catch (tf3::TransformException& ex)
|
||||
{
|
||||
robot::log_error_throttle(
|
||||
5.0, "VoxelLayer depth topic [%s] TF exception from %s to %s at t=%.3f: %s\n",
|
||||
observation.topic_.c_str(), depth_frame.c_str(), global_frame_.c_str(),
|
||||
query_time.toSec(), ex.what());
|
||||
5.0, "VoxelLayer depth topic [%s] TF exception from %s to %s: %s\n",
|
||||
observation.topic_.c_str(), depth_frame.c_str(), global_frame_.c_str(), ex.what());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const double ox = global_origin.point.x;
|
||||
const double oy = global_origin.point.y;
|
||||
const double oz = global_origin.point.z;
|
||||
|
||||
@@ -573,6 +573,7 @@ void Costmap2DROBOT::readFootprintFromConfig(const std::vector<robot_geometry_ms
|
||||
|
||||
void Costmap2DROBOT::setUnpaddedRobotFootprint(const std::vector<robot_geometry_msgs::Point>& points)
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock lock(configuration_mutex_);
|
||||
unpadded_footprint_ = points;
|
||||
padded_footprint_ = points;
|
||||
padFootprint(padded_footprint_, footprint_padding_);
|
||||
@@ -604,6 +605,7 @@ void Costmap2DROBOT::mapUpdateLoop(double frequency)
|
||||
|
||||
void Costmap2DROBOT::updateMap()
|
||||
{
|
||||
boost::recursive_mutex::scoped_lock lock(configuration_mutex_);
|
||||
if (!stop_updates_)
|
||||
{
|
||||
// get global pose
|
||||
|
||||
Reference in New Issue
Block a user