Skip to content

Commit

Permalink
Followup to PR 2413 for main branch (fix for operator= in observation…
Browse files Browse the repository at this point in the history
….hpp) (#2425)

* in observation.hpp fixed operator=

* style fix
  • Loading branch information
topin89 authored Jun 28, 2021
1 parent f201b4f commit c616cf0
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions nav2_costmap_2d/include/nav2_costmap_2d/observation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,20 @@ class Observation
}

/**
* @brief Explicitly define copy assignment operator for Observation as it has a user-declared destructor
*/
Observation & operator=(const Observation &) = default;
* @brief Copy assignment operator
* @param obs The observation to copy
*/
Observation & operator=(const Observation & obs)
{
origin_ = obs.origin_;
cloud_ = new sensor_msgs::msg::PointCloud2(*(obs.cloud_));
obstacle_max_range_ = obs.obstacle_max_range_;
obstacle_min_range_ = obs.obstacle_min_range_;
raytrace_max_range_ = obs.raytrace_max_range_;
raytrace_min_range_ = obs.raytrace_min_range_;

return *this;
}

/**
* @brief Creates an observation from an origin point and a point cloud
Expand Down

0 comments on commit c616cf0

Please sign in to comment.