/// <summary>
        ///     Constructor for the Planar Informed RRT algorithm.
        ///     It uses a more adapted strategy with various attempts:
        ///     1) try to reach the target in a straight line.
        ///     2) If reaching the target in a straight line fails, a search for a path on the vertical and then on the horizontal
        ///     plane, defined by the connecting line from the
        ///     start to the goal position is attempted. Until the maximum allowed nodes in the plane is reached or a path is
        ///     found.
        ///     3) If these two / three attempts had no success, the normal informed RRT strategy is used until a path is found or
        ///     the maximum amount of allowed nodes is reached.
        /// </summary>
        /// <param name="rrtConfig">Base RRT configuration</param>
        /// <param name="targetBias">
        ///     This number indicated how often the random point shouldn't be random, but placed at the
        ///     position of the target.So if targetBias = 10, every 10th random position will be at the position of the target,
        ///     hence
        ///     not random for this case.
        /// </param>
        /// <param name="factor2DSearch">
        ///     influences the amount of attempted nodes added in the vertical ot horizontal plane.
        ///     Should be >1. Increasing the factor increases the amount of nodes in the planar search.
        /// </param>
        public RRTInformedPlanar(RRTConfig rrtConfig, int targetBias, float factor2DSearch = 10.0f) : base(rrtConfig,
                                                                                                           targetBias)
        {
            _planeNormalHorizontal = GetHorizontalPlaneNormalVector(Tree.RootNode.Position, PosTarget);
            _planeNormalVertical   = GetVerticalPlaneNormalVector(Tree.RootNode.Position, PosTarget);
            // set the maximum amount of nodes per plane depending on the distance from start to finish
            _max2DIterationsPerPlane =
                (int)((Tree.RootNode.Position - PosTarget).magnitude / rrtConfig.MAXBranchLength * factor2DSearch);

            _maxRadius = (rrtConfig.SearchAreaMax - rrtConfig.SearchAreaMin).magnitude;
        }
 /// <summary>
 ///     Constructor for the Pruning Informed RRT* algorithm. Which is an adapted version of the informed RRT* search.
 ///     The difference is, that it prunes the tree everytime a new shorter path is found.
 /// </summary>
 /// <param name="rrtConfig">Base RRT configuration</param>
 /// <param name="radius">radius in which a shorter possible parent nodes will be searched for each node</param>
 /// <param name="targetBias">
 ///     This number indicated how often the random point shouldn't be random, but placed at the
 ///     postion of the target.So if targetBias = 10, every 10th random position will be at the position of the target,
 ///     hence not random for this case.
 /// </param>
 public RRTStarInformedPruning(RRTConfig rrtConfig, float radius = 1, int targetBias = 20) : base(rrtConfig,
                                                                                                  radius, targetBias)
 {
 }
Exemple #3
0
 /// <summary>
 ///     Constructor for the RRT* algorithm.
 ///     This strategy allows to find the shortest possible path when running the search long enough.
 ///     This is because the existing path is improved when a better one is found and the tree is restructured throughout
 ///     the search process.
 /// </summary>
 /// <param name="rrtConfig">Base RRT configuration</param>
 /// <param name="radius">radius in which a shorter possible parent nodes will be searched for each node</param>
 public RRTStar(RRTConfig rrtConfig, float radius = 1) : base(rrtConfig)
 {
     _radius = radius;
 }
 /// <summary>
 ///     Constructor for the Informed RRT with reduction algorithm. It uses a targetBias. This number indicated how often
 ///     the random point shouldn't be random, but placed at the position of the target.
 ///     So if targetBias = 10, every 10th random position will be at the position of the target, hence not random.
 ///     Using a targetBias has the advantage of faster overall convergence
 ///     In in this strategy nodes which fail to extend to new nodes frequently are removed from the search
 ///     tree.
 ///     This reduces the risk of local minima and improves the search performance for complex cases.
 /// </summary>
 /// <param name="rrtConfig">Base RRT configuration</param>
 /// <param name="targetBias">
 ///     This number indicated how often the random point shouldn't be random, but placed at the
 ///     position of the target.So if targetBias = 10, every 10th random position will be at the position of the target,
 ///     hence not random for this case.
 /// </param>
 /// <param name="maxAllowedFailures">
 ///     the limit of how often trying to add a child node to a node can fail, before removing
 ///     the node from the search tree
 /// </param>
 public RRTInformedWithReduction(RRTConfig rrtConfig, int targetBias, int maxAllowedFailures = 3) : base(
         rrtConfig, targetBias)
 {
     _maxAllowedFailures = maxAllowedFailures;
 }
Exemple #5
0
 /// <summary>
 ///     Base constructor
 /// </summary>
 /// <param name="rrtConfig">Base RRT configuration</param>
 protected RRTSearchStrategy(RRTConfig rrtConfig)
 {
     Config    = rrtConfig;
     PosTarget = Config.GOTarget.transform.position;
     Tree      = Config.Tree;
 }
Exemple #6
0
 /// <summary>
 ///     Constructor fot the basic RRT strategy.
 ///     Nodes are added to the tree in a completely random manner, hence the position of a new node is always random.
 /// </summary>
 /// <param name="rrtConfig">Base RRT configuration</param>
 public RRTBasic(RRTConfig rrtConfig) : base(rrtConfig)
 {
 }
Exemple #7
0
 /// <summary>
 ///     Constructor for the Planar Informed RRT With Reduction algorithm.
 ///     It works like the Informed Planar RRT but in this strategy nodes which fail to extend to new nodes frequently are
 ///     removed from the search tree.
 ///     This reduces the risk of local minima and improves the search performance for complex cases.
 /// </summary>
 /// <param name="rrtConfig">Base RRT configuration</param>
 /// <param name="targetBias">
 ///     This number indicated how often the random point shouldn't be random, but placed at the
 ///     position of the target.So if targetBias = 10, every 10th random position will be at the position of the target,
 ///     hence not random for this case.
 /// </param>
 /// <param name="factor2DSearch">
 ///     influences the amount of attempted nodes added in the vertical ot horizontal plane.
 ///     Should be >1. Increasing the factor increases the amount of nodes in the planar search.
 /// </param>
 /// <param name="maxAllowedFailures">
 ///     the limit of how often trying to add a child node to a node can fail, before removing
 ///     the node from the search tree
 /// </param>
 public RRTInformedPlanarWithReduction(RRTConfig rrtConfig, int targetBias, float factor2DSearch = 10.0f,
                                       int maxAllowedFailures = 3) : base(
         rrtConfig, targetBias, factor2DSearch)
 {
     _maxAllowedFailures = maxAllowedFailures;
 }
 /// <summary>
 ///     Constructor for the Informed RRT* algorithm. Which is a combination of the informed RRT with target bias and the
 ///     basic RRT* algorithm.
 /// </summary>
 /// <param name="rrtConfig">Base RRT configuration</param>
 /// <param name="radius">radius in which a shorter possible parent nodes will be searched for each node</param>
 /// <param name="targetBias">
 ///     This number indicated how often the random point shouldn't be random, but placed at the
 ///     postion of the target.So if targetBias = 10, every 10th random position will be at the position of the target,
 ///     hence not random for this case.
 /// </param>
 public RRTStarInformed(RRTConfig rrtConfig, float radius = 1, int targetBias = 20) : base(rrtConfig, radius)
 {
     TargetBias = targetBias;
 }
Exemple #9
0
 /// <summary>
 ///     Constructor for the Informed RRT algorithm. It uses a target bias. This target bias indicates how often the random
 ///     point shouldn't be random, but placed at the postion of the target.
 ///     So if targetBias = 10, every 10th random position will be at the position of the target, hence not random.
 ///     Using a targetBias has the advantage of faster overall search convergence.
 /// </summary>
 /// <param name="rrtConfig">Base RRT configuration</param>
 /// <param name="targetBias">
 ///     This number indicated how often the random point shouldn't be random, but placed at the
 ///     postion of the target. So if targetBias = 10, every 10th random position will be at the position of the target,
 ///     hence not random for this case.
 /// </param>
 public RRTInformed(RRTConfig rrtConfig, int targetBias = 20) : base(rrtConfig)
 {
     TargetBias = targetBias;
 }