Don't set Grid/RangeMax to 0 by default when subscribing to lidar while Grid/FromDepth is explicitly set to true

This commit is contained in:
matlabbe
2020-06-03 16:35:40 -04:00
parent 6f8b8b2917
commit 438cb1c1f0
+6 -3
View File
@@ -400,6 +400,7 @@ void CoreWrapper::onInit()
bool subscribeScan3d = false;
pnh.param("subscribe_scan", subscribeScan2d, subscribeScan2d);
pnh.param("subscribe_scan_cloud", subscribeScan3d, subscribeScan3d);
bool gridFromDepth = Parameters::defaultGridFromDepth();
if((subscribeScan2d || subscribeScan3d) && parameters_.find(Parameters::kGridFromDepth()) == parameters_.end())
{
NODELET_WARN("Setting \"%s\" parameter to false (default true) as \"subscribe_scan\" or \"subscribe_scan_cloud\" is "
@@ -412,11 +413,13 @@ void CoreWrapper::onInit()
Parameters::kGridFromDepth().c_str());
parameters_.insert(ParametersPair(Parameters::kGridFromDepth(), "false"));
}
if((subscribeScan2d || subscribeScan3d) && parameters_.find(Parameters::kGridRangeMax()) == parameters_.end())
Parameters::parse(parameters_, Parameters::kGridFromDepth(), gridFromDepth);
if((subscribeScan2d || subscribeScan3d) && parameters_.find(Parameters::kGridRangeMax()) == parameters_.end() && !gridFromDepth)
{
NODELET_INFO("Setting \"%s\" parameter to 0 (default %f) as \"subscribe_scan\" or \"subscribe_scan_cloud\" is true.",
NODELET_INFO("Setting \"%s\" parameter to 0 (default %f) as \"subscribe_scan\" or \"subscribe_scan_cloud\" is true and %s is false.",
Parameters::kGridRangeMax().c_str(),
Parameters::defaultGridRangeMax());
Parameters::defaultGridRangeMax(),
Parameters::kGridFromDepth().c_str());
parameters_.insert(ParametersPair(Parameters::kGridRangeMax(), "0"));
}
if(subscribeScan3d && parameters_.find(Parameters::kIcpPointToPlaneRadius()) == parameters_.end())