Skip to content

Commit 434b6e9

Browse files
committed
Add adaptive_max_radius YAML parameter to clamp burn-in radius growth
- Add adaptive_max_radius parameter to YAML config - Read adaptive_max_radius from YAML in both MAB_RRT and MAB_RRT_DEBUG - Clamp radius to adaptive_max_radius during grow steps if it exceeds the limit - If YAML value is set, it overrides computed state space bounds value - Tested successfully with toy5.csv - radius clamped from 36.6 to 25.0
1 parent e621516 commit 434b6e9

3 files changed

Lines changed: 35 additions & 9 deletions

File tree

demos/disassembly/benchmark_baseline.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ forced_uniform_after_cylinder_valid_streak: 5
2323
adaptive_quasirandom_sample_size : 64
2424
adaptive_start_radius : 1.0
2525
adaptive_min_radius : 0.000001
26+
adaptive_max_radius : 25.0
2627
# Direct multipliers (no exp() applied)
2728
# To maintain same behavior as exp(-0.7) and exp(0.9):
2829
# exp(-0.7) ≈ 0.496585 (shrinks by this factor)

src/ompl/geometric/planners/disassemblyrrt/src/MAB_RRT.cpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,12 @@ void ompl::geometric::MAB_RRT::loadYAMLConfig(const std::string& yamlFilePath)
183183
config["adaptive_shrink_step"].as<double>() : 0.1;
184184
adaptiveGrowStep_ = config["adaptive_grow_step"] ?
185185
config["adaptive_grow_step"].as<double>() : 0.1;
186+
187+
// Maximum radius limit (from YAML, or computed from state space bounds if not provided)
188+
if (config["adaptive_max_radius"])
189+
{
190+
adaptiveMaxRadius_ = config["adaptive_max_radius"].as<double>();
191+
}
186192

187193
// ----- Initial Uniform Check -----
188194
// Early exit optimization if problem is "easy" (high uniform validity)
@@ -288,11 +294,15 @@ void ompl::geometric::MAB_RRT::setup()
288294

289295
// Compute maximum allowed burn-in radius from state space bounds
290296
// Do this after initializeArms() to ensure state space is fully set up
291-
try {
292-
adaptiveMaxRadius_ = computeMaxBurninRadius();
293-
} catch (const std::exception& e) {
294-
OMPL_WARN("Failed to compute max burn-in radius: %s. Using default.", e.what());
295-
adaptiveMaxRadius_ = 1000.0;
297+
// Only compute if not already set from YAML config
298+
if (adaptiveMaxRadius_ == std::numeric_limits<double>::infinity())
299+
{
300+
try {
301+
adaptiveMaxRadius_ = computeMaxBurninRadius();
302+
} catch (const std::exception& e) {
303+
OMPL_WARN("Failed to compute max burn-in radius: %s. Using default.", e.what());
304+
adaptiveMaxRadius_ = 1000.0;
305+
}
296306
}
297307
}
298308

src/ompl/geometric/planners/disassemblyrrt/src/MAB_RRT_DEBUG.cpp

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,13 @@
194194
adaptiveMaxExpectedValidityRate_ = config["adaptive_max_expected_validity_rate"].as<double>();
195195
adaptiveBurninMaxSteps_ = config["adaptive_burnin_max_steps"] ?
196196
config["adaptive_burnin_max_steps"].as<int>() : 10;
197+
198+
// Maximum radius limit (from YAML, or computed from state space bounds if not provided)
199+
if (config["adaptive_max_radius"])
200+
{
201+
adaptiveMaxRadius_ = config["adaptive_max_radius"].as<double>();
202+
OMPL_INFORM("DEBUG: Loaded adaptive_max_radius from YAML = %.10f", adaptiveMaxRadius_);
203+
}
197204

198205
// ----- Initial Uniform Check -----
199206
// Early exit optimization if problem is "easy" (high uniform validity)
@@ -296,10 +303,18 @@
296303

297304
initializeArms();
298305

299-
// Compute maximum allowed burn-in radius from state space bounds
300-
// Do this after initializeArms() to ensure state space is fully set up
301-
adaptiveMaxRadius_ = computeMaxBurninRadius();
302-
OMPL_INFORM("DEBUG: Computed max burn-in radius from state space bounds: %.6f", adaptiveMaxRadius_);
306+
// Compute maximum allowed burn-in radius from state space bounds
307+
// Do this after initializeArms() to ensure state space is fully set up
308+
// Only compute if not already set from YAML config
309+
if (adaptiveMaxRadius_ == std::numeric_limits<double>::infinity())
310+
{
311+
adaptiveMaxRadius_ = computeMaxBurninRadius();
312+
OMPL_INFORM("DEBUG: Computed max burn-in radius from state space bounds: %.6f", adaptiveMaxRadius_);
313+
}
314+
else
315+
{
316+
OMPL_INFORM("DEBUG: Using adaptive_max_radius from YAML: %.6f", adaptiveMaxRadius_);
317+
}
303318
}
304319

305320
/**

0 commit comments

Comments
 (0)