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:
@@ -165,6 +165,28 @@ Costmap2D::Costmap2D(const Costmap2D& map) :
|
||||
*this = map;
|
||||
}
|
||||
|
||||
void Costmap2D::copyFrom(const Costmap2D& map)
|
||||
{
|
||||
if (this == &map)
|
||||
return;
|
||||
|
||||
boost::unique_lock<mutex_t> lock(*access_);
|
||||
if (costmap_ == NULL || size_x_ != map.size_x_ || size_y_ != map.size_y_)
|
||||
{
|
||||
delete[] costmap_;
|
||||
costmap_ = new unsigned char[static_cast<std::size_t>(map.size_x_) * map.size_y_];
|
||||
size_x_ = map.size_x_;
|
||||
size_y_ = map.size_y_;
|
||||
}
|
||||
|
||||
resolution_ = map.resolution_;
|
||||
origin_x_ = map.origin_x_;
|
||||
origin_y_ = map.origin_y_;
|
||||
default_value_ = map.default_value_;
|
||||
memcpy(costmap_, map.costmap_,
|
||||
static_cast<std::size_t>(size_x_) * size_y_ * sizeof(unsigned char));
|
||||
}
|
||||
|
||||
// just initialize everything to NULL by default
|
||||
Costmap2D::Costmap2D() :
|
||||
size_x_(0), size_y_(0), resolution_(0.0), origin_x_(0.0), origin_y_(0.0), costmap_(NULL)
|
||||
@@ -288,11 +310,17 @@ void Costmap2D::updateOrigin(double new_origin_x, double new_origin_y)
|
||||
unsigned int cell_size_x = upper_right_x - lower_left_x;
|
||||
unsigned int cell_size_y = upper_right_y - lower_left_y;
|
||||
|
||||
// we need a map to store the obstacles in the window temporarily
|
||||
unsigned char* local_map = new unsigned char[cell_size_x * cell_size_y];
|
||||
const std::size_t overlap_size = static_cast<std::size_t>(cell_size_x) * cell_size_y;
|
||||
|
||||
// copy the local window in the costmap to the local map
|
||||
copyMapRegion(costmap_, lower_left_x, lower_left_y, size_x_, local_map, 0, 0, cell_size_x, cell_size_x, cell_size_y);
|
||||
// Reuse the temporary window to avoid allocating on every rolling-window shift.
|
||||
rolling_window_scratch_.resize(overlap_size);
|
||||
unsigned char* local_map = rolling_window_scratch_.data();
|
||||
|
||||
if (overlap_size > 0)
|
||||
{
|
||||
copyMapRegion(costmap_, lower_left_x, lower_left_y, size_x_, local_map, 0, 0,
|
||||
cell_size_x, cell_size_x, cell_size_y);
|
||||
}
|
||||
|
||||
// now we'll set the costmap to be completely unknown if we track unknown space
|
||||
resetMaps();
|
||||
@@ -306,10 +334,12 @@ void Costmap2D::updateOrigin(double new_origin_x, double new_origin_y)
|
||||
int start_y = lower_left_y - cell_oy;
|
||||
|
||||
// now we want to copy the overlapping information back into the map, but in its new location
|
||||
copyMapRegion(local_map, 0, 0, cell_size_x, costmap_, start_x, start_y, size_x_, cell_size_x, cell_size_y);
|
||||
if (overlap_size > 0)
|
||||
{
|
||||
copyMapRegion(local_map, 0, 0, cell_size_x, costmap_, start_x, start_y,
|
||||
size_x_, cell_size_x, cell_size_y);
|
||||
}
|
||||
|
||||
// make sure to clean up
|
||||
delete[] local_map;
|
||||
}
|
||||
|
||||
bool Costmap2D::setConvexPolygonCost(const std::vector<robot_geometry_msgs::Point>& polygon, unsigned char cost_value)
|
||||
|
||||
Reference in New Issue
Block a user