{{ message }}
Add tree balancing heuristic to RRTConnect#1328
Open
saahu27 wants to merge 1 commit into
Open
Conversation
Implement tree size balancing in RRTConnect to improve exploration efficiency in high-dimensional configuration spaces. This addresses a known optimization where preferentially extending the smaller tree prevents one tree from dominating exploration, as recommended by Kuffner and implemented in the VAMP library. Changes: - Add balanceTreeSizes_ parameter (default: true) to enable/disable tree balancing heuristic - Add maxTreeSizeRatio_ parameter (default: 1.0) to control the threshold for tree size imbalance before balancing kicks in - Modify solve() method to check tree size ratio and extend the smaller tree when imbalance exceeds threshold - Add parameter declarations for runtime configuration - Add getter/setter methods for new parameters The heuristic compares tree sizes and only swaps when the size ratio is below the threshold, ensuring balanced exploration. This is particularly beneficial for robot motion planning in cluttered environments where one tree may get trapped while the other explores freely. Based on VAMP's RRTConnect implementation at: external/vamp/src/impl/vamp/planning/rrtc.hh
mamoll
requested changes
Oct 3, 2025
Member
There was a problem hiding this comment.
sizeRatio is always <=1. You need to get rid of the std::max
cf. https://github.com/KavrakiLab/vamp/blob/main/src/impl/vamp/planning/rrtc.hh#L102
Member
There was a problem hiding this comment.
this bunch of ifs is unnecessarily complicated
cf. https://github.com/KavrakiLab/vamp/blob/main/src/impl/vamp/planning/rrtc.hh#L104
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Overview
This implementation adds the tree balancing heuristic to OMPL's RRT-Connect planner, aligning it with the approach used in the VAMP library and recommended by James Kuffner (co-author of RRT-Connect).
Problem Statement
The original OMPL RRT-Connect implementation blindly alternates between the start and goal trees every iteration, regardless of their sizes. This can lead to imbalanced trees where one tree dominates exploration, reducing planning efficiency.
Solution: Tree Balancing Heuristic
The tree balancing heuristic preferentially extends the smaller tree to keep both trees roughly balanced. This prevents one tree from dominating exploration.
Research Background
Source: CMU Lecture slides on RRT-Connect by Howie Choset (with slides from James Kuffner)
Original Paper:
Proc. 2000 IEEE Intl. Conf. on Robotics and Automation, pp. 995–1001, Apr. 2000.
VAMP Implementation Reference
The VAMP library implements this heuristic in
external/vamp/src/impl/vamp/planning/rrtc.hh:Implementation Details
New Parameters
Two new configurable parameters have been added to
RRTConnect:balance_tree_sizes(bool, default:true)true, the planner preferentially extends the smaller treefalse, reverts to blind alternation (original behavior)max_tree_size_ratio(double, default:1.0)Modified Logic
The new implementation (lines 248-271 in
RRTConnect.cpp):API Changes
Header file changes (
RRTConnect.h):balanceTreeSizes_member variable (bool, default:true)maxTreeSizeRatio_member variable (double, default:1.0)setBalanceTreeSizes(bool)/getBalanceTreeSizes()methodssetMaxTreeSizeRatio(double)/getMaxTreeSizeRatio()methodsImplementation changes (
RRTConnect.cpp):solve()method to implement tree balancing logicBackward Compatibility
Fully backward compatible:
ratio = 1.0planner->setBalanceTreeSizes(false)Testing
Automated Tests
cd build && ctest -R test_2dmap_geometric_simpleManual Testing
Parameters can be configured via:
Or via parameter introspection:
Files Modified
src/ompl/geometric/planners/rrt/RRTConnect.hsrc/ompl/geometric/planners/rrt/src/RRTConnect.cppsolve()(+26 lines)Total changes: ~72 lines of code (minimal, non-breaking)
Performance Implications
Expected Benefits
Potential Trade-offs
Usage Examples
Example 1: Default (Balanced)
Example 2: Disable Balancing (Original Behavior)
Example 3: Strict Balancing
References
IEEE International Conference on Robotics and Automation.
https://www.cs.cmu.edu/~motionplanning/lecture/lec20.pdf
Implementation:
external/vamp/src/impl/vamp/planning/rrtc.hh