A new probabilistic method for inverse kinematics based on RRT in a space of reduced dimension

The evolution of manipulator robots has increased the complexity of their models and applications, requiring that the inverse kinematics (IK) methods integrated into their control systems to have features such as fast convergence, completeness, low computational cost, and the ability to avoid local minima and singularities. We propose in this paper a new probabilistic IK solver based on the probabilistic search method known as Rapidly-Exploring Random Tree (RRT), the Workspace-RRT. The technique grows the tree as a spatial representation of the manipulator on the workspace instead of the configuration space, which reduces the search space up to 3 dimensions. Based on this new representation we also present the Manipulator-Based Rapidly Random Tree (MB-RRT) by incorporating to the Workspace-RRT a new probability model and a new metric for the closest node. We evaluate the presented methods through simulated experiments in the Matlab software. First, we evaluate the impact of the proposed aspects through a comparison between the RRT-based IK solvers, which emphasizes the proposed changes as a key to make the method suitable for the IK problem. At last, we show the use of the MB-RRT for precision tasks and obstructed environments.


I. INTRODUCTION
Since the 1960s, when the first works in the inverse kinematics (IK) area were issued, several studies and methods for performing inverse kinematics have been published [1].In general, the inverse kinematics approaches focuses on specific problems, such as computational cost, conflict prevention or singularity, production of smooth transitions without oscillations, support of anthropomorphic and contact restrictions.Furthermore, some tasks require the ability to achieve secondary objectives, such as collision-free task, orientation control, movement control, among others [2].
Although there is no well-established taxonomy some authors have classified the IK approaches into four main categories: analytical; numeric; based on data; hybrids [2].However, this classification does not mention a set of approaches classified as meta-heuristics (MH) [3].This category includes important algorithms, such as the Ant Bee Colony (ABC), Firefly Algorithm (FA), and Particle Swarm Optimization (PSO).
Meta-heuristics techniques solve the problem of inverse kinematics based on natural behaviors and a random component, since they are based on the use of probabilistic searches.This search is made in the configuration space (C space ) and each sample has an associated value, calculated using a cost function, which indicates how close to the objective the position of the end-effector would be in the workspace.MH methods are recommended for solving complex problems and have the advantage of not falling into singularities, as they do not invert the Jacobian matrix [4].
However, since this class of methods is based on some kind of heuristics, many can fall into local minima problem [5].Another disadvantage of these methods is a slow convergence lead by the probabilistic search in the configuration space, which generally corresponds to a high dimension space [6].
The difficulty in dealing with spaces of high dimensions is recurrent in most applications.For this reason, several authors have proposed techniques based on reducing dimensionality to simplify the problem, make the solution of the problem more efficient and improve the understanding of the data [5], [7].Thus, in the context which probabilistic techniques operate in a larger space than other approaches, dimensionality reduction can improve the convergence time to make it equivalent to other inverse kinematics methods.
Another approach to improve the convergence time of the search in the configuration space is to apply biased techniques [8].However, the application of these biases, using the configuration space, requires a non-linear mapping between systems that causes distortions and makes it difficult to use common distance metrics, such as Euclidean.In addition, biased techniques may lead to local minima and compromise the probabilistic completeness of approaches [9].
In robotics, one of the most well-known probabilistic techniques is the Rapidly-exploring Random Tree (RRT), created to solve the motion planning problem [10].RRT is highlighted for the ability to find quick solutions in large search spaces, besides being probabilistic complete, which means that when a solution exists, RRT always finds it if the number of samples tends to infinite [11].Some works in the area of manipulators use RRT in the configuration space to solve the planning problem [12], [13].Additionally, RRT has been used to solve inverse kinematics, as in [14], which uses the RRT as both path planner and IK solver on the C space .
As the tree grows directly in the configuration space, current works using RRT in manipulator robot applications have two major restrictions regarding the convergence times to find a solution: high configuration space dimension and difficulty in building probability models of polarized sampling that guide the search towards the goal.
To mitigate these issues, we propose in this paper a probabilistic method of inverse kinematics for manipulators based on RRT, named Workspace-RRT.The proposed approach applies the probabilistic search directly on the workspace of a serial robot manipulator.This change is important because the use of RRT in the workspace ensures that the search space is up to 3 dimensions, resulting in a reduced search space despite the number of Degrees of Freedom (DOF) of the manipulator.Furthermore, the proposed space has physical meaning as it represents the environment where the robot is operating, allowing an intuitive interpretation of the problem, which is not possible for the search in the configuration space as it is an abstract space.The intuitiveness obtained facilitates the proposition of changes in the method, thus, future works could easily propose extensions of Workspace-RRT to address specific issues of the application.
A second method is proposed in this paper by incorporating a new probability model and a new metric for the nearest node to the Workspace-RRT.Named Manipulator-Based Rapidly Random Tree (MB-RRT), this approach was developed focused on aspects such as fast convergence, prevention of local minima and singularities, simplicity, and probabilistic completeness.Both methods are evaluated through experiments in simulated 2D and 3D environments for manipulators with 3-DOF and 10-DOF.
We can summarize the following points as the main contributions of this work: • Development of a new probabilistic method for inverse kinematics based on RRT, the Workspace-RRT.This approach can be considered as a blank canvas to inverse kinematics researchers propose their extensions.• Dimensional reduction.This approach proposes a new interpretation for the RRT to change the search space from the configuration space to the workspace.Our approach set the nodes as the joints of the robot and the edges as the links, in such a way that each branch of the tree is either a total or a partial representation of the robot in the workspace.• Intuitiveness.The interpretation of the tree as the robot facilitates the visualization of the relationship between the tree and the physical characteristics of the manipulator, which favors the proposition of changes in the approach to optimize the results.• Development of a fast probabilistic IK solver based on the Workspace-RRT, the MB-RRT.A new probability model and metric for the nearest node are incorporated to the Workspace-RRT in order to obtain a method highlighted for simplicity, fast convergence, intuitiveness and probabilistic completeness.
The paper is organized as follows: Section II presents the state of art of inverse kinematics and the rapidly exploringrandom tree; Section III is about the RRT algorithm; Section IV is dedicated to present a new IK solver based on RRT applied at the workspace and Section V propose a second approach by incorporating a new probability model and metric for nearest node; The analysis of the obtained results are presented in Section VI; At last, conclusions and propositions for the future are presented at Section VII, followed by the bibliographic references.

II. WORK RELATED
This section is dedicated to present the main concepts of RRT and its applications.A review of the inverse kinetics area is also presented, showing the state of the art and the main approaches developed to solve the problem.

A. RRT
The RRT algorithm was initially proposed by La Valle to solve the path planning problem through a random search in a space using a data structure that resembles a tree [10].This approach allows the planning of paths through the efficient exploration of multidimensional search spaces with or without obstacle [15].
Several approaches based on the RRT algorithm have been proposed to solve problems in different areas, including virtual reality [16], game development [17], analog circuit analysis [18] and robotics as a path planner for systems involving mobile robots, manipulators, space robots, underwater robots, helicopters and humanoids [15].
The successful performance of this approach in various applications has resulted in numerous extensions of the classic algorithm [11].Some approaches used obstacle information to propose its techniques, as Rodriguez to overcome narrow passages and Wang to improve the trajectories in environments with obstacles [19], [20].Kang et al. propose the Goal-Oriented RRT that biases the tree towards the goal [21].
Kuffner and Lavalle present the RRT-Connect approach to considerably decrease the method's convergence time when using a bidirectional tree and try to establish a connection between them at the end of each iteration [22].Despite presenting a solution quickly, this approach is only applicable to tasks where the target configuration is already known.
Although RRT-based methods solve the planning problem very quickly, they produce non-optimal solutions.To deal with this problem, Karaman and Frazzoli propose the RRT* approach that adds an operation to reconnect the nodes that generate almost optimal solutions [23].Even after finding a solution, the RRT* continues its sampling process in order to produce better results.Therefore, this technique is classified as asymptotically optimal, as the solutions approach the best solution as the number of samples increases.
Based on the approach proposed by Karaman, Gammel proposes the Informed RRT* approach, which limits the search space after finding a possible solution [24].This limitation is applied through an ellipse-shaped region that is recalculated whenever a better path is found.Aiming to improve the results obtained by Informed RRT*, Mashayekhi et al. developed the Informed RRT*-Connect which works in a similar way to other RRT-Connect variations and maintains the same characteristics as Informed RRT* with a shorter convergence time [25].
Regarding the path planning for manipulator robots, RRT has been widely used in recent years due to its good performance in high dimensional environments.In [13], Wei introduces the S-RRT to deal with motion planning for manipulators in dynamic environments, while Rybus uses RRT for trajectory generation [12].Both methods considered trees applied in the configuration space.
In the work developed by Wegue and collaborators, RRT is applied directly to the workspace to create a trajectory between two points without worrying about solving the IK problem.Specifically, the transposed Jacobian method is used as an IK solver so that the robot can follow the path generated [26].
In the context of manipulator robots, the RRT usually is applied to solve the path planning problem, and the task of finding the final configuration is solved by another method of inverse kinematics.However, Bertram presents a method based on RRT that solves the problem of planning at the same time it solves the problem of inverse kinematics.In this approach, the destination is known only in the workspace and, as a new configuration is added to the tree, the forward kinematics are calculated to obtain the position of the endeffector in the workspace [14].
Despite the use of RRT in [14] to solve the problem of inverse kinematics, it is not commonly used for the solution of IK.As the problem of inverse kinematics aims to find a target configuration for a given point in the workspace, this task does not allow knowing in advance a goal configuration on the C space .This limitation makes it difficult to propose efficient heuristics that make the application of RRT desirable for problems of inverse kinematics.

B. INVERSE KINEMATICS
The inverse kinematics problem has intrigued researchers for many years in the field of robotics and computer graphics.Over the past decades, various approaches have been implemented to find a robot configuration for a given task.The great diversity in the types of approaches used in IK methods makes it difficult to define a taxonomy that satisfactorily covers all methods.In this work a combination of [2] and [3] taxonomies are being considered to help organize the IK methods (i.e, analytical, numeric, based on data, hybrids and meta-heuristics).Craig, in [27], presents a review with various analytical methods developed mainly in the field of robotics as they generally do not suffer from uniqueness problems, offer a global solution, and are reliable.However, the nonlinear nature of kinematic equations and the low scalability make the analytical methods less suitable for redundant systems, in which they generally fall into local minimums and cannot handle prioritized constraints.
Data-based methods learn a space of natural configurations from examples.Using the learned space, they generate new shapes that respect the deformations shown by the examples but still satisfy the constraints imposed by the user.This category also has been used in applications for which the joint torque sensors are often unavailable, such as the biomedical robots, as shown in [28].The disadvantages of Data-based methods are the requirement of an offline training procedure, and a limitation to the models and movements in which the system was trained.
Among the numerical approximation methods, the best known are the Jacobians methods that model the end-effector movement in relation to changes that occur in the joint angles.Within this group, several approaches have been developed to calculate or approximate the inverse of the jacobian, such as the transposed jacobian, Damped Least Squares (DLS) and Singular Value Decomposition (SVD) [2].The solutions presented based on the Jacobian matrix produce smooth positions, however, most of these approaches suffer from high computational cost, complex matrix calculations, and singularity problems [29].
Heuristic-based methods are the simplest and fastest numerical approaches, among which can be highlighted the Cyclic Coordinate Descent (CCD) and FABRIK [30].Canutescu and Dunbrack introduces CCD in [31], a widely used approach in graphic animation and the gaming industry due to its rapid convergence and low computational cost.This method attempts to minimize position and orientation errors by transforming one joint variable at a time.However, it often leads to describing unrealistic movements for robot manipulators.
The FABRIK solution, proposed by [32], consists of an iterative method that treats each joint value as points in the Cartesian plane and thus searches for subsequent joints as points belonging to lines, representing the manipulator links.This approach has the main advantages of high convergence percentage and low computational cost.Nevertheless, even with all the advantages presented, FABRIK has limitations when applying movement constraints and in environments with obstacle.Other FABRIK-based approaches have been developed to address these limitations [33].
The last class of IK solvers presented in this paper is the meta-heuristic (MH), represented by the techniques that solve the problem of inverse kinematics from the point of view of optimization and try to minimize a cost function, also called the fitness function.Among the MH methods, we can highlight the Firefly Algorithm (FA) and the Particle Swarm Optimization (PSO) [34], [35].
The probabilistic search performed by meta-heuristic approaches has the disadvantage of being applied in the configuration space, which implies a space of high dimension for most of the manipulators.Furthermore, depending on the choice of parameters, MH methods may suffer from the local minimum problem, as this class of method is based on some type of heuristic [5].
In the work developed by Junior et al., the Fully Resampled PSO (FRPSO) is proposed, which aims to improve the robustness of the solution in relation to the local minimum problem by resampling all nodes after the end of the iteration [5].This method achieves a dimensionality reduction that has a very positive impact on the convergence rate and the number of iterations, in comparison with other variations of the PSO, as it reduces the complexity of the task and provides a reduced search space.
Finally, it is worth mentioning the work presented in [36], where a method called IK-RRT is presented.Despite the nomenclature, this method is used for motion planning in the configuration space and works with the aid of an inverse kinematics method to find possible configurations that take the end-effector to a desired position.
During the review performed in paper, only the method presented by [14] uses RRT to solve the problem of inverse kinematics.However, it acts as a motion planner in the configuration space that explores the space and verifies that the generated configurations result in a solution to the inverse kinematics problem by mapping the C space into the workspace.

III. RAPIDLY-EXPLORING RANDOM TREE (RRT)
RRT is a classic planning algorithm that performs a random search, shaped like a tree, to find a path that connects an initial state (x init ) to a desired state (x goal ) within a given state space X .The term state space is used to represent a generalization of the possible spaces where a search can be performed.
The X space can be divided into two components, the permissible state region X f ree and the rejection region X obst .The tree (G) generated by the RRT algorithm must connect the x init state to the x goal state through a path contained in X f ree .Thus, the tree starts in x init and the RRT algorithm executes K attempts to expand the tree through the environment according to random sampling in X f ree .
Each of the K expansion attempts grows the tree in the direction of the sample (x rand ) from a nearest tree node (x near ).This expansion is limited by a step size (d) that restricts the connection between x rand and x near , generating a x new .The search must be interrupted if the new node added x new is close enough to the x goal , the proximity criterion is calculated using a distance metric along with a tolerance value tol that indicates completion of the task.The description of the classic RRT approach is made in Algorithm 1.
x rand = sample() 4: x near = findNearest(x rand , G) x new = x near +limit( v, d) if dif < tol then end if 14: end for Regarding the path planning applied to robotics, the state space X can be used as the configuration space C. In such case, the tree nodes represent a configuration of the robot in the workspace and the edges describe a possibility of movement between configurations.For a better visualization of the Algorithm 1, an application of the approach is presented in the context of the manipulating robots.(d) Result of the classic RRT after connecting qinit and q goal .The path generated between the two configurations is highlighted in green and the generated tree is represented by blue dots (nodes) and black lines (edges) Given the 2-DOF manipulator robot shown in Fig. 1-a and the configuration q init and q goal in Fig. 1-b, the task of RRT is to find a path that connects these configurations.The Algorithm 1 starts by generating its G tree with the node q init as its root (Fig. 2-a).After the insertion of the root, the algorithm follows an iterative process that has as a stop condition the connection between the desired configurations or a maximum number of K iterations.
Each iteration begins by randomly sampling a new configuration q rand in C f ree .This configuration, q rand , is chosen to guide the expansion of the tree towards it.Then, the closest node from G is identified (q near ), according to a distance metric previously established by the designer (Fig. 2-b).
Then, the tree expansion process starts towards q rand .A vector v is plotted from q near towards q rand and then the algorithm limits the growth of the tree in the direction of q rand to a maximum size of step d.This procedure generates a new node q new that will be incorporated into the tree if that segment d belongs to C f ree (Fig. 2-c).If the edge is not entirely in C f ree the q new node is discarded and a new configuration is sampled.
The procedure described above must be repeated until the q goal configuration is connected to the tree or until a maximum K number of iterations is reached, as shown in Algorithm 1.After a few iterations, the algorithm is able to add the desired configuration to the tree and then it is possible to have a path between the initial and final configurations (Fig. 2-d).
The solutions presented by RRT are non-optimal, as can be seen in Fig. 2-d.However, its search for a sub-optimal solution accelerates its convergence and facilitates its application in large search spaces.RRT is highlighted in the path planning area due to some characteristics, such as [10]: • Simplicity.An RRT iteration comes down to sampling, finding the nearest node and growing the tree in the direction of the sample; • Low computational cost.Due to the simplicity of the approach the cost per iteration of the approach is very low; • Fast Convergence.The random expansion of the tree creates a compact representation of the environment, which speeds up the search process.Besides, RRT does not need to find all valid paths, as a solution is presented by adding x goal to the tree; • Applicable in high dimensions.RRT's only interaction with the environment is the verification of belonging to X f ree , so it is not necessary to pre-process the environment; • Probabilistic completeness.RRT guarantees that, if possible, a solution will be found for a K tending to infinity; • Adaptable.RRT has a large number of applications, in addition to path planning [15].
However, based on Fig. 1, it is possible to notice that the representation of C space does not have an intuitive relationship with the workspace.Furthermore, for manipulators with VOLUME 4, 2021 more degrees of freedom, this space grows in dimensionality and a visual representation of it is no longer possible.The cost of exploring the entire C space for high dimensions is also very high, so the problem of planning in the configuration space is usually accomplished through techniques that create a compact representation of the environment as a RRT.
Regarding inverse kinematics, the use of RRT is not common.Since the solution for the IK problem is a configuration in which the end-effector is at a desired pose in the workspace, the final configuration is not known in advance on C space .Thus, the search is performed without a goal configuration in that space, because this information only exists in the workspace.This issue hamper the definition of the algorithm parameters such as step size and final tolerance of the destination, since they impact differently in each space.
Finally, this difference between spaces still makes it hard to propose changes at the RRT algorithm, as the influence of these changes on the final result is difficult to measure and the use of bias is also non-trivial due to the need for mapping between spaces.

IV. WORKSPACE-RRT
The use of the configuration space is the biggest drawback when applying RRT as an IK solver, due to its high dimension and the need for mapping.Therefore, we propose in this paper the Workspace-RRT, a new IK solver based on the RRT applied directly to the workspace.
The shape of a manipulator robot in the workspace can be quite complex, which makes the natural interpretation of RRT in that space impossible.Thus, for the context of the manipulators in the workspace, a new interpretation of the classic approach is necessary.This interpretation is based on the idea that the tree generated in the workspace represents the construction of the manipulator in that space in such a way that the nodes of the tree represent the joints and the edges the links of the robot.
The proposed representation has the base of the manipulator as the root node and each level of the tree represents the correspondent joint.This structure implies that for a N -DOF manipulator, the tree must have up to N levels.Fig. 3 shows an example of this representation for a 3-DOF planar manipulator with links d 1 , d 2 and d 3 .

A. CONNECTION RULE
In order to create the desired structure, a new connection rule is proposed in this paper.The sampling process is done sequentially, joint by joint, starting from the first joint to the end-effector.Therefore, an index has been added to each node to associate it with the joints of the manipulator.Hence, a new node can only be added to the tree if the connection is made from an index node immediately below the current one, ensuring the growth of the tree in the shape of the manipulator.
Fig. 4 shows a description of the new connection rule for the manipulator presented in Fig. 3-a.First of all, the base of the manipulator is set as the root of the tree.Then starts the sampling process for the first joint (Fig. 4-a).The sample is connected to the nearest index 0 node and then a new node is created with a step size equal to the first link d 1 (Fig. 4-b).For the second joint, a new sample is generated with index 2 (Fig. 4-c).The sample is connected to the nearest index 1 node and then a new node is created with a step size equal to d 2 (Fig. 4-d).At last, a sample is generated with index 3 (Fig. 4-e).The sample is connected to the nearest index 2 node and then a new node is created with a step size equal to d 3 (Fig. 4-f).After the n index node has been added to the tree, a full iteration is completed.At Fig. 4-f is easy to notice that each full branch of the tree represents the shape of the manipulator.The solution for the IK problem is obtained when the n index node reaches the target.When analyzing the tree after 3 iterations (Fig. 3-b), the 3 nodes at the last level of the tree can be used to check solution.If one of them reaches the target, the solution configuration is calculated by jumping from parent node to parent node all the way back to the root.It is worth mentioning that the target position is known throughout the whole procedure with the workspace representation, which is not possible on C space .

B. ALGORITHM
Based on the proposed interpretation we present in Algorithm 2 a new approach to solve the IK problem, in which G is the tree, x represents a point in the workspace, n is the number of joints in the manipulator and d represents the links in the manipulator.
Algorithm 2 Workspace-RRT 1: G.initialize(base, 0) 2: for j = 1 to K do x rand = sample(uniforme distribution) 5: x near = findNearest(x rand , G, i) x new = x near + limit( v, step) G.add_node(x new , i) The Workspace-RRT algorithm starts by adding the base of the manipulator as the root of the tree with index 0. Next, it proceeds to K attempts of expanding the tree using the new connection rule.Each iteration starts with the index 1 sample and ends after the index n node has been added.
In order to obtain a better visualization of each step of the algorithm, Fig. 5 shows a step-by-step execution of the proposed algorithm for a 4-DOF planar manipulator, where the indices can be identified by the colors of the edges.
The first iteration starts with a sample of index 1, x rand , sampled using an uniform probability distribution (Fig. 5-a).Then, it finds the closest node with an index immediately below the current one (index 0) and limit the expansion of the tree in the direction of the x rand by the step size that corresponds to the related link of the manipulator (d 1 ).This process results in a new node (x new ) that is add to the tree with index 1, identified by the color red (Fig. 5-b,c).
After the node addition, the index is incremented and the same process is executed for the next joint.The sample x rand is generated and connected with the closest index 1 node.Then, the tree expands from the closest node in direction to x rand with step size d 2 .Fig. 5-d shows the addition of index 2 node, identified by the color green.
This procedure is repeated until the index reaches the manipulator number of joints, n (Fig. 5-e).After the last node addition, the solution is checked, if it is not possible to reach the destination, the index returns to 1 and another iteration starts.
After several iterations, the tree grows as the possible configurations of the manipulator in workspace, as can be seen in Fig. 5-f, ensuring that a solution will be found and that it can be executed by the manipulator, as long as it exists and is given enough time for the algorithm [10].In this approach, when the current index reaches a value equivalent to the number of joints, a success check is made.This verification of success is made using an Euclidean distance between the target and the end-effector based on a tolerance value.At this point, it is important to emphasize that the distance is used only to verify the success of the task, without interfering in the growth of the tree.For this function, the Euclidean distance fits perfectly because the target and the tree are in the same space.
This new interpretation of RRT provides easy visualization of the relationship between the generated tree and the manipulator robot, even for a high-DOF model.In terms of comparison, in Fig. 2 the result of the growth of the tree in the configuration space for a manipulator of only 2-DOF does not make it possible to have the spatial notion of the manipulator in its workspace.
It is worth mentioning the new interpretation also allows the existence of bifurcations and branches that do not reach the last level, which is not possible in the configuration space, since in this space a single point represents the entire chain.These characteristics are visible through the example shown in Fig. 3-b.In this figure, a 3-DOF planar manipulator is used and it is possible to visualize bifurcations and branches that do not reach the last level after 3 complete iterations.
These observations allow us to modify the growth of the tree based on the movement of each joint individually.In addition, as it does not sample a complete manipulator configuration, it is possible to use the nodes added in previous iterations to bias the growth of the tree with trivial criteria such as Euclidean distance to the destination point.These discussions are possible due to the proposed interpretation, because in the context of the configuration space it is not possible to treat each joint independently.
Therefore, the relationship proposed in this work between the tree and the manipulator robot guarantees a more intuitive visualization of the robot's movements, allowing the alteration of some steps of the approach based on the spatial characteristics of the manipulator and the problem.Others researchers can consider the Workspace-RRT as a blank canvas to propose their own modifications.

V. MB-RRT: A NEW PROBABILISTIC METHOD FOR INVERSE KINEMATICS
Based on the Workspace-RRT, we also propose in this paper the Manipulator-Based Rapidly Random Trees (MB-RRT), a new probabilistic method for inverse kinematics.The MB-RRT incorporates a new probability model (Subsection V-A) and a new metric for the nearest node (Subsection V-B), both proposed in this paper.

A. PROPOSED PROBABILITY MODEL
In the solution presented in Algorithm 2, each new x rand is sampled across the workspace from an uniform probability distribution.However, in Workspace-RRT the tree grows in the workspace where the desired target position for the endeffector is known a priori.This information can be used to propose a new probability model for defining x rand that polarizes the search towards the target, which would not be possible if the tree were in the configuration space.
Since the solution of the inverse kinematics consists of a configuration in which the end-effector reaches x goal and does not necessarily involve a path between two configurations, it is possible to delimit regions where it is not possible to reach the destination and prevent the growth of the tree in these regions, reducing the search space in order to improve the performance of the technique.
A manipulator robot has a range limit described by the total length of its links, therefore, it can be concluded that all the reachable space of a planar manipulator is contained in a circular region where the radius is equal to the maximum extension of the manipulator.Thus, for a given desired point in space, there is a circular region around that point in which all possible solutions to the problem of inverse kinematics are contained.
It is important to highlight that this region is different for each of the joints of the manipulator since the possible extension movement for each joint depends on the remaining size of the chain.A visual interpretation of these regions can be obtained through an example using a 4-DOF planar manipulator with links of the same length which model is described by the Denavit-Hartemberg convention at Table I [38].In Fig. 6, it is possible to visualize the regions of interest for the 4-DOF planar manipulator, delimited by circumferences around the objective, for a target point located at the coordinates (20,30).joint a i (cm) Analyzing Fig. 6, it is easy to notice that the nodes outside the circular regions will not contribute to the solution.This happens because the problem of inverse kinematics seeks to find only one configuration that takes the end-effector to the destination and not a trajectory between two configurations.For instance, all possible positions of the blue joint that may solve the inverse kinematic problem are inside the blue circumference and the same works for the other joints and circumferences of the same color.
Its important to notice that if there is a solution for the problem, then it must be inside the circumference but not all positions inside the circumference are solution for the problem.Thus, the MB-RRT still have to search for the solution, but now it is done over a smaller set of possibilities and that is the proposed polarization in the x rand probability model.Based on this observation, we propose a new sampling to bias the growth of the tree towards the solution regions.The proposed sampling occurs uniformly on the surface of the region of interest carried out as where r is the remaining length of the robot and θ is the parameter to be sampled.It is noteworthy that with this change, sampling is performed in only one dimension, which facilitates the manipulation of the probability model, now univariate.
A better understanding of the proposed sampling can be obtained by showing the tree growth after a few iterations of sampling only the index joint 1 to facilitate visualization.Fig. 7 shows the circumference around the target (x goal , in yellow) that has a radius equals the remaining length of the robot after joint 1.All the samples (x rand , in green) are obtained at the circumference using Eq. ( 1) and then the procedure described in Algorithm 2 is performed.The nearest node of the sample is expanded on its direction and limited by a step equals to the related link (d 1 ) generating the new node at the tree (x new , in blue).Fig. 7 shows that this new sampling process generates a growth bias of the tree towards the solution region.The impact of this change in the probability distribution were measured through 100000 samples to generate an estimate of its probability density function (PDF), shown in Fig. 8.
The histogram in Fig. 8 shows two probability peaks at the extremities, however, they have an uniform distribution in the central regions.It is possible to see that all configurations excluded with this PDF could not be a solution for the IK problem.This is evident in Fig. 7 in which the radius of the blue circumference is equivalent to the rest of the extended manipulator and any configuration outside that circumference would imply a greater distance than the length of the rest of the chain, thus making it impossible to complete the task.
Nevertheless, the region generated does not aim to exclude all configurations that do not solve the problem, but rather to ensure that all possible solutions are contained in that region.Thus, since all possible solutions are within the sample space and with a probability of non-zero occurrence, RRT's probabilistic completeness prove remains valid for this new x rand probability model.
Although sampling in the surface region produces a bias in the growth of the tree, it does not result in local minima, since the method is probabilistically complete and there is no interest in projecting trajectories in this search space, but rather in finding a configuration that satisfies the conditions of the task.
Other approaches propose a bias in the growth of the tree in the C space to solve the problem of inverse kinematics [14], [26].However, as the goal configuration is not known in this space, these approaches depend on a mapping between spaces, which incur using complicated distance metrics, making the task non-trivial.It also hampers the definition of regions of interest and the guarantee of obtaining a search region that contains all possible solutions is not plausible.Regarding the technique proposed in this work, these issues are solved without the need for mapping between configuration space and workspace.Fig. 9 shows a complete iteration of the Workspace-RRT with the sampling rule of the solution on the surface region.This environment has as its destination point the coordinates (20,30) and a planar manipulator (4-DOF) with Denavit-Hartemberg parameters described in Table I.
The first step of the approach is to define the surface region for the first sample.Since after joint 1 there are 30cm in length for the manipulator, the first region is represented by a circumference of radius 30 and center at x goal , Fig. 9-a.Using equation ( 1), a point is sampled on the surface of the solution region (x rand ) and then the tree grows towards the sample with step size equal to the link 1 , Fig. 9-b.The same procedure is performed for the sample of nodes of indices 2 and 3 with a radius of 20cm and 10cm, respectively, Fig. 9-c  and d.
In the sample for the last node an interesting event takes place.As it represents the end-effector, there is no length  of the manipulator after it, which makes the radius of the circumference to be 0 and the sample always takes place at the target point.This is an important feature for the sample of the last node, as no other can generate a solution.
After the last node, the first iteration is completed and then the success verification is performed, Fig. 9-e,f.If there is no solution, the process is repeated until a solution is found.For the next iterations, each position sampled for a joint (i) can be connected to any of the existing positions in the tree for the joint (i-1), which speeds up tree growth and its ability to better represent the space of solutions.

B. A NEW METRIC FOR THE NEAREST NODE
The application of RRT directly in the workspace allowed changes that would not be applicable in the configuration space and facilitated the visualization of possible ways of improving the technique based on its physical aspects.Analyzing the tree growth, we also propose a new metric for the nearest node in order to improve the final result.
The classic RRT uses the shortest Euclidean distance to the sample node as a metric for choosing the nearest node.An illustration of how this procedure occurs is shown in Fig. 10.
However, when applying RRT as a spatial representation of the manipulators, a change in this selection criteria can improve the method's performance.The metric proposed in this work delimits a circumference of radius equivalent to the corresponding link (d i ) and searches for the closest index i-1 node to the circumference, x near .Fig. 11 shows an example for the sampling regarding the last node.
As explained in subsection V-A, the sample for the last node is the target itself (in orange).The proposed criteria selects the node that has the closest distance to the circumference, according to where G i−1 represents all tree nodes with index i-1.This change aims to increase the probability of the selected node being inserted in the tree.Since the sample of the last node always results in the target, the classic metric for the nearest node may lead to local minima.Fig. 12-a gives us a visualization of a local minima configuration.The classic metric will always choose x near (in green Fig. 12-a).Consequently, x near (in blue Fig. 12-a) add from this point will always be far from the goal configuration, posing a local minima situation.On the other hand, the new rule increases the probability of adding the target to the tree, avoiding the local minima and speeding up the resolution of the IK problem.In Fig. 12-b, x near (in green 12-b) is selected using the new metric and the x new (in blue 12-b) is added to the tree.

VI. EXPERIMENTAL RESULTS
The experiments presented in this section are performed in a simulated environment through the software Matlab using two different manipulators, 3-DOF and 10-DOF planar robots.They are designed to demonstrate the behavior of the proposed technique and the importance of the changes in the algorithm's parameters.First, we will present a comparison with the RRT applied on the C space , the Workspace-RRT and the MB-RRT in an environment free of obstacles for both manipulators.Next, we present the performance of MB-RRT for precision tasks in the same environment free of obstacles for both manipulators.At last, an obstructed environment is used to evaluate the MB-RRT for the 10-DOF manipulator.

A. PERFORMANCE COMPARISON BETWEEN RRT-BASED IK SOLVERS
In this paper, we evaluate the impact of the proposed aspects (metric and probability model) in the Workspace-RRT.Hence, we analyse convergence aspects through a comparison between the RRT on the C space (proposed by [14]), the Workspace-RRT and the MB-RRT (both proposed in this paper).A description of the terms used in this work to represent each RRT variant is presented in Table II.Regarding the Workspace-RRT, we analyze the parameters changes such as the closest node metric (presented in Section V-B) and the influence of sampling the last node as the target itself.A description of the terms used to represent the discussed aspects of RRT is presented in Table III.All experiments presented will be carried out in 2D, as in most works in RRT, to facilitate the visualization of the result of the method.The expansion to a 3-dimensional space is analogous and secondary problems, such as movement restrictions and joint limits, will not be addressed in this work.
Since the approaches investigated in this work have probabilistic characteristics, the execution of the algorithm under the same conditions can produce different results.Thus, in order to produce representative results, we perform the same experiment 100000 times.
In addition, for each experiment, a cloud of points was uniformly distributed in the reachable space of the manipulator and used as target points.It is important to highlight that for each destination point evaluated, the environment is totally free of obstacles.
The tests were applied to two different models of manipulator robots.The first robot is a 3-DOF manipulator and has a model described by the parameters of Denavit-Hartemberg in Table I.Based on this model, 100 points were uniformly distributed in the reachable space of the manipulator.For each target point, two stop conditions were determined, 10000 iterations or a distance to the target that equals 1% of the length of the manipulator (0.3 cm).
The second manipulator tested has 10-DOF and has its model described by the Denavit-Hartemberg parameters in Table I, same parameters until joint 10.Based on this model, 100 target points were generated uniformly distributed in the reachable space of the manipulator.For each target point, two stopping conditions were determined, 10000 iterations or a distance to the target that is equivalent to 1% of the manipulator length (1 cm).
The performance of the approaches was measured in terms of convergence rate (C R ), average iterations (µ) and the amount of nodes added outside the solution region (ρ).It is noteworthy that the number of iterations is increased only after sampling the index n.
The parameter ρ was added because searches performed outside the solution region are unnecessary and it shows the gain provided by the change in the probability model proposed in this work.Since the method can solve the problem with a low number of iterations, which results in a low node dispersion, all approaches were tested a second time with only the stop condition of 10000 iterations (ρ 10000 ) to obtain greater reliability on this metric.
The results presented in Table IV relate the performance of all changes investigated in this work.The Workspace-RRT with the Metric A has the lowest convergence rate (C R ) among the analyzed approaches, which shows that a simple reinterpretation of RRT for the workspace does not guarantee a better performance than RRT in the configuration space.The small amount of iterations associated with a small C R for the Metric A* evidences that the classical rule with the new probability model may lead to local minima.Inserting the new metric (Metric B) produces a better convergence rate C R in all possible scenarios and avoid local minima, as stated in Section V-B.
Regarding the MB-RRT, a superior performance is observed in all aspects.It is worth mentioning that the better performance is directed related to the low number of nodes outside the solution region.Due to the low number µ the value of ρ is not reliable to evaluate the search out of the solution region.Therefore, the value of ρ 10000 reinforces the gain of the PDF generated with the sampling in the surface region by having only 8% of the nodes out of the region of interest.When applying the technique to manipulators with more degrees of freedom, the advantage of the proposed probability model becomes even more evident.Table V presents the results of the experiments performed for the 10-DOF robot.In these tests, the uniform sampling performed by the Workspace-RRT was not able to find all targets in any scenario (e.g, C R = 100%), but the Metric B* variation continues to show the best results.
Since the MB-RRT uses a bias to guide the tree growth, the method maintains similar results to the 3-DOF experiments, which evidences a small impact on the performance regarding the number of degrees of freedom.

B. PRECISION TASKS
Since the MB-RRT presented superior results related to other RRT variants, new experiments were carried out with different tolerance values (0.3 cm, 0.01 cm and 0.001 cm) to measure the ability of the technique to present a solution for tasks that require more precision.These experiments were carried out for both the 3-DOF and the 10-DOF robot.
Regarding the results obtained for the 3DOF robot (Table VI), it is possible to notice the approach continues to find a solution in all cases with a low average number of iterations.It is also worth mentioning the longer the search time, the smaller the percentage of nodes that exist outside the solution region, which indicates a growth bias towards the solution region.Despite the good results, this model is quite simple as it is a robot with only 3-DOF and it is expected that the difficulty of the task will increase considerably with the increase in the number of joints.
The results obtained in Table VII for the 10-DOF robot are quite similar to those found with the 3-DOF robot.This is due to the fact that even with an increase in the number of joints, the search space remains only two-dimensional as the technique applies in the workspace.This feature brings the advantage that the search area will have a maximum of 3 dimensions for any type of manipulator, while the classic RRT has search space equal to the number of manipulator degrees of freedom.Thus, the MB-RRT stands out for maintaining its main characteristics even with the increase in the number of joints and with lower tolerance values.

C. OBSTRUCTED ENVIRONMENT
The last experiments were conducted to demonstrate the ability of the proposed approach to easily avoid obstacles in both 2D and 3D environments.From the previous RRT works, we can deal with obstacles in the environments by checking for collisions on the edge, if a collision is detected the x new is discarded and a new sampling is performed.Regarding the 2D experiments, three obstructed environments were designed.At the first environment (Fig. 13-a), two different targets were assigned (in red), meanwhile, the remaining environments (Fig. 13-b,c) have a single target.In order to obtain representative results, each target was evaluated 100000 times.The 10-DOF manipulator is used in this experiment and is represented by the black lines (edges) and the gray circles (joints).The same two stopping criteria from the comparison experiments were used, 10000 iterations or a distance to the destination that is equivalent to 1% of the manipulator length (1 cm).
The MB-RRT was able to reach all the target points (C R = 100%) with a µ of 52.53395.As expected, µ is higher than the presented in Table VII due to the environment complexity.Nevertheless, the average iterations is still low.Fig. 14 shows the configurations generated for the given targets, and it is clear that the technique avoids the collision.Similar arrangements were used for the 3D experiments, with same stopping criteria and 100000 evaluations for each target.Three obstructed environments were designed with a single target each (Fig. 15).A 10 joint manipulator without rotation restriction is used in this experiment, represented by the black lines (edges) and the gray circles (joints).
The extrapolation of the technique from 2D to 3D space is easily accomplished by changing the sampling process in the solution region (Section V-A) from the surface of a circle to the surface of a sphere.In this context, the MB-RRT was able to provide a solution in every 100000 evaluations for all the target points (C R = 100%) with a µ of 18.5468.In Fig. 16 is shown the configurations generated for the given targets with a top view perspective to provide a better visualization of the avoidance and the 3D position.Since the RRT has several extensions in the path planning area, some of them can be used as a basis to propose solutions for secondary objectives in inverse kinematics, as it was done for obstacle avoidance.For example, joint limits can also be addressed by discarding samples that exceed the restriction.Orientation control could be incorporated by considering the end-effector angle as part of the stopping criteria.

VII. CONCLUSIONS
This paper presents a new probabilistic method for inverse kinematics based on RRT, by growing the tree as a spatial representation of the manipulators, the Workspace-RRT.This interpretation of the tree as the manipulator itself is particularly interesting because it allows an easy interpretation of the meaning of the tree components, which makes it a blank canvas for future researchers to propose their extensions, in a similar way as from RRT several extensions were developed.
A new x rand probability model and a new metric for the nearest node are incorporated to the Workspace-RRT in order to propose the Manipulator-Based Rapidly-exploring Random Tree (MB-RRT).The experiments carried out in this paper prove the effectiveness of MB-RRT and show characteristics such as simplicity, low computational cost, low number of iterations, scalability, probabilistic completeness and obstacle avoidance.Other aspects desired in inverse kinematics techniques, such as orientation control and movements constraints, are not addressed in this work.
Based on the results obtained in this paper, the MB-RRT technique has the potential to present a good performance compared to fast IK techniques currently used, such as FABRIK, CCD and PSO.Therefore, in future works it is intended to carry out a comparison of the proposed approach with the main techniques for solving the IK problem, incorporate common secondary objectives in the context of inverse kinematics of manipulators and evaluate the insertion of movement restrictions in the 3-dimensional space.

FIGURE 1 .
FIGURE 1.Path planning for a 2-DOF manipulator robot to move from the initial configuration (qinit) to the desired configuration (q goal ).(a) Task in the workspace, (b) Task in the Cspace.Image adapted from[37].

FIGURE 2 .
FIGURE 2. RRT in the configuration space.(a) Initial robot configuration (qinit) and desired configuration (q goal ) in the Cspace.(b) Connection between the random sample (q rand ) with the nearest node (qnear).(c) Addition of the new node (qnew) according to the limitation of the tree growth by a constant step size (d).(d)Result of the classic RRT after connecting qinit and q goal .The path generated between the two configurations is highlighted in green and the generated tree is represented by blue dots (nodes) and black lines (edges)

FIGURE 3 .
FIGURE 3. The tree generated by the Workspace-RRT for a 3-DOF planar manipulator.(a) Manipulator model with qi as joints and di as links.(b) The nodes represent the joints equivalent to its level and the edges the correspondent links.

FIGURE 5 .
FIGURE 5. Iteration of the proposed methodology.(a) Sample the x 1 rand point.(b) Find the nearest node with an index immediately below.(c) The node xnew is added with index 1.(d) Index node 2 is added connected to the immediately preceding node (index 1).(e) End of iteration with n node addition.(f) Generated tree after several iterations with the indices 1,2,3 and 4 represented by the colors red, green, blue and black, respectively.

FIGURE 6 .
FIGURE 6. Regions of interest around the target (in yellow).The colors of the circumferences correspond to the color of the joint in the manipulator.In this way, the radius of the circumference is equivalent to the remaining size of the manipulator from the corresponding joint.

FIGURE 7 .
FIGURE 7. Sampling on the surface of the region of interest.The yellow dot represents the target (x goal ), the samples obtained on the surface are represented in green.(x rand ) and the blue dots represent the new nodes added to the tree (xnew).

FIGURE 8 .
FIGURE 8. Histogram of the joint angles generated from sampling on the surface of the solution region.

FIGURE 9 .
FIGURE 9. Complete iteration of Workspace RRT with the sampling rule on the surface of the solution region.(a) Target point (in yellow), base as index node 0 (in black) and solution region (blue circumference).(b) sampling index 1 node in the solution region and adding the new node xnew to the tree with step size limited to the link size d1, (c) index 2 sample in the solution region and addition of the new node xnew, (d) index 3 sample in the solution region and addition of the new node xnew, (e) index 4 sample as the destination itself because it is the only solution region and (f) end of iteration.

FIGURE 10 .
FIGURE 10.Nearest node selection for classic RRT metric.

FIGURE 11 .
FIGURE 11.The proposed metric delimits a circumference of radius equivalent to the corresponding link (di).The selection criteria is the closest node to the circumference.

FIGURE 12 .
FIGURE 12. Tree expansion, in which the green node is the closest node and the blue node is the new node added.(a) Using the classic metric.(b) Using the proposed metric.
tree expands from the closest node of the sample.Metric BThe tree expands from the node which the distance to the sample is closest to the size of the edge i. (Proposed in Section V-B)Target SampleThe sample for the index node n is always the target itself.This aspect is represented in the tables by the symbol (*)

FIGURE 13 .
FIGURE 13.Obstructed environments.The red symbols represent the task targets.The purple rectangles are the obstacles and the manipulator is represented by the black lines (edges) and the gray circles (joints).

FIGURE 15 .
FIGURE 15.Obstructed 3D environments.The red symbols represent the task targets.The purple rectangles are the obstacles and the manipulator is represented by the black lines (edges) and the gray circles (joints).

TABLE I .
Denavit-Hartenberg parameters for all joints of the planar manipulator.

TABLE II .
Description of each RRT approach compared in this paper.

TABLE III .
Description of the aspects discussed.

TABLE IV .
Average performance of RRT variants for a 3-DOF manipulator related to all proposed changes in this paper.

TABLE V .
Average performance of RRT variants for a 10-DOF manipulator related to all proposed changes in this paper.

TABLE VI .
MB-RRT averaged performance for a 3-DOF planar manipulator with different tolerance values.

TABLE VII .
MB-RRT averaged performance for a 10-DOF planar manipulator with different tolerance values.