@@ -64,6 +64,7 @@ void VoxelLayer::onInitialize()
6464
6565 declareParameter (" enabled" , rclcpp::ParameterValue (true ));
6666 declareParameter (" footprint_clearing_enabled" , rclcpp::ParameterValue (true ));
67+ declareParameter (" min_obstacle_height" , rclcpp::ParameterValue (0.0 ));
6768 declareParameter (" max_obstacle_height" , rclcpp::ParameterValue (2.0 ));
6869 declareParameter (" z_voxels" , rclcpp::ParameterValue (10 ));
6970 declareParameter (" origin_z" , rclcpp::ParameterValue (0.0 ));
@@ -80,6 +81,7 @@ void VoxelLayer::onInitialize()
8081
8182 node->get_parameter (name_ + " ." + " enabled" , enabled_);
8283 node->get_parameter (name_ + " ." + " footprint_clearing_enabled" , footprint_clearing_enabled_);
84+ node->get_parameter (name_ + " ." + " min_obstacle_height" , min_obstacle_height_);
8385 node->get_parameter (name_ + " ." + " max_obstacle_height" , max_obstacle_height_);
8486 node->get_parameter (name_ + " ." + " z_voxels" , size_z_);
8587 node->get_parameter (name_ + " ." + " origin_z" , origin_z_);
@@ -193,6 +195,11 @@ void VoxelLayer::updateBounds(
193195 sensor_msgs::PointCloud2ConstIterator<float > iter_z (cloud, " z" );
194196
195197 for (; iter_x != iter_x.end (); ++iter_x, ++iter_y, ++iter_z) {
198+ // if the obstacle is too low, we won't add it
199+ if (*iter_z < min_obstacle_height_) {
200+ continue ;
201+ }
202+
196203 // if the obstacle is too high or too far away from the robot we won't add it
197204 if (*iter_z > max_obstacle_height_) {
198205 continue ;
@@ -515,7 +522,9 @@ VoxelLayer::dynamicParametersCallback(
515522 }
516523
517524 if (param_type == ParameterType::PARAMETER_DOUBLE) {
518- if (param_name == name_ + " ." + " max_obstacle_height" ) {
525+ if (param_name == name_ + " ." + " min_obstacle_height" ) {
526+ min_obstacle_height_ = parameter.as_double ();
527+ } else if (param_name == name_ + " ." + " max_obstacle_height" ) {
519528 max_obstacle_height_ = parameter.as_double ();
520529 } else if (param_name == name_ + " ." + " origin_z" ) {
521530 origin_z_ = parameter.as_double ();
0 commit comments