Skip to content

Commit

Permalink
removed the deep copy for the costmap_raw_ data using memcpy (#4919)
Browse files Browse the repository at this point in the history
Signed-off-by: doublebrackets <[email protected]>
  • Loading branch information
glitchhopcore authored Feb 13, 2025
1 parent b44f706 commit 4694386
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions nav2_costmap_2d/src/costmap_2d_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,7 @@ void Costmap2DPublisher::prepareCostmap()
costmap_raw_->data.resize(costmap_raw_->metadata.size_x * costmap_raw_->metadata.size_y);

unsigned char * data = costmap_->getCharMap();
for (unsigned int i = 0; i < costmap_raw_->data.size(); i++) {
costmap_raw_->data[i] = data[i];
}
memcpy(costmap_raw_->data.data(), data, costmap_raw_->data.size());
}

std::unique_ptr<map_msgs::msg::OccupancyGridUpdate> Costmap2DPublisher::createGridUpdateMsg()
Expand Down

0 comments on commit 4694386

Please sign in to comment.