The obstacles_critics of MPPI and SMAC_planner are tightly related to the nav2_costmap_2d::InflationLayer.
https://github.com/ros-planning/navigation2/blob/2f1f9e4a225f912c4c1ae9821fb7eb31ac192c16/nav2_mppi_controller/src/critics/obstacles_critic.cpp#L52-L55
To use a custom version of the inflation layer with the MPPI/SMAC, the custom layer needs to inherit from the inflation layer.
But the inflation_layer isn't adapted to inheritance, there are private members and methods.
Required Info:
- Operating System:
- ROS2 Version:
- Version or commit hash:
- DDS implementation:
Expected behavior
When using a child class of inflation_layer, all the methods should work.
Actual behavior
When using a child class of inflation_layer, the attributes are not shared, so some methods, like getCostScalingFactor(), don't return the real value.
Implementation considerations
We fixed this by removing the private: keyword in the inflation_layer header file.
https://github.com/ros-planning/navigation2/blob/2f1f9e4a225f912c4c1ae9821fb7eb31ac192c16/nav2_costmap_2d/include/nav2_costmap_2d/inflation_layer.hpp#L185-L191C9
The
obstacles_criticsof MPPI and SMAC_planner are tightly related to thenav2_costmap_2d::InflationLayer.https://github.com/ros-planning/navigation2/blob/2f1f9e4a225f912c4c1ae9821fb7eb31ac192c16/nav2_mppi_controller/src/critics/obstacles_critic.cpp#L52-L55
To use a custom version of the inflation layer with the MPPI/SMAC, the custom layer needs to inherit from the inflation layer.
But the
inflation_layerisn't adapted to inheritance, there are private members and methods.Required Info:
Expected behavior
When using a child class of
inflation_layer, all the methods should work.Actual behavior
When using a child class of
inflation_layer, the attributes are not shared, so some methods, like getCostScalingFactor(), don't return the real value.Implementation considerations
We fixed this by removing the
private:keyword in theinflation_layerheader file.https://github.com/ros-planning/navigation2/blob/2f1f9e4a225f912c4c1ae9821fb7eb31ac192c16/nav2_costmap_2d/include/nav2_costmap_2d/inflation_layer.hpp#L185-L191C9