Four-rotor aircraft time optimal obstacle avoidance online planning method based on unknown environment
By using the nonlinear model and discrete control obstacle function method on the quadcopter UAV, combined with point cloud clustering and dynamic model, the efficiency and safety problems of the quadrotor's obstacle avoidance trajectory generation in the unknown environment are solved, and the problem is achieved. Taking both time optimization and dynamic constraints into consideration, an efficient and safe obstacle avoidance trajectory is generated.
Patent Information
- Application Number
- CN202410870930.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-01
- Publication Date
- 2024-09-10
AI Technical Summary
When existing quad-rotor UAVs generate obstacle avoidance trajectories online in unknown environments, it is difficult to take into account computational efficiency and dynamic characteristics, resulting in insufficiently optimized trajectories and difficulty in balancing safety and complexity.
A time-optimal obstacle avoidance online planning method based on nonlinear models and discrete control obstacle functions is adopted. Through point cloud clustering, time discretization of dynamic models, discrete control obstacle functions and end constraints, a nonlinear optimization model is constructed to generate the optimal Obstacle avoidance trajectory.
While generating the optimal obstacle avoidance trajectory in an unknown environment, it also improves the safety and calculation efficiency of the flight process, simplifies obstacle constraints, reduces the complexity of nonlinear optimization problems, and achieves real-time time optimal avoidance. Obstacle trajectory generation.
Smart Images

Figure CN118625850A
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of trajectory planning, and in particular relates to an online planning method for time-optimal obstacle avoidance of a quadrotor aircraft in an unknown environment. Background Art
[0002] Quad-rotor drones are increasingly being used in search and rescue, aerial photography, industrial surveying, scientific research, and drone exploration due to their simple power structure and flexible three-dimensional spatial mobility. However, limited by their autonomous mission capabilities, most quad-rotor drones serve more as an extension of perception capabilities in human production and life. The vast majority of quad-rotor drones’ safe navigation and flight exploration missions still rely on remote operation by human pilots. Therefore, how drones can generate fast obstacle avoidance trajectories online in unknown environments is an urgent problem that needs to be solved.
[0003] To generate a fast obstacle avoidance trajectory online, you first need to search for a feasible path to the target point in space, that is, use methods such as A* and RRT to give a safe reference path in space. For the generated reference path, the following two methods are currently used to generate the optimal safe obstacle avoidance trajectory in the quadrotor space.
[0004] 1. The continuous-time polynomial method makes full use of the output state of the differential flatness of the quadrotor and can achieve higher computational efficiency. By penalizing the curvature of the polynomial, etc., a safe trajectory is generated. However, since the generated polynomial is essentially smooth and does not consider the dynamic model of the quadrotor, it is difficult to give full play to the dynamic characteristics of the quadrotor, that is, the planned trajectory is not optimal.
[0005] 2. Trajectory decomposition methods in discrete time are often used to plan the path of a quadrotor through waypoints, taking into account that these waypoints may be unknown targets. This method is based on optimization to ensure that the trajectory of the quadrotor satisfies constraints such as the upper and lower bounds of the dynamic model and external inputs. Although the generated trajectories may be optimal, they are usually very complex, take a long time to calculate, and it is difficult to consider obstacle avoidance constraints. To solve this problem, many researchers have proposed using the generated safety polynomials as reference trajectories and designing optimization-based quadrotor controllers to track these safety polynomials. This method can improve control efficiency while ensuring speed and path safety. However, separating the generation of safe trajectories from the controller may lose the optimality of the trajectory. Summary of the invention
[0006] The purpose of the present invention is to address the shortcomings of the current time-optimal obstacle avoidance trajectory online planning method, and propose a time-optimal obstacle avoidance online planning method for a quadrotor aircraft in an unknown environment. The method integrates nonlinear models and discrete control obstacle functions, takes into account the various dynamic constraints of the real quadrotor model, generates an optimal obstacle avoidance trajectory, and takes into account the safety of the flight process.
[0007] The objective of the present invention is achieved through the following technical solutions: a method for online planning of time-optimal obstacle avoidance for a quadrotor aircraft in an unknown environment, comprising the following steps:
[0008] S1, establish a world coordinate system and obtain the point cloud data of the quadrotor in the world coordinate system;
[0009] S2, clustering the point cloud data, using a cube to geometrically represent the spatial point cloud, and establishing a grid map;
[0010] S3, using the grid map to perform path planning through the A* algorithm to obtain a feasible path with the shortest length;
[0011] S4, using the physical characteristics and motion laws of the quadrotor, establish a quadrotor dynamics model with different input and output upper and lower bounds;
[0012] S5, after time discretizing various dynamic constraints of the quadrotor dynamics model, converting the dynamic constraints into dynamic equation constraints using a numerical integration algorithm;
[0013] S6, based on the geometric representation of the space point cloud, the dynamic obstacle avoidance constraint is obtained by constructing a discrete control obstacle function of the space polyhedron dual constraint;
[0014] S7, for the obtained feasible path, set the interval distance to discretize it into multiple waypoints, construct the waypoint constraints using the distance cost of the distance quadratic form, and set the end constraint when reaching the waypoint;
[0015] S8, construct the hot start problem to obtain the initial value, and use the dynamic equality constraint, waypoint constraint, dynamic obstacle avoidance constraint and terminal constraint of the quadrotor dynamics model to construct a nonlinear model of time optimal obstacle avoidance trajectory planning;
[0016] S9, solving the nonlinear model of the time-optimal obstacle avoidance trajectory planning to obtain the time-optimal obstacle avoidance trajectory.
[0017] Furthermore, the point cloud data of the quadrotor aircraft in the world coordinate system is obtained in S1 as follows: first, the position and posture of the quadrotor relative to the world coordinate system, the position and posture of the camera relative to the quadrotor, and the depth map obtained by the depth camera are obtained, and the point cloud data in the camera coordinate system is calculated according to the pixel coordinates and depth camera parameters in the depth map, and the point cloud data is converted to the quadrotor coordinate system according to the position and posture of the camera relative to the quadrotor, and then the point cloud data is converted to the world coordinate system according to the position and posture of the quadrotor relative to the world coordinate system.
[0018] Furthermore, S2 is specifically as follows: clustering the point cloud data in the world coordinate system using the DBSCAN algorithm to obtain the maximum and minimum values of the point cloud in the cluster on each axis in the world coordinate system, simplifying and spatially representing the entire cluster shape using a cube according to the extreme values of the coordinates, constructing a number of grid points, and constructing the occupied points in the grid map according to the obtained cubes.
[0019] Furthermore, the constructed quadrotor dynamics model formula is as follows:
[0020] p=v
[0021]
[0022] Among them, p is the position of the quadrotor in the world coordinate system, q represents the quaternion of the quadrotor's spatial rotation, ω is the angular velocity of the quadrotor, v is the speed of the quadrotor in the world coordinate system, g is the gravitational acceleration at the current position, m is the mass of the quadrotor, R(q) is the rotation matrix converted from the world coordinate system to the body coordinate system, and T is the total thrust generated by the motor.
[0023] Further, the S5 specifically includes: using a multiple shooting method to first time discretize the various dynamic constraints of the quadrotor dynamics model, and using a numerical integration method to convert the various dynamic constraints of the quadrotor dynamics model into dynamic equation constraints; the numerical integration method of the multiple shooting method is shown in the following formula:
[0024] x n+1 =x n +t h f(x n ,w n ,u n )
[0025] Among them, x n+1 is the state of the quadrotor at time n+1, x n is the state of the quadrotor at time n, t h is the discrete time step, w n is the angular velocity control quantity of the quadrotor dynamics model at time n, u nIt is the thrust control quantity of the quadrotor dynamics model at time n.
[0026] Furthermore, the dynamic equality constraint includes: n+1 -x n -f(x k ,w n ,u k )·dt=0
[0027]
[0028] Among them, x n+1 is the state of the quadrotor dynamics model at time n+1, x n is the state of the quadrotor dynamics model at time n, f(xn,wn,un) is a function of the method used for numerical integration, and w n is the angular velocity control quantity of the quadrotor dynamics model at time n, u n is the total thrust control quantity of the quadrotor dynamics model at time n, dt is the time interval of operation, and p n is the position of the quadrotor at time n, q n is the quaternion of the quadrotor spatial rotation at time n, v n is the speed of the quadrotor at time n.
[0029] Furthermore, the discrete control obstacle function of constructing the spatial polyhedron dual constraint specifically includes: approximating the spatial representation of the quadrotor as a rectangle, constructing an optimization problem to calculate the shortest distance between the quadrotor and the spatial representation of the obstacle, and converting the shortest distance into an optimization problem for finding the maximum value through dual optimization and executing stronger constraints.
[0030] Furthermore, the implementation of stronger constraints is specifically: to reduce the complexity of using discrete control obstacle functions,
[0031]
[0032] Adjust to
[0033]
[0034]
[0035] in λ U is the dual variable corresponding to the dual problem, d i (0) is the shortest distance between the quadrotor and the obstacle at the beginning of planning, O iis the ith obstacle, U(k) is the position of the quadrotor approximated rectangle at time k; A is the constraint condition defining the convex polyhedron, b is the boundary condition defining the convex polyhedron, and γ represents the K-type function, so that the state of the quadrotor dynamics model satisfies in the discrete time domain:
[0036] Δh(x k ,u k )≥-γh(x k ),0<γ≤1,
[0037] Where Δh(x k ,u k ):=h(x k+1 )-h(x k ).
[0038] Furthermore, the end constraint is specifically:
[0039] First construct the waypoint constraints:
[0040]
[0041] where p k is the position of the quadrotor at time k, Wp is the position of the waypoint, tol is the maximum allowable deviation, L wp A soft constraint to constrain the trajectory to pass through the waypoint;
[0042] Construct the terminal constraints for the state when the quadcopter reaches the waypoint:
[0043]
[0044] Among them, q k is the quaternion attitude when reaching the final target point calculated according to the quadrotor dynamics model, calculated as the squared Euclidean distance between two vectors, v k is the speed to reach the final target point calculated according to the quadrotor dynamics model, v 0 is zero speed, w k is the input angular velocity to the final target point calculated according to the quadrotor dynamics model, w 0 The angular velocity is zero, that is, it is expected to stop when reaching the target point. v , L w For optimization purposes, it is used during the hot start process to generate initial values. In other cases, L v , L w Set to 0;
[0045] When the waypoint is not the final target point, the formula for the end constraint is:
[0046]
[0047] Where Lyaw It is the optimization objective and is used to impose soft constraints on yaw.
[0048] Furthermore, the nonlinear model for constructing the time-optimal obstacle avoidance trajectory planning includes:
[0049] First, the hot start problem is constructed: the dynamic equation constraints, waypoint constraints and terminal constraints of the quadrotor dynamics model are used to construct a nonlinear optimization model to obtain the initial values; then, the time-optimal optimization target is constructed based on the flight time and yaw angle, and a nonlinear model for time-optimal obstacle avoidance trajectory planning is constructed based on the obtained initial values, dynamic equation constraints, waypoint constraints and terminal constraints.
[0050] The beneficial effects of the present invention are as follows:
[0051] 1. The point cloud in space is represented by a cube through the point cloud clustering method, which simplifies the constraints of obstacles.
[0052] 2. The multiple shooting method is used to transform the optimal control problem of the trajectory into a nonlinear optimization problem. By rationally planning the number of discrete points in the process, the computational complexity of the nonlinear optimization problem is reduced.
[0053] 3. The quadrotor is approximated with a rectangle, and a discrete control obstacle function constraint is constructed for obstacles represented by a cube, so that the generated discrete points are within the safe space. In view of the safety requirements during the flight, the terminal constraints are constructed to enhance the safety of the flight process.
[0054] 4. For the time-optimal planning task of the UAV, a hot-start nonlinear optimization problem is first established to obtain the initial value, and then a time-optimal nonlinear optimization problem is constructed. The corresponding optimization model is established and solved using the Casadi solver to achieve real-time time-optimal obstacle avoidance trajectory generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 It is a structural diagram of an online planning method for time-optimal obstacle avoidance of a quadrotor aircraft in an unknown environment in one embodiment of the present invention;
[0056] Figure 2 A schematic diagram of a quadrotor time-optimal obstacle avoidance trajectory provided by an embodiment of the present invention;
[0057] Figure 3 A quadrotor position state information diagram of a quadrotor time-optimal obstacle avoidance trajectory provided by an embodiment of the present invention.
[0058] Figure 4 A diagram of the position state information of the quadrotor in the x-direction of the time-optimal obstacle avoidance trajectory online planning method provided by an embodiment of the present invention.
[0059] Figure 5 A diagram of the position state information of the quadrotor in the y direction of the time-optimal obstacle avoidance trajectory online planning method provided by an embodiment of the present invention.
[0060] Figure 6 A diagram of the position status information of the quadrotor in the z direction of the time-optimal obstacle avoidance trajectory online planning method provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0061] The specific implementation modes of the present invention are further described in detail below with reference to the accompanying drawings.
[0062] In order to better understand the technical solution of the present application, the embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0063] As attached Figure 1 As shown, this embodiment provides an online planning method for time-optimal obstacle avoidance of a quadrotor aircraft in an unknown environment, comprising the following steps:
[0064] S1, establish a world coordinate system, obtain the position of the quadrotor relative to the world coordinate system and the position of the camera relative to the quadrotor, obtain the depth map obtained by the depth camera, and thus obtain point cloud data in the world coordinate system.
[0065] In one embodiment, step S1 specifically includes the following steps:
[0066] Assume that the position of the quadrotor relative to the world coordinate system is expressed as The position of the camera relative to the quadrotor is expressed as
[0067]
[0068] Assuming that the pixel coordinates in the depth map obtained by the depth camera are (u, v) and the depth value is d(u, v), the corresponding point cloud data can be expressed as (X, Y, Z), and the calculation formula is:
[0069] Z=d(u,v)
[0070]
[0071] Among them, f x ,f y is the focal length of the camera, c x ,c y It is the optical center of the camera.
[0072] Next, convert the point cloud data (X, Y, Z) in the camera coordinate system to the quadrotor coordinate system. The calculation formula is:
[0073]
[0074] in represents the rotation matrix, Represents the translation vector, which represents the position of the camera relative to the quadrotor.
[0075] Finally, the point cloud data (X q ,Y q ,Z q ) is converted to the world coordinate system, and the calculation formula is:
[0076]
[0077] in represents the rotation matrix, Represents the translation vector, which represents the position of the quadrotor relative to the world coordinate system.
[0078] S2, clustering and segmenting the point cloud obtained in step S1, using a cube to represent the spatial point cloud, and establishing a grid map to simplify the spatial obstacle constraints.
[0079] In one embodiment, step S2 specifically includes the following steps:
[0080] Using the DBSCAN algorithm, define the density ε (domain radius) and MinPts (minimum number of points in the neighborhood). Initialize an unvisited spatial point cloud as the starting point, and then find all the points in its neighborhood. If the number of points in the neighborhood of the starting point is greater than or equal to MinPts, mark it as a core point, and continue to explore the points in its neighborhood with this point as the center. This step will recursively expand the core point-neighborhood. For the core point and its reachable points, they are all classified into the same cluster. If a point is a boundary point but is located in the neighborhood of multiple core points, a core point is randomly selected for clustering. All points that do not belong to any cluster are marked as noise points. After obtaining the clustering of the point cloud, obtain the maximum and minimum values of the point cloud in the cluster on the x, y, and z axes in the world coordinate system. According to the extreme values of the coordinates, use a cube to simplify and spatially represent the entire cluster shape. In this example, a cylinder is used as an obstacle, and the clustering result is represented by a rectangle. According to the obtained rectangle, multiple grid points are constructed with appropriate intervals to construct the occupied points in the grid map.
[0081] S3, using the grid map described in step S2, using the A* algorithm for path planning to quickly obtain a feasible path with the shortest length. The A* algorithm is a widely used path search and graph traversal algorithm with excellent performance and accuracy. It uses heuristic information to find the best path.
[0082] In one embodiment, step S3 specifically includes the following steps:
[0083] First, the A* algorithm uses two key sets to manage nodes: open set and closed set. The role of these two sets is to help the algorithm determine the optimal path from the starting point to the target point. In the A* algorithm, the open set stores nodes that have been explored but the optimal cost has not yet been determined. These nodes may be nodes on potential candidate paths, but their final costs still need to be calculated and compared. On the other hand, the closed set is used to store nodes for which the optimal cost has been determined. Once the optimal path for a node is determined, it will be moved to the closed set. This helps avoid repeated calculations and improves the efficiency of the algorithm.
[0084] The algorithm starts from the starting point, adds the starting point node to the open set, and gradually explores the graph or network according to the heuristic function and the cost function. By continuously selecting the best node from the open set for exploration and moving it to the closed set, the A* algorithm gradually finds the optimal path from the starting point to the target point. The formulas of the heuristic function and the cost function are as follows:
[0085] f(n)=g(n)+h(n)
[0086] Among them, f(n) is the total cost from the starting node through the current node n to the target node. g(n) is the actual cost accumulated from the starting node to the current node n, and h(n) is the heuristic estimated cost from the current node n to the target node. By setting the occupied nodes in the grid map as unsearchable nodes, the optimal safe path in the space can be searched.
[0087] S4, using the physical characteristics and motion laws of the quadrotor, establish a dynamic model with different input and output upper and lower bounds to simulate the behavior of the quadrotor in actual applications. The formula of the constructed quadrotor dynamic model is as follows:
[0088] p=v
[0089]
[0090] Among them, p is the position of the quadrotor in the world coordinate system, q represents the quaternion of the quadrotor's spatial rotation, ω is the angular velocity of the quadrotor, v is the speed of the quadrotor in the world coordinate system, g is the gravitational acceleration at the current position, m is the mass of the quadrotor, R(q) is the rotation matrix converted from the world coordinate system to the body coordinate system, and T is the total thrust generated by the motor.
[0091] In one embodiment, step S4 specifically includes the following steps:
[0092] Construct the calculation formula of the quadrotor dynamics model to prepare for the discretization optimization problem.
[0093] S5, using a multiple-targeting method, the various dynamic constraints of the quadrotor dynamic model in step S4 are first time-discretized to reduce the complexity of the calculation. Then, a numerical integration algorithm is used to convert the discrete dynamic constraints into equational dynamic constraints of the quadrotor dynamic model.
[0094] In one embodiment, step S5 specifically includes the following steps:
[0095] Using the multiple shooting method, according to the established quadrotor dynamics model, the various dynamic constraints of the quadrotor dynamics model are converted into dynamic equation constraints using the numerical integration method, so that the quadrotor obstacle avoidance trajectory planning method is discretized into a nonlinear optimization problem. The numerical integration method using the multiple shooting method is shown in the following formula:
[0096] x n+1 =x n +t h f(x n ,w n ,u n )
[0097] Among them, x n+1 is the state of the quadrotor at time n+1, x n is the state of the quadrotor at time n, t h is the discrete time step, w n is the angular velocity control quantity of the quadrotor dynamics model at time n, u n It is the thrust control quantity of the quadrotor dynamics model at time n.
[0098] The equality constraints that ensure the dynamic feasibility of the solution are as follows:
[0099] x n+1 -x n -f(x k ,w n ,u k )·dt=0
[0100]
[0101] Among them, x n+1 is the state of the quadrotor dynamics model at time n+1, x n is the state of the quadrotor dynamics model at time n, f(xn,wn,un) is a function of the method used for numerical integration, and w n is the angular velocity control quantity of the quadrotor dynamics model at time n, u n is the total thrust control quantity of the quadrotor dynamics model at time n, dt is the time interval of operation, and p n is the position of the quadrotor at time n, qn is the quaternion of the quadrotor spatial rotation at time n, v n is the speed of the quadrotor at time n.
[0102] S6, constructing a discrete control obstacle function of the spatial polyhedron dual constraint according to the geometric representation of the spatial point cloud obtained in step S2, constructing a dynamic obstacle avoidance constraint, and ensuring the safety of the quadrotor flight process.
[0103] In one embodiment, the method of constructing the discrete control function in step S6 is specifically as follows:
[0104] First, for safe trajectory control, define as a continuously differentiable function The super level set C is:
[0105]
[0106] Where C is called the safety set, x is the state of the quadrotor dynamics model in space, and h(x) is the control obstacle function.
[0107] exist In the case of If there exists a K-type function γ, the state of the quadrotor dynamics model satisfies in the discrete time domain:
[0108] Δh(x k ,u k )≥-γh(x k ),0<γ≤1.
[0109] Where Δh(x k ,u k ):=h(x k+1 )-h(x k ). Define the h function as the distance between the quadrotor position and the obstacle. If the initial quadrotor position is in the safety set C, the subsequent state of the quadrotor dynamics model will also be in the safety aggregate C if the formula is satisfied, introducing the obstacle avoidance constraint.
[0110] The way to construct the DCBF (discrete control barrier function) dual constraint is as follows:
[0111] The spatial representation of the quadrotor is approximated as a rectangle, and the length and width are determined by the actual length and width of the quadrotor. The formula for defining the cube of the quadrotor and the point cloud clustering result in the S2 step in a two-dimensional plane using a convex polyhedron is as follows:
[0112]
[0113] U(k):={p∈ l ∣A U(k)p≤b U (k)}
[0114] Among them, O i is the ith obstacle, U(k) is the position of the rectangle approximated by the quadrotor at time k. A is the constraint condition defining the convex polyhedron, and b is the boundary condition defining the convex polyhedron.
[0115] According to the defined inequality, an optimization problem can be constructed to calculate the shortest distance between two convex polyhedrons. The calculation formula is:
[0116]
[0117] But if the calculated h i (x) is a discrete control barrier function, which has the problem of slow calculation speed and non-differentiable implicit constraints. Therefore, the optimization problem of seeking the minimum value is transformed into the optimization problem of seeking the maximum value through dual optimization, and the calculation formula is:
[0118]
[0119] in λ U is the dual variable corresponding to the dual problem.
[0120] To reduce the complexity of using DCBF (Discrete Control Barrier Function) and enforce stronger constraints, the final calculation formula is:
[0121]
[0122]
[0123] where d i (0) is the shortest distance between the quadrotor and the obstacle at the beginning of planning.
[0124] S7, for the feasible path obtained in step S3, set the interval distance to discretize it into multiple waypoints. Use the distance cost of the distance quadratic form to construct the waypoint constraint. And set the end constraint when reaching the waypoint to ensure the safety of the generated obstacle avoidance trajectory.
[0125] In one embodiment, the method of constructing the waypoint constraint and the obstacle avoidance constraint in step S7 is specifically as follows:
[0126] To ensure the real-time performance of the algorithm, the trajectory is discretized into multiple given discrete points to reduce the complexity of the calculation. When the distance from the waypoint to the current point is known, set an appropriate number of discrete points. Assuming that the kth point can reach the waypoint, the formula for constructing the waypoint constraint is:
[0127]
[0128] where p k is the position of the quadrotor at time k, Wp is the position of the waypoint, tol is the maximum allowable deviation, L wp A soft constraint that constrains the trajectory to pass through a waypoint.
[0129] To ensure the safety of the flight process, it is very important to keep the yaw as far as possible toward the front of the trajectory and the deceleration process of the stop state. Therefore, for the state when the quadcopter reaches the waypoint, the formula of the end constraint is constructed. First, the yaw value of the current position toward the waypoint is calculated and converted into a quaternion form, assuming that it is q n When the waypoint is the final target point, the formula for constructing the end constraint is:
[0130]
[0131] Among them, q k is the quaternion attitude when reaching the final target point calculated according to the quadrotor dynamics model, calculated as the squared Euclidean distance between two vectors, v k is the speed to reach the final target point calculated according to the quadrotor dynamics model, v 0 is zero speed, w k is the input angular velocity to the final target point calculated according to the quadrotor dynamics model, w 0 The angular velocity is zero, that is, it is expected to stop when reaching the target point. v To limit the end of the trajectory to reach the desired speed v 0 The soft constraint term, L w To limit the end posture to the desired posture w 0 The soft constraint term of L is used in the hot start process to generate the initial value. v , L w Set to 0.
[0132] When the waypoint is not the final target point, the formula for constructing the end constraint is:
[0133]
[0134] L yaw It is used to optimize the target and to impose soft constraints on yaw.
[0135] In this embodiment, the waypoints are points in the feasible path searched by A* about 2 m away from the initial state, and the number of the three discrete points is 10.
[0136] S8, construct the hot start problem, and use the dynamic equality constraints, waypoint constraints, and terminal constraints of the quadrotor dynamics model to build a nonlinear optimization model. Using the initial dynamic feasible trajectory obtained from the hot start optimization problem, the dynamic equality constraints, waypoint constraints, obstacle avoidance constraints, and stricter terminal constraints of the quadrotor dynamics model are used to build a nonlinear model for time-optimal obstacle avoidance trajectory planning.
[0137] In one embodiment, step S8 constructs a nonlinear model of the hot start problem and time-optimal obstacle avoidance trajectory planning as follows:
[0138] First, construct the hot start problem. Given the distance between the current waypoint and the initial position, set N points as the trajectory points of the entire discrete process. In this embodiment, N is 10. Based on the distance between each point and the maximum acceleration and linear velocity, the initial time Δt between the trajectory points is given, and the hot start problem can be constructed. The soft constraints that are feasible for constraint dynamics are given as follows:
[0139]
[0140] When only one waypoint is considered, the optimization objective is constructed as:
[0141]
[0142] stx lb ≤x k ≤x ub
[0143] u lb ≤u k ≤u ub
[0144] w lb ≤w k ≤w ub
[0145] x 0 =xinit
[0146] Among them, xk is the state of the quadrotor at k, uk is the input thrust of the quadrotor at k, wk is the input angular velocity of the quadrotor at k, and x init It is the initial state when trajectory planning starts. In this embodiment, the waypoint is the path point obtained by A* search about 2m away from the initial state.
[0147] After obtaining the initial value through hot start, the optimal obstacle avoidance trajectory is generated based on the initial value. First, the optimization variable formula for the minimum time is defined as:
[0148]
[0149] Among them, Δtk is the time interval between each of the N scattered points.
[0150] Therefore, the nonlinear optimization problem formula for the total time optimal obstacle avoidance trajectory can be constructed as:
[0151]
[0152] stx lb ≤x k ≤x ub
[0153] u lb ≤u k ≤u ub
[0154] w lb ≤w k ≤w ub
[0155] x 0 =xinit
[0156]
[0157] When the target waypoint is the end point of the path planning, the end stop constraint needs to be added. The formula is:
[0158]
[0159] S9, based on the nonlinear optimization problem model in step S8, using the large-scale nonlinear solver Casadi to solve the nonlinear optimization problem to obtain the time-optimal obstacle avoidance trajectory.
[0160] In one embodiment, the method of solving the obstacle avoidance trajectory in step S9 is specifically as follows:
[0161] The open source software tool CasADi is used for symbolic mathematical calculations and automatic differentiation. The C++ application programming interface is used to write the optimization program, and the IPOPT solver is used to solve the nonlinear optimization problems of hot start and time optimization. The solution results are tracked using a differential flat controller.
[0162] The quadrotor dynamics model used in this embodiment is a standard quadrotor model. The specific basic parameter configuration of the dynamics model is shown in Table 1.
[0163] Table 1 Quadrotor parameter configuration
[0164] property Standard quadrotor Mass m(kg) 1 Wheelbase (m) 0.13 Thrust range T(N) 1-30 <![CDATA[Maximum rotation angle ω max (rad / s)]]> 3 Maximum line speed (m / s) 2
[0165] The specific implementation details are as follows:
[0166] Build a simulation environment in Gazebo and set up multiple obstacles. Cluster the cylindrical obstacles in the space into cubes, as follows: Figure 3 An obstacle avoidance trajectory planned by the online planning method of the optimal obstacle avoidance trajectory of a quadrotor aircraft in an unknown environment is shown in Figure 2 As shown, Figure 2 It can be seen that the trajectory planned by the present invention can reach the target point, avoid obstacles in the path, maintain a safe distance, and the planned path can meet the dynamic constraints of the quadrotor model. The quadrotor position state information of the time-optimal obstacle avoidance trajectory online planning method is given by Figure 4 , Figure 5 and Figure 6 shown. Figure 4 The horizontal axis is time, and the vertical axis is the distance traveled by the UAV in the x direction during the simulation. Figure 5 The horizontal axis is time, and the vertical axis is the distance traveled by the UAV in the y direction during the simulation. Figure 6 The horizontal axis is time, and the vertical axis is the distance traveled by the UAV in the z direction during the simulation.
[0167] The above embodiments are used to illustrate the present invention rather than to limit the present invention. Any modification and change made to the present invention within the spirit of the present invention and the protection scope of the claims shall fall within the protection scope of the present invention.
Claims
1. A method for online planning of time-optimal obstacle avoidance for a quadrotor aircraft in an unknown environment, characterized in that: The following steps are involved: S1, establish a world coordinate system and obtain the point cloud data of the quadrotor in the world coordinate system; S2, clustering the point cloud data, using a cube to geometrically represent the spatial point cloud, and establishing a grid map; S3, using the grid map to perform path planning through the A* algorithm to obtain a feasible path with the shortest length; S4, using the physical characteristics and motion laws of the quadrotor, establish a quadrotor dynamics model with different input and output upper and lower bounds; S5, after time discretizing various dynamic constraints of the quadrotor dynamics model, converting the dynamic constraints into dynamic equation constraints using a numerical integration algorithm; S6, based on the geometric representation of the space point cloud, the dynamic obstacle avoidance constraint is obtained by constructing a discrete control obstacle function of the space polyhedron dual constraint; S7, for the obtained feasible path, set the interval distance to discretize it into multiple waypoints, construct the waypoint constraints using the distance cost of the distance quadratic form, and set the end constraint when reaching the waypoint; S8, construct the hot start problem to obtain the initial dynamic feasible trajectory, and use the dynamic equality constraints, waypoint constraints, dynamic obstacle avoidance constraints and terminal constraints of the quadrotor dynamics model to construct a nonlinear model for time-optimal obstacle avoidance trajectory planning; S9, solving the nonlinear model of the time-optimal obstacle avoidance trajectory planning to obtain the time-optimal obstacle avoidance trajectory.
2. The method according to claim 1, characterized in that The step of obtaining the point cloud data of the quadrotor in the world coordinate system in S1 is specifically as follows: first, the position and posture of the quadrotor relative to the world coordinate system, the position and posture of the camera relative to the quadrotor, and the depth map obtained by the depth camera are obtained; the point cloud data in the camera coordinate system is calculated according to the pixel coordinates in the depth map and the depth camera parameters; the point cloud data is converted to the quadrotor coordinate system according to the position and posture of the camera relative to the quadrotor; and then the point cloud data is converted to the world coordinate system according to the position and posture of the quadrotor relative to the world coordinate system.
3. The method according to claim 1, characterized in that Specifically, S2 is as follows: clustering the point cloud data in the world coordinate system using the DBSCAN algorithm to obtain the maximum and minimum values of the point cloud in the cluster on each axis in the world coordinate system; according to the extreme values of the coordinates, using a cube to simplify and spatially represent the entire cluster shape, constructing a number of grid points, and constructing the occupied points in the grid map based on the obtained cubes.
4. The method according to claim 1, characterized in that: The constructed quadrotor dynamics model formula is as follows: p=v Among them, p is the position of the quadrotor in the world coordinate system, q represents the quaternion of the quadrotor's spatial rotation, ω is the angular velocity of the quadrotor, v is the speed of the quadrotor in the world coordinate system, g is the gravitational acceleration at the current position, m is the mass of the quadrotor, R(q) is the rotation matrix converted from the world coordinate system to the body coordinate system, and T is the total thrust generated by the motor.
5. The method according to claim 1, characterized in that The S5 specifically includes: using a multiple-targeting method to first time discretize the various dynamic constraints of the quadrotor dynamics model, and using a numerical integration method to convert the various dynamic constraints of the quadrotor dynamics model into dynamic equation constraints; the numerical integration method of the multiple-targeting method is shown in the following formula: x n+1 =x n +t h f(x n ,w n ,u n ) Among them, x n+1 is the state of the quadrotor at time n+1, x n is the state of the quadrotor at time n, t h is the discrete time step, w n is the angular velocity control quantity of the quadrotor dynamics model at time n, u n It is the thrust control quantity of the quadrotor dynamics model at time n.
6. The method according to claim 5, characterized in that The dynamic equality constraints include: n+1 -x n -f(x k ,w n ,u k )·dt=0 Among them, x n+1 is the state of the quadrotor dynamics model at time n+1, x n is the state of the quadrotor dynamics model at time n, f(xn,wn,un) is a function of the method used for numerical integration, and w n is the angular velocity control quantity of the quadrotor dynamics model at time n, u n is the total thrust control quantity of the quadrotor dynamics model at time n, dt is the time interval of operation, and p n is the position of the quadrotor at time n, q n is the quaternion of the quadrotor spatial rotation at time n, v n is the speed of the quadrotor at time n.
7. The method according to claim 1, characterized in that The discrete control obstacle function of constructing spatial polyhedron dual constraints specifically includes: approximating the spatial representation of the quadrotor as a rectangle, constructing an optimization problem to calculate the shortest distance between the quadrotor and the spatial representation of the obstacle, and converting the shortest distance into an optimization problem for finding the maximum value through dual optimization and executing stronger constraints.
8. The method according to claim 7, characterized in that The implementation of stronger constraints is specifically: To reduce the complexity of using discrete control barrier functions, Adjust to in λ U is the dual variable corresponding to the dual problem, d i (0) is the shortest distance between the quadrotor and the obstacle at the beginning of planning, O i is the ith obstacle, U(k) is the position of the quadrotor approximated rectangle at time k; A is the constraint condition defining the convex polyhedron, b is the boundary condition defining the convex polyhedron, and γ represents the K-type function, so that the state of the quadrotor dynamics model satisfies in the discrete time domain: Δh(x k ,u k )≥-γh(x k ),0<γ≤1, Where Δh(x k ,u k ):=h(x k+1 )-h(x k ).
9. The method according to claim 1, characterized in that: The terminal constraints are specifically: First construct the waypoint constraints: where p k is the position of the quadrotor at time k, Wp is the position of the waypoint, tol is the maximum allowable deviation, L wp A soft constraint to constrain the trajectory to pass through the waypoint; Construct the terminal constraints for the state when the quadcopter reaches the waypoint: Among them, q k is the quaternion attitude when reaching the final target point calculated according to the quadrotor dynamics model, calculated as the squared Euclidean distance between two vectors, v k is the speed to reach the final target point calculated according to the quadrotor dynamics model, v0 is zero speed, w k is the input angular velocity to reach the final target point calculated according to the quadrotor dynamics model, w0 is zero angular velocity, that is, it is expected to stop when reaching the target point; L v , L w It is used in the hot start process to generate the initial dynamic feasible trajectory for the optimization target. In other cases, L v , L w Set to 0; When the waypoint is not the final target point, the formula for the end constraint is: Where L yaw It is the optimization objective and is used to impose soft constraints on yaw.
10. The method according to claim 1, characterized in that The nonlinear model for constructing the time-optimal obstacle avoidance trajectory planning includes: First, the hot start problem is constructed: the dynamic equation constraints, waypoint constraints and terminal constraints of the quadrotor dynamics model are used to construct a nonlinear optimization model to obtain the initial dynamically feasible trajectory; then, the time-optimal optimization target is constructed based on the flight time and yaw angle, and a nonlinear model for time-optimal obstacle avoidance trajectory planning is constructed based on the obtained initial values, dynamic equation constraints, waypoint constraints and terminal constraints.
Citation Information
Cited By
Unmanned rotorcraft visual navigation method and system for unknown forest area
CN121007563A
Symbol distance-based safe interaction dynamic game trajectory planning method
CN121349068A
