{'fraction_non_alphanumeric': 0.035628594905505344, 'fraction_numerical': 0.00742810188989318, 'mean_word_length': 4.548140043763676, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Direct B\'ezier-Based Trajectory Planner for Improved Local Exploration of Unknown Environments

Autonomous exploration is an essential capability for mobile robots, as the majority of their applications require the ability to efficiently collect information about their surroundings. In the literature, there are several approaches, ranging from frontier-based methods to hybrid solutions involving the ability to plan both local and global exploring paths, but only few of them focus on improving local exploration by properly tuning the planned trajectory, often leading to"stop-and-go"like behaviors. In this work we propose a novel RRT-inspired B\'ezier-based next-best-view trajectory planner able to deal with the problem of fast local exploration. Gaussian process inference is used to guarantee fast exploration gain retrieval while still being consistent with the exploration task. The proposed approach is compared with other available state-of-the-art algorithms and tested in a real-world scenario. The implemented code is publicly released as open-source code to encourage further developments and benchmarking.


I. INTRODUCTION
The ability to autonomously plan and execute informative trajectories in previously unknown environments is a fundamental requirement for mobile robots. As a matter of fact, they started to be employed in a huge number of different applications which require the ability to efficiently collect new information about the surroundings, such as surface inspection, object search, weed recognition, search and rescue missions, and others more. The problem of Informative Path Planning (IPP), jointly with the problem of environment exploration, has been extensively studied in literature and a rich variety of approaches have been proposed so far. The majority of recent works had focused on novel hybrid approaches leveraging on the interplay between the concepts of local and global exploration [1], [2]. In particular, the major issue behind such works is related to how efficiently combine the two local and global exploration steps, and how to plan high informative global paths out of the current environment information. A limited number of papers focused on improving the local exploration step [1]. In this work we aim to push the current state-of-the-art toward a more smooth and resilient solutions for local exploration in cluttered and possibly varying environments. In particular, we focus on the problem of fast exploration using Unmanned Aerial Vehicles (UAVs). The high maneuverability of the adopted robot motivates solutions able to stress the quadrotor to fully exploit both its computational and dynamical capabilities. The core of this work consists of a new Rapid-exploring Random Tree (RRT) inspired sampling-based exploration algorithm that aims to directly plan high informative feasible trajectories in known space, leading to an optimal local exploration procedure. We show that the combination of the planning of both path and the associated timing law leads to a solution outperforming the state-of-the-art approaches in this field, which usually plans point-to-point trajectories requiring stopping the robot at each exploration step. In particular, we compared the proposed approach against one of the most relevant state-of-the-art solutions represented by [1]. The core contributions of this work can be summarised as follows: 1) We propose a new RRT-inspired Bézier-based local trajectory planner suitable for fast trajectory planning in a known environment avoiding inefficient "stopand-go" like behaviors. The proposed approach is conceived to be easily extended and completed with a state-of-the-art global planning routine. 2) We provide a novel and less conservative condition to guarantee the non-collision property of the generated path. Such a condition is meant to be a natural extension of the well-known Bézier curve properties. 3) Gaussian process inference is used to allow fast reconstruction gain retrieval, while its full computation is left as a background thread. This guarantees fast trajectory planning while preserving consistency with the exploration task. 4) We extensively tested the proposed solution both in simulation and in real-world scenarios. Furthermore, we released the code as an open-source ROS package 1 to encourage further developments and benchmarking.

II. RELATED WORKS
Although the number of solutions presented in the literature is quite variegated, the majority of them can be classified as frontier-based or sampling-based methods. The former class was pioneered in [3] and later more comprehensively developed in [4]. The key idea is to guide the agent toward the borders between free and unmapped space (aka frontiers), since these points may represent those with higher potential information gain. Exploration is then carried out by extracting the map frontiers and by navigating through them sequentially. Several works propose to extend it by adding constraints to ensure low localization errors [5]. The basic frontier-based approach has been also extended to high-speed flight for fast exploration in [6]. In this case, the authors propose to extract frontiers only inside the current Field-Of-View (FoV) and select the one leading to the minimal change in velocity. In recent years, other works focused on rapid exploration [7], by planning global coverage paths and optimising them with respect to the robot dynamics, and on the reformulation of the frontier information gain as a differentiable function [8], allowing paths to be optimised with gradient information. On the other hand, sampling-based methods typically sample random viewpoints to explore the space in a Next-Best-View (NBV) fashion [9], [10]. Much of the work in this domain can be traced back to [11], where the NBV problem has been moved for the first time from the computer graphic field to the robotic domain, with the introduction of the notion of reconstruction gain. The concept of NBV exploration has been afterward extended by [12], where the building of a RRT allows one to weight both the amount of information gained at the viewpoints, and during the agent motion to reach each viewpoint. Unlike frontierbased methods, which are difficult to adapt to other tasks, the sampling-based ones have the advantage to allow any kind of gain formulation. Thanks to that, the original NBV algorithm was extended to consider the uncertainty of localisation [13], [14] and the visual importance of different objects [15]. On the other hand, sampling-based methods suffer from stacking in local minima, leading to a premature ending of the exploration procedure in unlucky scenarios. For this reason, the recent trend is to merge the two frontiers and samplingbased approaches in a local-global exploration fashion. The pioneer of this idea was [16], that utilises a frontier method to detect global goals and supplements these with motion primitives for local exploration. More recent approaches, instead, leverage the capabilities of sampling-based methods and employ additional planning stages to escape from local minima [1], [17]. Other approaches focus on memorising previously visited places and sampled information under the format of roadmaps [18], [19]. Similarly, the work presented in [2] continuously maintains and expands a single RRT of 1 github.com/casy-lab/BezierFastExploration candidate paths. Although the literature has seen some impressive works in the field of NBV, there are very few works concentrating on fast exploration. Even if previous solutions are able to quickly plan globally coverage paths [2], [19], [20], the problem of efficient trajectory planning is rarely addressed. Recently, [21] proposes a novel primitive-based algorithm that addresses exactly this problem, introducing a new planning paradigm where both path and timing law are allocated directly at the planning stage.

III. PROPOSED APPROACH
In order to deal with the exploration problem, we employ a sampling-based receding-horizon trajectory planning approach. Similarly to [1] and [12], the central idea of the proposed algorithm is to expand a RRT [22] by iterative sampling new candidate viewpoints. The obtained RRT is executed one node at a time, in a receding-horizon fashion. Unlike previous works, our algorithm employs a Bézier curve parameterisation to grow and maintain a tree of possible trajectory segments. The proposed approach weights both potential information gain and trajectory cost during the selection of the next goal. Moreover, the planned trajectory does not constrain the end velocity to zero, thus the exploration can be performed quickly by avoiding "stop-and-go" like behaviors. The proposed algorithm is thought to be applied to Unmanned Aerial Vehicles (UAVs), by means of a quadrotor in our case, in order to perform optimal local exploration steps inside a 3D volume, without keeping in consideration the possibility to plan global trajectories. Motivated by the promising results obtained using hybrid approaches [1], we allow adaptability of the proposed solution by letting the tree to be easily extended with global exploration routines. In particular, we implemented efficient rewiring procedures in order to keep in memory and continuously refine the same tree, following the ideas of roadmaps memorisation [19] and continuous tree expansion [2].

A. Bézier Trajectory Parameterization
In this work, instead of using traditional polynomial functions, we adopt the Bernstein polynomial basis and define trajectories as piecewise Bézier curves. A Bézier curve is completely defined by its degree n and a set of n + 1 control points CP = [q 0 · · · q n ], with q i ∈ R. The curve can be evaluated, for any u ∈ [0, 1], as where the basis functions B n i (u) are n-th degree Bernstein basis polynomials [23], [24] of the form The aforementioned polynomials enjoy a partition-of-unity property (i.e. n i=0 B n i (u) = 1 for all u), by which the curve defined by Equation (1) is constrained inside the convex hull generated by its control points CP. Moreover, a ndegree Bézier curve is always n times differentiable and its derivatives preserve a Bézier structure of lower degree. In particular, q (u) := dq/du is a Bézier curve of order n − 1 whose control points CP can be evaluated as q i = n(q i+1 − q i ) ∀i = 0, . . . , n − 1. The overall quadrotor reference trajectory can be expressed through the evolution of its flat outputs [25] represents the coordinates of the center of mass in the world coordinate system, while φ ∈ R is the yaw angle. Both the quantities r and φ are expressed as m-segment piecewise Bézier curves of order n r and n φ , respectively The same definition holds also for φ(t), with n r and r j i substituted by n φ and φ j i . The quantities r j i ∈ R 3 and φ j i ∈ R describe the i th control point of the j th trajectory segment of r(t) and φ(t) respectively, while T j−1 and T j are the start and end time of the j th trajectory segment. Note that the introduced time scaling does not affect the spatial path described by the Bézier curve, but strongly affects its derivatives as The convex hull containment property is a powerful tool to verify both the trajectory feasibility in terms of dynamic constraints, such as velocity or acceleration bounds, and to check for collisions. Fig. 2a reports the classical condition used for collision checking with Bézier curves [26], where the overall curve is constrained inside a safe sphere. The aforementioned approach often results in being too conservative, as a matter of fact the considered sphere is far to be tight over the convex hull, and thus over the curve itself. For this reason we formulate a new proposition that represents a less conservative tool to verify collision (see Fig. 2b).
Proposition 3.1: Let r(u) be a Bézier curve of order n, with control points CP = [r 0 , . . . , r n ]. Moreover, let r i ∈ R and c i ∈ R 3 with i = 0, . . . , n be respectively the radii and centre of n spheres (C 0 . . . C n ), defined as: with c be the centre of the convex hull generated by CP, i.e. c = n i=0 r i /n. Then the curve r(u) is entirely contained inside the spheres envelope, namely Proof: The proof follows from the fact that c belongs to the convex hull and that the spheres envelope composed by C i and C i+1 always contains the convex hull edge r i r i+1 . The first statement is true by construction, since c is a linear combination of r i , while the second one follows from the triangle inequality The aforementioned proposition states that the convex hull containment property can be reformulated taking into account a set of n spheres. Since this set of spheres results to be tighter around the curve with respect to a single big safe ball, the use of this proposition in formulating a new collision condition results in a less conservative approach. The following proposition states the sufficient condition for non-collision as a corollary of Proposition 3.1.
Proposition 3.2: Let r(u) be a Bézier curve of order n, with control points CP = [r 0 , . . . , r n ]. Moreover, let c i and r i with i = 0, . . . , n be the centre and radii of n spheres defined as in Proposition 3.1. The curve r(u) is said to be collision-free, with a safety bound of d safe ∈ R + , if the condition r i − d obs ci − d safe > 0 holds ∀i = 0, . . . , n, where d obs ci represents the Euclidean distance of c i from the closest obstacle.
From now on, we use fifth-order Bézier curves to represent the quadrotor position (n r = 5), while the yaw trajectory is parameterised using third-order Bézier curves (n φ = 3).

B. Tree Structure
The proposed algorithm works by growing and maintaining, at each iteration, a tree T = (N , E) of possible trajectories. Such tree consists of a set of nodes N = {N 1 , . . . , N nn } and a set of edges E = {E i , . . . , E ne }. Each node N i is completely defined by the following five quantities ) represents the amount of information gained if that node is executed, and c i = c(N i ) is the cost associated to the node execution. CP r i and CP φ i are the two sets of control points defining the trajectories r i (t) and φ i (t), while δ i is the execution time. Two nodes N i−1 and N i are connected by an edge E i−1 only if the first (n r/φ + 1)/2 control points of the latter node satisfy some continuity criterion with the last (n r/φ + 1)/2 control points of the former one. This constraint is required to ensure continuity among all trajectory segments of the tree. In particular, since n r = 5 and n φ = 3, we enforce continuity up to the third derivative along r(t) and continuity up to the second derivative along φ(t), namely The aim is to plan sub-optimal trajectories by maximising a user-specified utility function J(R(N i )), with R(N i ) be the sequence of nodes connecting N i to the tree root, which properly combines gains and costs of all nodes in R(N i ). In this context, the tree root is defined as the tree node which is about to be executed by the flying agent. It results that the agent behavior strongly depends on the choice of functions g(N i ), c(N i ) and J(R(N i )). The proposed algorithm is agnostic with respect to these functions. Therefore, the user can specify any formulation of them by ensuring that the following criteria are satisfied [2]: 1) g(N i ) should be a function that depends on the trajectory end position only (g(r i 5 , φ i 3 )), 2) all node gains should be mutually independent, 3) c(N i ) is required to be an intrinsic property of the trajectory (c(CP r i , CP φ i , δ i )).

C. Tree Update
The tree, initially composed by just one root node, is iteratively expanded by randomly sampling viewpoints inside a sphere centred on the current best node (N best ), namely the one among all tree nodes that maximise the utility function J(·). In particular, the sphere is centred exactly on the last control point of CP r best , i.e. r best 5 , while its radius (r sp ) is a user chosen value defined as a parameter for the algorithm. The sampled viewpoint is retained only if it belongs to a known and free part of the environment under exploration and, at the same time, it is far enough from the mapped obstacles. Such viewpoint is considered as the last control point of the next trajectory segment (r i 5 ). Moreover, due to Condition (2), also the control point r i 0 is already defined to ensure position continuity. As regards the heading trajectory, the first control point (φ i 0 ) is established through Condition (5), while the last one (φ i 3 ) is chosen as the value that maximise the potential information gain g(r i 5 , φ), namely in a similar way as done in [1]. The choice of the remaining points (CP r i [1 : 4], CP φ i [1 : 2]) and the trajectory duration (δ i ) is performed concurrently. In particular, the interval of admissible trajectory duration ∆ = [δ min , δ max ] is uniformly discretised as ∆ d = {δ min , δ min + ∆ δ , δ min + 2∆ δ , . . . , δ max } , with ∆ δ = δmax−δmin r , leading to r + 1 possible time intervals. For any δ ∈ ∆ d , the control points r i 1 and r i 2 are computed exploiting Condition (3) and Condition (4). If the obtained points do not satisfy Proposition 3.2 the current δ is discarded, otherwise also the points r i 3 and r i 4 , as well as φ i 1 (Condition (6)) and φ i 2 are computed. Note that the quantities r i 3 , r i 4 and φ i 2 are not constrained by any conditions (2)-(6), thus these points are computed by optimising the induced cost c(CP r i , CP φ i , δ i ). In the same way as before, if the computed points violate Proposition 3.2, or the induced velocity or acceleration exceed the dynamic bounds, the current δ is discarded. Once all δ ∈ ∆ d have been considered, the one leading to the optimal value of c i is selected with the corresponding computed control points and the node is added to the tree. The tree growth continues until it became impossible to find a new node with higher information gain g(·) and the number of sampled nodes go beyond a given threshold (n max ). Once the tree expansion is terminated, the branch leading to the best node is extracted and only the first node of such branch (N opt ) is executed.
It may happen that the tree growth procedure takes too much time, or it may result impossible to find a valid candidate as next trajectory segment. In order to handle these issues, at each iteration two trajectory segments are computed. The first one corresponds to the execution of the best branch, while the second one is a safe trajectory, linked via Constraints (2)-(6) to the first committed segment. The safe trajectory constrains the final velocity to be zero, as well as the final acceleration, and it is executed every time the algorithm fails in planning a new node.

IV. COST FORMULATION
The algorithm presented in Section III is used to plan spatial trajectories by maximising the total utility function J(·). As a consequence, since this function combines both node gain and cost, the choice of functions g(·) and c(·), as well as J(·) itself, is crucial for the success of the exploration procedure and of its performance.

A. Reconstruction Gain g(r, φ)
The reconstruction gain is defined as the amount of space that can be discovered if the agent is located in the considered position (r) and oriented with a given heading angle (φ). The function g(·) can be computed by casting rays outward from the sensor and summing up all the unmapped volume elements that the ray crosses. Although there exist very efficient procedures useful to compute g(·), such as sparse ray-casting [1], its explicit evaluation is still the bottleneck for most of the exploration algorithms proposed within the literature. The work [1], motivated by the continuous nature of the reconstruction gain over its domain, tries to overtake this problem by modelling it as a realisation of a Gaussian Process (GP) [27]. The idea is to infer, when possible, the gain value using previously sampled data, avoiding its explicit computation at each exploration iteration. This approach has the limitation that when the process returns a poor (in terms of resulting variance) estimation, the gain must be explicitly re-computed, leading to a higher overhead due to the double computation. In this work we show that it is possible to completely avoid the gain explicit computation in real-time, during the planning procedure, as it can be left as a background thread. Unlike previous approaches, we propose to evaluate g(·) exclusively through Gaussian Process inference. The motivating assumption is that in previously unexplored areas the reconstruction gain evaluates as the sensor FoV volume. Therefore we impose a GP prior g(r) ∼ GP(V fov , k(r, r , τ )) consisting of a constant mean function, equivalent to the sensor FoV volume, and a squared-exponential kernel where τ is a hyper-parameter known as characteristic lengthscale, iteratively estimated by minimising the associated log-likelihood function [27]. The proposed approach alternates between gain prediction, using the currently sampled data and the current estimation of the hyper-parameter, and correction, where τ is estimated by minimising the loglikelihood over the data.

B. Trajectory Cost c(N i )
In autonomous exploration applications, where classical RRT algorithms are employed, the trajectory cost is usually associated with node distance [1], [12], or execution time [2]. The former penalises long trajectories, while the latter pushes the agent near its dynamical limits in order to execute the task as fast as possible. Recent studies about frontier exploration [6] have shown great results in terms of execution time and traveled distance. In these works, viewpoints are selected considering minimal variations in velocity. Encouraged by the success of these algorithms and keeping in mind the necessity to end the exploration as fast as possible, we propose a trajectory cost that weight execution time and total control effort. The overall trajectory cost is formalised as where µ 1:3 are tuning parameters, while c r (·) and c φ (·) take the following form In this particular case we selected k = 2 and p = 1, leading to trajectories with minimal accelerations and angular velocities. Minimising the angular velocity has several benefits in terms of mapping reconstruction accuracy, due to the fact that the captured data present low blur effect, especially when working with rgb cameras. Note that the three components of r(·) = [r x (·), r y (·), r z (·)] are decoupled inside the cost function, thus Equation (7) can be rewritten as The Bernstein basis parameterisation is closed with respect to operations of derivative, power elevation and integral [23], thus the Equations (8) and (9) can be evaluated in closed form just acting on the trajectory control points in the following way where B r (δ i ) and B φ (δ i ) are the matrix form of the Bézier curves c r (·) and c φ (·) [28]. We take advantage of this property during the planning stage, when selecting the remaining free points r i 3 , r i 4 and φ i 2 . These are computed solving the following optimisation problem which results in an unconstrained QP problem, solvable by equalising the gradient to zero in a similar way as done in [29].

C. Total Utility J(R(N i ))
The total utility function is responsible to merge gains and costs of the tree nodes in only one utility value, which is used to select the best node during exploration. Along this work we borrow the idea of [2], that proposes a total utility function based on the notion of efficiency:

V. IMPLEMENTATION DETAILS
The overall structure of the proposed framework is shown in Fig. 4. The planning framework is built on top of a reliable UAV control scheme and an occupancy map integrator whose construction is out of the scope of this work. The solution relies on three different threads running in parallel.
1) Bézier Exploration Module: acts as the exploration supervisor and is in charge of computing the reference trajectories to be executed from the UAV platform. The exploration module continuously grows and maintains the trajectories tree via random sampling and by reevaluating each sampled non-executed node at each new iteration. Since the tree is executed in a receding-horizon fashion, every time a new trajectory is commissioned, a bunch of previously planned trajectories may become infeasible due to continuity issues. To handle this problem an activation flag is added as a node property. Note that at each sampling, only the (c) Exploration state at 300 seconds. active branches are taken into consideration. Furthermore, the explorer node also keeps care about possible deadline violations. In these cases the executed safe trajectory is added to the tree and rewired to all nearby active nodes. This prevent us to lose previous sampled possible promising trajectories.
2) Gaussian Process Regressor: receives all sampled points from the exploration module and implements a policy to allow the cache of only the most informative ones. In particular, a new point is retained only if it belongs to a new and not explored area. The implementation of an R-tree allows for fast point insertion and retrieval, moreover it eases the insertion condition check. In order to be consistent with the exploration task, and the evolution of the known map, all cached points are reevaluated periodically via explicit gain computation. Such a module is in charge to train the Gaussian process parameters used by the explorer.
3) Information Gain Evaluator: receives the evaluating point and computes explicitly the information gain via sparse ray-casting as in [1].
The architectural subdivision of the implemented algorithm in three different threads allows fast computing high informative trajectories without the explicit gain computation bottleneck. The whole algorithm has been implemented as a ROS network and paired with the PX4 autopilot both for the software-in-the-loop simulations and the real-world tests. As a map representation we use OctoMap [30].

VI. EXPERIMENTAL EVALUATION
The proposed approach has been evaluated via Gazebobased simulations, exploiting the environment RotorS [31] along with the provided 3DR Iris quadrotor model, endowed of a depth sensor. The algorithm performance have been also qualitatively evaluated in real-world scenario tests. In all tests the agent starts in the origin with zero yaw angle. The agent performs an initial action of rotating 360 degrees around the initial hovering point in order to be sure to start the exploration with some initial information at hand.

A. Simulation Tests
The parameters used for the simulations are reported in Table I. Fig. 3 shows the obtained simulation results when agent is required to map an 20 × 10 × 3 urban canyon (see Fig. 6). In particular, in Fig. 3, the blue lines represent the reference trajectory, the red ones are the planned safe motions (both executed and non-executed), while the bottom surface represents the current Gaussian process state. It can be noticed that, the Gaussian process is constantly kept updated with the current map information and it results to      be consistent, at each time instant, with the exploration task. In order to evaluate the performances against the state-ofthe-art solutions, the proposed algorithm has been compared with the Autonomous Exploration Planner (AEP) described in [1]. Fig. 8 compares the amount of explored volume over time by both the approaches. The blue line represents the average of explored area obtained deploying our approach over 10 experiments, with the associated standard deviation represented in shaded blue. Conversely, the line and shade red reports the results obtained via AEP, with the global exploration module disabled, on the same number of experiments. It can be noticed that both algorithms achieve comparable results at the beginning of the exploration, where most of the volume needs to be explored, then our solution tends to get higher exploration rate, thanks to the ability to fast plan the next trajectory. Moreover, it is worth noting that our solution provides more consistency between different tests, as the variance is narrower with respect to the AEP, thus guaranteeing better repeatability of the experiment and a mitigation of the worst case scenarios. Fig. 9 depicts the overall travelled distance on same experiments. Since our solution plans trajectories by never stopping the UAV motion, this leads to an overall travelled distance 2 times higher than the AEP solution.

B. Real-World Tests
The solution has been tested using a real UAV inside an indoor scenario using our office spaces. Fig. 7 shows the scenario with a couple of high obstacles placed at the centre of the area, while the obtained results are depicted in Fig. 5. The used parameters are reported in Table II. The available area was 9 × 6 × 2.5 meters and it was successfully mapped in 170 seconds, the maximum camera range was saturated at 3 meters in order to stress navigation trajectories around obstacles. The used UAV was powered by the PX4 autopilot and endowed with a depth Intel RealSense D455 camera, mounted frontally. Visual odometry, used to localize the UAV in the indoor scenario, was provided by an Intel Realsense T265 tracking camera. Video of the experiment can be found at: [URL PLACEHOLDER]

VII. CONCLUSIONS
In this work, we presented a novel approach to the problem of rapid exploration in three-dimensional unknown environments using UAVs. The proposed solution speedsup local exploration by sequentially building a tree of high informative trajectories. The Bèzier curve parameterisation guarantees fast checking for collisions, while the Gaussian process inference permits fast gain retrieval. The separate threads implementation was the key to avoid the gain computation bottleneck and to allow the algorithm to run without stopping the exploration agent. Simulations show that the combination of path planning and time allocation succeeds in sensibly incrementing the exploration rate with respect to state-of-the-art solutions. As future work we propose to exploit more the Gaussian process properties by incorporating, in the exploration procedure, also the gradient information. Furthermore, we will deeply investigate new solutions in the context of global exploration, that can be efficiently coupled with this local exploration solution.