A drone ball-shooting device and trajectory planning method
By employing a two-stage polynomial trajectory planning method for drones, the problem of handling long-distance and extreme posture shots in existing technologies is solved, enabling drones to perform efficient shot-hitting tasks in complex scenarios with good robustness and accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ROBOTICS RESEARCH CENTER OF YUYAO CITY
- Filing Date
- 2023-04-23
- Publication Date
- 2026-05-26
AI Technical Summary
Existing drone ball-hitting systems cannot handle ball-hitting tasks at long distances and in extreme postures, resulting in motion trajectories exceeding dynamic constraints or failure to plan trajectories, making them unsuitable for drone-based ball-hitting scenarios.
A two-stage initial polynomial trajectory planning method for UAVs is adopted. By constructing a dynamic model and a collision model, the transition state of the hitting trajectory is designed. The motion trajectory of the UAV is optimized by using the Pontryagin minimum principle and minimum control theory. Combined with real-time adjustment at a replanning frequency of 20 frames per second, the optimal hitting trajectory is generated.
It enables drones to accurately hit the ball from a distance and in extreme postures and bounce the ball back to the target point. It has good robustness and aggressiveness, avoids the constraints of drone dynamics, and the hitting posture is not fixed, which is close to the way humans hit the ball.
Smart Images

Figure CN116661303B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of drone interception of flying objects, specifically relating to a drone ball-shooting device and trajectory planning method. Background Technology
[0002] Quadrotor drones are characterized by their high flexibility and maneuverability. Leveraging their high thrust-to-weight ratio, they can perform large-scale, high-speed aerial maneuvers, enabling highly maneuverable tasks such as drone interception and juggling. Drone ball juggling, in particular, is highly entertaining and tests the drone's planning, decision-making, and control capabilities. Currently, the Quadrocopter ball juggling system developed by ETH Zurich and the Ball juggling system with an under-actuated flying robot developed by Shanghai Jiao Tong University can perform both single-drone and multi-drone juggling tasks. However, these systems focus on keeping the ball in the air for longer periods without falling, resulting in a fixed hitting position and limiting the drone's hitting posture. This makes them unsuitable for long-distance, extreme hitting situations and thus unsuitable for drone ball juggling scenarios. Summary of the Invention
[0003] To address the shortcomings of existing technologies and enable drones to complete ball-hitting tasks in a wider range and under more extreme conditions, while avoiding drone motion trajectories exceeding dynamic constraints or planned trajectory failures, this invention adopts the following technical solution:
[0004] A method for planning the trajectory of a ball shot by a drone includes the following steps:
[0005] Step S1: Generate the initial polynomial trajectory of the UAV in two stages. Obtain the position and velocity information of the sphere at time T from the predicted trajectory of the flying sphere. The predicted trajectory of the sphere can be a continuous function trajectory or a discrete trajectory. Design the transition state of the hitting trajectory, establish a collision model, and calculate the UAV state at the time of collision as the trajectory terminal state to generate the initial value of the polynomial trajectory. The entire UAV motion process is divided into a preparation stage and a hitting stage. Specifically, it includes the following steps:
[0006] Step S11: Construct a dynamic model of the UAV, modeling the UAV as a rigid body with six degrees of freedom;
[0007] Step S12: Obtain the state of the flying ball at time T; if the predicted trajectory is a continuous function, then substitute time T to directly obtain the state of the ball at that time; if the predicted trajectory is a discrete state, then interpolate the discrete state at time T to obtain the position and velocity information of the flying ball at that time as the state of the ball when it collides with the ball.
[0008] Step S13: Construct a collision dynamics model; simplify the drone's ball-hitting collision model, considering only the instantaneous interaction between the racket and the ball in the direction normal to the racket face, ignoring the effect of the racket's tangential direction on the ball; simplify the ball's flight model after rebound, and analytically solve the drone's ball-hitting terminal state under the premise of manually setting the target landing point;
[0009] Step S14: Design the initial transition point state of the UAV; design T t The state of the drone at the transition point is included in the optimization variables of the drone trajectory optimization. The transition point plays an optimization and guidance role in the entire hitting trajectory, so that the drone can adjust to a more ideal ready posture and then execute the subsequent hitting process.
[0010] Step S15: Generate two-stage UAV polynomial motion primitives; using the Pontryagin minimum principle, solve the optimal control at two endpoints (OBVP) problem for the UAV from the starting point to the transition point and from the transition point to the hitting point, and generate a two-stage polynomial trajectory.
[0011] Step S16: Sample the initial polynomial UAV state; In the two-stage polynomial trajectory, sample at equal time intervals to divide the trajectory into M=4 segments and M-1 intermediate points. The initial state, intermediate point state, and end state of each stage are used as the initial values of the trajectory. Together with the initial values of the UAV flight time set in the two stages, the subsequent UAV trajectory optimization based on polynomial is performed.
[0012] Step S2: Based on polynomial-based UAV trajectory optimization, the terminal states, intermediate state, and flight time of the UAV in the two stages of the initial polynomial trajectory generation are used to generate multiple polynomial trajectories. An objective function and constraints are then constructed to optimize these multiple polynomial trajectories. Specifically, the steps are as follows:
[0013] Step S21: Determine the optimization variables; the optimization variables include the drone's transition point state, the hitting point state, the intermediate point state during the process, and the two-stage drone flight time;
[0014] Step S22: Construct the optimization problem; construct the optimal control cost term and constraints;
[0015] Step S23: Generation of multi-segment polynomial trajectory; Using Minimum Control Theory (MINCO) (Z.Wang, X.Zhou, C.Xuand F.Gao, “Geometrically Constrained Trajectory Optimization for Multicopters,” in IEEE Transactions on Robotics, vol.38, no.5, pp.3259-3278, Oct.2022.), the initial values of the two-stage initial polynomial trajectory generation output are used to directly generate a two-stage multi-segment polynomial trajectory;
[0016] Step S24: Construct the objective function; transform the constrained trajectory generation problem into an unconstrained nonlinear optimization problem by eliminating time constraints and imposing constraint penalties;
[0017] Step S25: Construct cost terms and cost functions; construct the penalty form and cost function for each cost term, and obtain the gradient of each cost term with respect to each optimization variable;
[0018] Step S26: Solve the optimization problem; use the L-BFGS algorithm to solve the entire optimization problem from step S24 to step S25, obtain the optimal variables, and construct the optimal polynomial trajectory;
[0019] Step S27: Execute the optimal control quantity; Discretize the polynomial trajectory of step S26 into state quantities at each time step, calculate the control quantity through the UAV dynamics model, send the control quantity to the flight controller for calculation using serial communication, and execute the calculated control command to realize the UAV's ball-hitting task under the given target point.
[0020] Furthermore, the entire process from step S12 to step S27 involves planning the drone's ball-hitting trajectory. To improve the accuracy of the ball-hitting, the drone's ball-hitting trajectory is continuously replanned during the drone's movement, with a replanning frequency of 20 frames per second.
[0021] Furthermore, in step S11, the quadcopter drone is modeled as a six-degree-of-freedom rigid body, wherein linear translation... And rotation R∈SE(3), translational motion depends on gravitational acceleration g and control thrust. Rotational motion with fuselage angular velocity The input is as follows; the model is as follows:
[0022]
[0023] Where τ represents the net thrust in global coordinates, e i It is the i-th column of I3. Represents the skew-symmetric matrix form of the cross product of vectors;
[0024] In step S12, the discrete state of the assumed sphere's predicted trajectory is interpolated at time T to obtain the sphere's state at time T; a second-order continuous cubic interpolation function is constructed as follows:
[0025]
[0026] To provide gradients for trajectory optimization in the following text, the discrete predicted trajectory is interpolated using Equation (b), where the discrete intervals are uniform in the time domain and the time resolution is θ; an array is constructed to store the discrete positions or velocities of the sphere after prediction. Discretize in the uniform time domain and take four adjacent discrete positions. Interpolation is performed, and the position P is obtained by three interpolations at time T. c (T) is represented as:
[0027] P c (T)=P a ·W (c)
[0028] in:
[0029]
[0030]
[0031] The interpolation of the sphere's velocity is performed using the same method as described above.
[0032] Furthermore, in step S13, the racket is rigidly mounted on the quadcopter drone, and the center of mass of the racket is represented as... Where z d (t) represents the change in the racket face normal direction over time, i.e., the change in the drone's attitude over time; the relationship between the racket and the ball only considers the racket face normal direction z. d The instantaneous effect on the racket determines its coefficient of restitution. in and Let represent the velocities of the flying sphere before and after the collision, respectively; the instantaneous collision model is constructed as follows:
[0033]
[0034] By decoupling the calculation of the instantaneous attitude and velocity required by the UAV at the time of collision in Euclidean space, the expected hitting attitude z of the UAV at time T at the time of collision can be obtained from formula (f). d (T) and ball speed It can be calculated as:
[0035]
[0036]
[0037] Where V ⊥,des This indicates the racket's desired hitting posture z. d The desired velocity in the direction, after the UAV collides with the sphere, requires the construction of a model of the sphere's rebound flight trajectory, which is also part of the collision dynamics model.
[0038] A simplified model of the sphere's trajectory after the collision and bounce is presented, considering only gravity g = [0 0 g]. T The influence, dynamic modeling is Target point s t The velocity of the sphere before the collision is given manually and used as one of the inputs to the entire system. If the unknown variables in the drone ball-hitting problem can be obtained through trajectory prediction, then the unknown variables include the flight time of the ball after it is hit. Initial velocity of the spheres after the collision Based on the xyz three-axis, the ball striking speed on the drone and thrust τ h =(τ x , τ y , τ z The drone's striking position p h =(p x p y p z Based on the analytical calculation of the ball's flight time before the collision, the following relationship can be calculated from equation (g) during the decoupled motion process in Euclidean space:
[0039]
[0040] By decoupling the velocity and thrust of the ball, the relationships between the three-axis velocities and the three-axis thrusts after decoupling are obtained analytically using equations (h) and (i) as follows:
[0041]
[0042]
[0043] Formula (k) is abbreviated as τ y =τ y (τ x , τ z T h Formula (j) is abbreviated as The optimization variables for the terminal state of the drone's ball-hitting trajectory include: τ x , τ z T h ; where T hIt is the total time of motion during the drone's ball-hitting phase;
[0044] Design the initial hitting point state of the drone; given the initial hitting time, obtain the initial hitting point position p from step 12. h The initial striking point state of the drone is determined by the drone's attitude when the rebounding ball's velocity forms a certain angle (60°) with the horizontal plane, and an initial τ is set. z =1.1g, and the initial τ can be obtained through equation (g) and equation (k). x With τ y ; Let the initial The initial value is obtained through equation (j). And set the initial
[0045] Furthermore, in step S14, the state of the ball after the collision, obtained from equation (f), is directly related to the speed of the drone when hitting the ball. The motion process may lead to the following conflict: the drone maintains a high speed throughout the process to hit a ball at a greater distance, but the instantaneous speed at impact calculated by step 13 is relatively low. Therefore, a transition point is designed to provide smooth guidance for the trajectory, ensuring a reasonable drone hitting speed and attitude. The initial transition point position p of the drone... t The drone starts moving from its initial position p0 and passes through the transition point p. t Reaching the hitting point p h And hit the ball to the designated target landing point s t ;
[0046] The calculation steps for the transition point are as follows: s0 represents the intersection of the simulated trajectory of the flying sphere integrating backward and the ground. Find s0s t The midpoint s of the line segment mid , through s mid and p h Receive ray l r , at p0 and p h Line segment l h Take an offset relative to p0. point p α Then p α Projected onto l r Get point p ⊥ Finally, from p ⊥ Along p ⊥ to p α The line segment l of the perpendicular line t bias The transition point p is obtained. t .in
[0047] Initial transition point thrust τ of the UAV t Through its normalized direction vector eτ and To determine, where τ z The thrust component along the z-axis at the aforementioned point of impact;
[0048] The initial transition point velocity of the drone is designed as follows: in The speed of the drone at the aforementioned striking point, It is a three-dimensional decoupling coefficient vector, and the initial...
[0049] State of transition point and the drone movement time T during the preparatory phase t The optimization variables are incorporated into subsequent optimization stages; when generating the initial polynomial trajectory, trajectories for two stages are generated separately, namely the preparation stage and the striking stage, with the start and end points being p0→p. t →p h .
[0050] Furthermore, in step S15, polynomial motion primitives for each stage are generated by solving the two-point boundary value control optimality (OBVP) problem; the generation method for the motion primitives in both stages is the same in this step, and for convenience, the start and end states of a single stage are represented as p. s →p g ;
[0051] The optimal control form is as follows:
[0052]
[0053]
[0054] Where p (i) Let p be the i-th derivative. To represent the control input on a single axis, we first introduce the costate λ = (λ1, λ2, λ3), and define the Hamilton equation as follows:
[0055] H(s,j,λ)=j 2 +λ T f(s,j)=j 2 +λ1v+λ2a+λ3j (n)
[0056] And based on the principle of minima, λ satisfies the following relationship:
[0057]
[0058] Where * denotes the optimal quantity, by introducing constant coefficients μ, σ, and γ, we can obtain:
[0059]
[0060] The optimal control input is obtained by minimizing the Hamilton equation:
[0061]
[0062] Substituting equation (q) into equation (m) yields:
[0063]
[0064] Integrating equation (q) yields:
[0065]
[0066] Optimal trajectory p * If (t) satisfies the start and end point states, substituting the start and end point states into equation (s), we can obtain the constant coefficients as follows:
[0067]
[0068] Further, in step S16, in the two-stage polynomial trajectory, samples are taken at equal time intervals to segment the trajectory into M segments for UAV trajectory optimization. Multiple polynomial segments are generated in each stage, and the intermediate point is denoted as... Where j = (1, 2...M-1), i = (t, h), and combining the above steps, the total optimization variables in the two stages include...
[0069] The optimization variables obtained in step S21 include the intermediate point states during the preparatory stage. Transition point state Midpoint state during the hitting phase Point of contact Preparatory phase exercise time T t The motion time T during the process phase h ;
[0070] In step S22, the drone ball-hitting trajectory optimization problem is a nonlinear optimization problem, which is constructed as follows:
[0071]
[0072] stT i >0, (u2)
[0073]
[0074]
[0075]
[0076] H min <H<Hmax (u6)
[0077]
[0078] Where i = t, h represents the preparation phase and the striking phase, and T represents the total motion time of the UAV from the starting point to the striking point; formula (u1) is the control optimal term and the time optimal term; formula (u2) is the natural constraint term; formula (u3) ensures that the two-stage trajectory is third-order continuous at the transition point; formula (u4) is the dynamic constraint term, including the velocity of the trajectory. angular velocity ω of the machine body i (t) and thrust τ i (t); Formula (u5) is a safety constraint to prevent the drone from colliding with the ground; Formula (u6) is a hitting rule constraint to limit the height of the rebound ball, which has a positive impact on the drone's hitting posture; Formula (u7) is a hitting terminal speed constraint to limit the drone's speed and prevent excessive speed during hitting, which could lead to an unhealthy hitting posture.
[0079] Furthermore, in step S23, the Minimum Control Theory (MINCO) is employed, with ξ MINCO The polynomial trajectory class can be represented in the following form:
[0080]
[0081] Where c represents the coefficient vector of the polynomial segment, m = 3 represents the spatial dimension of the trajectory, the entire trajectory consists of M = 4 polynomial segments, each polynomial is set to order N = 2s⁻¹, where s = 4 is used to minimize the integral of the square of the jerk (snap); ξ MINCO All trajectories are constructed using only intermediate points q and time vectors T, with a polynomial c = U(q, T) in linear complexity; furthermore, any cost function can be mapped: Therefore, it passes within linear complexity. and To calculate and For the optimization variables q, p t p h In other words, calculate first This is then transmitted to as well as The problem is then solved effectively using a relevant nonlinear optimizer.
[0082] In step S24, ξ is used MINCO Trajectory-based, time-constraint elimination, and constraint penalty methods transform the constrained trajectory generation problem into an unconstrained nonlinear optimization problem;
[0083] The objective function is as follows:
[0084]
[0085] Where w is the weight vector. For optimal control cost, For the optimal cost of time, For the price of speed, For the sake of the body's angular velocity, For the cost of thrust, For the sake of safe space, For the sake of the rules of hitting the ball, The cost is the speed at the end of the stroke.
[0086] Furthermore, in step S25, the penalty form and cost function for each cost are constructed;
[0087] 1) Controlling the optimal cost Its cost function is the same as the first term of formula (u1), and has the following form:
[0088]
[0089] The gradient of the optimization variable is calculated as follows:
[0090]
[0091]
[0092] 2) Optimal time cost Its cost function is the same as the second term of formula (u1), and has the following form:
[0093]
[0094] Since formula (u2) is a natural constraint, therefore, the construction is... Will replace As an optimization variable to eliminate this natural constraint, The gradient with respect to the optimization variable is as follows:
[0095]
[0096] 3) Continuous time constraints Formulas (u4) and (u5) impose constraints on the entire trajectory, resulting in an infinite number of inequality constraints. These inequalities cannot be solved through constraint optimization. Therefore, formulas (u4) and (u5) are transformed into a finite number of cost terms in the form of soft constraints. As The form of punishment is transformed as follows:
[0097]
[0098]
[0099] in This represents the cost of the trajectory at each stage. Let represent the cost of the j-th polynomial segment, and let κ be the resolution of the discrete cost of constructing each polynomial segment. The orthogonal coefficients following the trapezoidal rule, k = (1, 2, ..., κ), j = (1, 2, ..., M), then the cost of all continuous-time constraints in the trajectory at each stage. The gradient with respect to the optimization variable is as follows:
[0100]
[0101] Dynamic constraint cost term The goal is to prevent the drone's motion from exceeding dynamic constraints, and the following penalty form is constructed for this cost term. and cost function L μ :
[0102]
[0103]
[0104] The corresponding equation (E) is:
[0105]
[0106] Safety space constraint cost term The goal is to prevent drones from colliding with the ground. The following penalty formula is constructed for this cost term.
[0107]
[0108] in It is the lowest altitude that drones are allowed to reach. The gradient of the optimization variable is calculated in the same way as that of formula (H);
[0109] 4) Costs of the ball-striking rules Formula (u6) is constrained into a cost penalty form; a virtual roof H and a virtual net H are constructed, and the maximum height H of the bouncing ball during its flight is limited to H. max With H min This constraint has a positive impact on the drone's hitting posture, effectively preventing the optimization of unhealthy hitting postures. This cost term... The structure is as follows:
[0110]
[0111]
[0112] Where L μ Formula (G) is used to calculate the maximum height H of the bounce ball during its flight:
[0113]
[0114] As can be seen from formulas (L) and (i), the ball-hitting rule constraints indirectly limit the decoupled thrust of the UAV; The gradient with respect to the optimization variable is as follows:
[0115]
[0116] 5) Speed cost at the end of the stroke Formula (u7) is used to construct a cost penalty form; the velocity constraint at the ball's impact point directly limits the drone's speed to prevent excessive speed during impact, which could lead to an unhealthy hitting posture; let the drone's impact point velocity be... This cost item The structure is as follows:
[0117]
[0118] According to step S23, it can be known that... but The gradient with respect to the optimization variable is as follows:
[0119]
[0120] A drone-based ball-hitting device includes a propeller, a brushless motor, an electronic speed controller (ESC), a flight controller, an onboard computer, a racket, and a frame. The propeller is fixedly mounted on the rotor shaft of the brushless motor. The brushless motor is connected to the output terminals of the ESC via wires. The signal input lines of the ESC are connected to the flight controller. The flight controller is connected to the onboard computer via a serial port. The stator terminals of the brushless motor, the ESC, the flight controller, the onboard computer, and the racket are all fixedly mounted on the frame. The onboard computer deploys the aforementioned drone ball-hitting trajectory planning method.
[0121] The racket's circular frame is fitted onto a fixed bracket, which is then fixed to the frame. Once assembled, this structure does not interfere with the onboard computer host and flight controller.
[0122] The advantages and beneficial effects of this invention are as follows:
[0123] This invention discloses a drone-based ball-hitting device and trajectory planning method, capable of completing ball-hitting tasks at long distances and requiring extreme postures, and bouncing the ball back to the target point. It exhibits good robustness and aggressiveness, and is less prone to exceeding drone dynamic constraints. Since the drone's hitting position and posture are not fixed, an optimal hitting method is obtained through optimization, more closely resembling human ball-hitting techniques. Attached Figure Description
[0124] Figure 1 This is a flowchart of the drone ball-hitting trajectory planning method of the present invention.
[0125] Figure 2 This is a flowchart of the two-stage initial polynomial trajectory generation process in this invention.
[0126] Figure 3 This is a schematic diagram of cubic interpolation of the discrete position gradient mapping table in this invention.
[0127] Figure 4a This is a schematic diagram of the design strategy for the transition point position of the drone's ball-hitting mechanism in this invention.
[0128] Figure 4b This is a schematic diagram of the thrust design strategy for the transition point of the drone's ball-hitting process in this invention.
[0129] Figure 5 This is a schematic diagram of the trajectory optimization process based on polynomials in this invention.
[0130] Figure 6 This is a schematic diagram of the structure of the drone ball-hitting device of the present invention. Detailed Implementation
[0131] The specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.
[0132] like Figure 1 As shown, a method for planning the trajectory of a drone's ball-hitting action involves first launching the drone and hovering it in the air. Given the location information of the target point, a ball-launching machine located 3-5 meters from the drone launches balls around it. It is assumed that the predicted trajectory of the balls and the drone's location have been acquired and sent to the onboard computer; the predicted trajectory of the balls is assumed to be the ball's position and velocity discretely over a future time period with a time resolution of θ. The drone ball-hitting trajectory planning method comprises two main modules: a two-stage initial polynomial trajectory generation module for the drone, and a polynomial-based drone trajectory optimization module; the method specifically includes the following steps:
[0133] Step S1: Generation of the UAV's two-stage initial polynomial trajectory. The position and velocity information of the sphere at time T are obtained from the pre-obtained predicted trajectory of the flying sphere. In this embodiment, the predicted trajectory is assumed to be a discrete trajectory. A transitional state for the impact trajectory is designed, a collision model is established, and the UAV state at the time of collision is calculated as the trajectory's final state to generate the initial values of the polynomial trajectory. The entire UAV motion process is divided into a preparation phase and an impact phase. (The text continues with further details about the UAV's movement and impact phases.) Figure 2 As shown, the specific steps include the following:
[0134] Step S11: Construct the UAV dynamics model. The quadcopter UAV is modeled as a six-degree-of-freedom rigid body, where linear translation... And rotation R∈SE(3), translational motion depends on gravitational acceleration g and control thrust. Rotational motion with fuselage angular velocity This is the input. The model is as follows:
[0135]
[0136] Where τ represents the net thrust in global coordinates, e i It is the i-th column of I3. This represents the skew-symmetric matrix form of the cross product of vectors.
[0137] Step S12: Obtain the state of the flying sphere at time T. Interpolate the discrete state of the assumed predicted trajectory of the sphere at time T to obtain the sphere state at time T. The second-order continuous cubic interpolation function is constructed as follows:
[0138]
[0139] To provide gradients for trajectory optimization below, equation (b) is used to interpolate the discrete predicted trajectories, where the discrete intervals are uniform in the time domain and the time resolution is θ. An array is constructed to store the discrete positions or velocities of the sphere after prediction. Discretize in the uniform time domain and take four adjacent discrete positions. Interpolation is performed, and the position P is obtained by three interpolations at time T. c (T) is represented as:
[0140] P c (T)=P a ·W (c)
[0141] in:
[0142]
[0143]
[0144] The interpolation of the sphere's velocity is the same as described above, and the interpolation method is as follows: Figure 3 As shown.
[0145] Step S13: Construct a collision dynamics model. The racket is rigidly mounted on a quadcopter drone. The racket's center of mass can be represented as... Where z d (t) represents the change in the racket face normal direction over time, i.e., the change in the drone's attitude over time. Only the racket face normal direction z is considered in the interaction between the racket and the ball. d The instantaneous effect on the racket determines its coefficient of restitution. in and Let represent the velocities of the flying sphere before and after the collision, respectively. The instantaneous collision model is constructed as follows:
[0146]
[0147] By decoupling the calculation of the instantaneous attitude and velocity required by the UAV at the time of collision in Euclidean space, the expected hitting attitude z of the UAV at time T at the time of collision can be obtained from equation (f). d (T) and ball speed It can be calculated as:
[0148]
[0149]
[0150] Where V ⊥,des This indicates the racket's desired hitting posture z. d The desired velocity in the direction. After the UAV collides with the sphere, a model of the sphere's rebound trajectory needs to be constructed, which is also part of the collision dynamics model.
[0151] A simplified model of the sphere's trajectory after the collision and bounce is presented, considering only gravity g = [0 0 g]. T The influence, dynamic modeling is Target point s t The velocity of the sphere before the collision is given manually and used as one of the inputs to the entire system. If the unknown variables in the drone ball-hitting problem can be obtained through trajectory prediction, then the unknown variables include the flight time of the ball after it is hit. Initial velocity of the spheres after the collision The speed of the drone's shot and thrust τ h =(τ x , τ y , τ z The drone's striking position p h =(p x p y p zThe equation (g) can be analytically calculated based on the ball's flight time before the collision. In the decoupled motion process in Euclidean space, the following relationship can be calculated from equation (g):
[0152]
[0153] By decoupling the velocity and thrust of the ball, the relationships between the three-axis velocities and the three-axis thrusts after decoupling are obtained analytically using equations (h) and (i) as follows:
[0154]
[0155]
[0156] Equation (k) is simplified to τ y =τ y (τ x , τ z T h Equation (j) is abbreviated as The optimization variables for the terminal state of the drone's ball-hitting trajectory include: τ x , τ z T h ; where T h It is the total time of movement during the drone's ball-hitting phase.
[0157] Design the initial striking point state of the drone. Given the initial striking time, the initial striking point position p can be obtained from step S12. h The initial striking point state of the drone is determined by the drone's attitude when the angle between the rebounding ball's velocity and the horizontal plane is 60°, and an initial τ is set. z =1.1g, and the initial τ can be obtained through equation (g) and equation (k). x With τ y ; Let the initial The initial value can be obtained through equation (j). And set the initial
[0158] Step S14: Design the initial transition point state of the drone. As shown in formula (f), the state of the ball after the collision is directly related to the speed of the drone when hitting the ball. The motion process may lead to the following conflict: the drone maintains a high speed throughout the process in order to hit a ball at a greater distance, but the instantaneous speed at the moment of impact calculated by step S13 is relatively low. Therefore, a transition point is designed to provide smooth guidance for the trajectory, ensuring a reasonable drone hitting speed and attitude.
[0159] Initial transition point position p of the UAV t Design strategies such as Figure 4a As shown. The drone starts moving from the initial position p0, passing through the transition point p.t Reaching the hitting point p h And hit the ball to the designated target landing point s t The calculation steps for the transition point are as follows: s0 represents the intersection of the simulated trajectory of the flying sphere integrating backward and the ground. Find s0s t The midpoint s of the line segment mid , through s mid and p h Receive ray l r On line segment l h Take an offset relative to p0 point p α Then p α Projected onto l r Get point p ⊥ Finally, from p ⊥ Along line segment l t bias The transition point p is obtained. t .in
[0160] Initial transition point thrust τ of the UAV t Design strategies such as Figure 4b As shown. Transition point thrust τ t It can be obtained through its normalized direction vector e τ and To determine, where τ z The thrust component along the z-axis at the aforementioned striking point is given.
[0161] The initial transition point velocity of the drone is designed as follows: in The speed of the drone at the aforementioned striking point, It is a three-dimensional decoupling coefficient vector. And let the initial...
[0162] The state of the above transition point and the drone movement time T during the preparatory phase t The optimization variables are incorporated into subsequent optimization stages. When generating the initial polynomial trajectory, trajectories for two stages are generated separately: the preparation stage and the striking stage, with start and end points p0→p0. t →p h .
[0163] Step S15: Generation of two-stage UAV polynomial motion primitives. The polynomial motion primitives for each stage are generated by solving the two-point boundary value control optimality (OBVP) problem. The generation method for the motion primitives in both stages is the same in this step. For convenience, the start and end states of a single stage are represented as p. s →p g The optimal control form is as follows:
[0164]
[0165]
[0166] Where p (i) Let p be the i-th derivative. This represents the control input on a single axis. First, we introduce the costate λ = (λ1, λ2, λ3), and define the Hamiltonian equation as:
[0167] H(s,j,λ)=j 2 +λ T f(s,j)=j 2 +λ1v+λ2a+λ3j (n)
[0168] And based on the principle of minima, λ satisfies the following relationship:
[0169]
[0170] Where * denotes the optimal quantity. Introducing constant coefficients μ, σ, and γ, we obtain:
[0171]
[0172] The optimal control input is obtained by minimizing the Hamilton equation:
[0173]
[0174] Substituting equation (q) into equation (m) yields:
[0175]
[0176] Integrating equation (q) yields:
[0177]
[0178] Optimal trajectory p * If (t) satisfies the start and end point states, substituting the start and end point states into equation (s), we can obtain the constant coefficients as follows:
[0179]
[0180] Step S16: Sample the initial polynomial UAV state. Sample the two-stage polynomial trajectory at equal time intervals, segmenting the trajectory into M=4 segments for UAV trajectory optimization. Generate multiple polynomial segments in each stage, and denote the intermediate point as... Where j = (1, 2...M-1), i = (t, h). Combining the above steps, the total optimization variables in the two stages include...
[0181] Step S2: Polynomial-based UAV trajectory optimization; Based on the two-stage initial polynomial trajectory, 10 determined optimization variables are generated to construct an unconstrained optimization problem for the UAV's ball-hitting trajectory. The cost terms include control optimality, time optimality, dynamic constraint, ball-hitting rule, and terminal state constraint. Then, the L-BFGS algorithm is used to solve the optimization problem. Finally, the UAV controller executes the control quantities derived from the polynomial discretization. Figure 5 As shown, the specific steps include the following:
[0182] Step S21: Determine the optimization variables. The optimization variables are obtained from step 26 and include the intermediate state during the preparatory phase. Transition point state Midpoint state during the hitting phase Point of contact Preparatory phase exercise time T t The motion time T during the process phase h .
[0183] Step S22: Construct the optimization problem. The drone ball-hitting trajectory optimization problem is a nonlinear optimization problem, constructed as follows:
[0184]
[0185] stT i >0, (u2)
[0186]
[0187]
[0188]
[0189] H min <H<H max (u6)
[0190]
[0191] Where i = t, h represents the preparation phase and the striking phase, and T represents the total motion time of the UAV from the starting point to the striking point. Equation (u1) represents the control optimal term and the time optimal term; Equation (u2) represents the natural constraint term; Equation (u3) guarantees the third-order continuity of the two-stage trajectory at the transition point; Equation (u4) represents the dynamic constraint term, including the velocity of the trajectory. angular velocity ω of the machine body i (t) and thrust τ i(t); Equation (u5) is a safety constraint to prevent the drone from colliding with the ground; Equation (u6) is a hitting rule constraint to limit the height of the rebound ball, which has a positive impact on the drone's hitting posture; Equation (u7) is a hitting terminal speed constraint to limit the speed of the drone and prevent excessive speed during hitting, which could lead to an unhealthy hitting posture.
[0192] Step S23: Generation of multi-segment polynomial trajectory in a single stage. Minimum control theory (MINCO) is employed, with ξ... MINCO The polynomial trajectory class can be represented in the following form:
[0193]
[0194] Where c represents the coefficient vector of the polynomial segments, m = 3 represents the spatial dimension of the trajectory, the entire trajectory consists of M = 4 polynomial segments, each polynomial is set to order N = 2s⁻¹, where s = 4 is used to minimize the integral of the square of the jerk (snap). ξ MINCO All trajectories are constructed using only intermediate points q and time vectors T, with a polynomial c = U(q, T) in linear complexity. Furthermore, any cost function can be mapped: Therefore, it can be achieved within linear complexity. and To calculate and So for the optimization variables q and p t p h In other words, we can calculate first. This is then transmitted to as well as Then the problem can be solved effectively using relevant nonlinear optimizers.
[0195] Step S24: Construct the objective function. For all the requirements described by equation (u), we use ξ MINCO Trajectory classes, time constraint elimination, and constraint penalties transform the constrained trajectory generation problem into an unconstrained nonlinear optimization problem. The objective function is as follows:
[0196]
[0197] Where w is the weight vector. For optimal control cost, For the optimal cost of time, For the price of speed, For the sake of the body's angular velocity, For the cost of thrust, For the sake of safe space, For the sake of the rules of hitting the ball, The cost is the speed at the end of the stroke.
[0198] Step S25: Construct cost terms and cost functions. Construct the penalty form and cost function for each cost term.
[0199] 1) Controlling the optimal cost Its cost function is the same as the first term of equation (u1), and has the following form:
[0200]
[0201] The gradient of the optimization variable is calculated as follows:
[0202]
[0203]
[0204] 2) Optimal time cost Its cost function is the same as the second term of equation (u1), and has the following form:
[0205]
[0206] Since equation (u2) is a natural constraint, therefore, the construction is... Will replace As an optimization variable to eliminate this natural constraint, The gradient with respect to the optimization variable is as follows:
[0207]
[0208] 3) Continuous time constraints Equations (u4) and (u5) impose constraints on the entire trajectory, resulting in an infinite number of inequality constraints. These inequalities cannot be solved through constraint optimization. Therefore, equations (u4) and (u5) are transformed into a finite number of cost terms in the form of soft constraints. As The form of punishment is transformed as follows:
[0209]
[0210]
[0211] in This represents the cost of the trajectory at each stage. Let represent the cost of the j-th polynomial segment, and let κ be the resolution of the discrete cost of constructing each polynomial segment. The orthogonal coefficients follow the trapezoidal rule, k = (1, 2, ..., κ), j = (1, 2, ..., M). Then the cost of all continuous-time constraints in the trajectory at each stage is... The gradient with respect to the optimization variable is as follows:
[0212]
[0213] Dynamic constraint cost term The goal is to prevent the drone's motion from exceeding dynamic constraints, and the following penalty form is constructed for this cost term. and cost function L μ :
[0214]
[0215]
[0216] The corresponding equation (E) is:
[0217]
[0218] Safety space constraint cost term The goal is to prevent drones from colliding with the ground. The following penalty formula is constructed for this cost term.
[0219]
[0220] in It is the lowest altitude that drones are allowed to reach. The gradient of the optimization variable is calculated in the same way as that of equation (H).
[0221] 4) Costs of the ball-striking rules The constraint (u6) is constructed into a cost-penalty form. A virtual roof H and a virtual net H are constructed, limiting the maximum height H of the bouncing ball during its flight to H. max With H min This constraint has a positive impact on the drone's hitting posture, effectively preventing the optimization of unhealthy hitting postures. This cost term... The structure is as follows:
[0222]
[0223]
[0224] Where L μ For equation (G), the maximum height H of the bounce ball during its flight is calculated as follows:
[0225]
[0226] As can be seen from equation (L) and formula (i), the ball-hitting rule constraint indirectly limits the decoupled thrust of the drone. The gradient with respect to the optimization variable is as follows:
[0227]
[0228] 5) Speed cost at the end of the stroke The constraint (u7) is constructed into a cost-penalty form. The velocity constraint at the impact endpoint directly limits the drone's speed, preventing excessive speed during impact and thus avoiding unhealthy impact postures. Let the drone's impact endpoint velocity be... This cost item The structure is as follows:
[0229]
[0230] According to step S23, it can be known that... but The gradient with respect to the optimization variable is as follows:
[0231]
[0232] Step S26: Solving the optimization problem: The L-BFGS algorithm is used to solve the entire optimization problem from steps S24 to S25 to obtain the optimal variables. Then, according to step S23, a two-stage drone ball-hitting polynomial trajectory is generated.
[0233] Step S27: Execute the optimal control quantity. Discretize the polynomial trajectory from step S26 into state quantities at each time step, calculate the control quantity using the UAV dynamics model, and send the control quantity to the flight controller for calculation via serial communication. The flight controller executes the calculated control commands to achieve the UAV's ball-hitting task at a given target point.
[0234] like Figure 6 As shown, a drone-based ball-hitting device includes a propeller 8, a brushless motor 2, an electronic speed controller (ESC) 3, a flight controller 4, an onboard computer 5, a racket 6, and a frame 7. The propeller 8 is fixedly mounted on the rotor shaft of the brushless motor 2. The brushless motor 2 is connected to the output terminals of the ESC 3 via wires. The signal input line of the ESC 3 is connected to the flight controller 4. The flight controller 4 is connected to the onboard computer 5 via a serial port. The stator terminals of the brushless motor 2, the ESC 3, the flight controller 4, the onboard computer 5, and the racket 6 are all fixedly mounted on the frame 7. The drone-based ball-hitting trajectory planning method is deployed on the onboard computer 5.
[0235] The racket's circular frame is fitted onto a fixed bracket, which is then fixed to the frame 7. After assembly, this structure does not interfere with the onboard computer host 5 and the flight controller 4.
[0236] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for planning the trajectory of a ball shot by a drone, characterized in that... Includes the following steps: Step S1: Generate the initial polynomial trajectory of the UAV in two stages. Obtain the position and velocity information of the sphere at time T from the predicted trajectory of the flying sphere, design the transition state of the impact trajectory, establish a collision model, and calculate the UAV state at the time of collision as the trajectory terminal state to generate the initial value of the polynomial trajectory; specifically including the following steps: Step S11: Construct a dynamic model of the UAV, modeling the UAV as a rigid body with six degrees of freedom; Step S12: Obtain the state of the flying ball at time T; if the predicted trajectory is a continuous function, then substitute time T to directly obtain the state of the ball at that time; if the predicted trajectory is a discrete state, then interpolate the discrete state at time T to obtain the position and velocity information of the flying ball at that time as the state of the ball when it collides with the ball. Step S13: Construct a collision dynamics model; consider only the instantaneous interaction between the racket and the ball in the direction normal to the racket face; under the premise of setting the target landing point, analyze and solve the terminal state of the drone hitting the ball; Step S14: Design the initial transition point state of the UAV; Step S15: Generate two-stage UAV polynomial motion primitives; solve the optimal control problem at both ends for the UAV from the starting point to the transition point and from the transition point to the hitting point, and generate a two-stage polynomial trajectory. Step S16: Sample the initial polynomial UAV state; In the two-stage polynomial trajectory, sample at equal time intervals to segment the trajectory into M segments and M-1 intermediate points. The initial state, intermediate point state, and end state of each stage are used as the initial values of the trajectory. Together with the initial values of the UAV flight time set in the two stages, the subsequent UAV trajectory optimization based on polynomial is performed. Step S2: Based on polynomial-based UAV trajectory optimization, the terminal states, intermediate state, and flight time of the UAV in the two stages of the initial polynomial trajectory generation are used to generate multiple polynomial trajectories. An objective function and constraints are then constructed to optimize these multiple polynomial trajectories. Specifically, the steps are as follows: Step S21: Determine the optimization variables; the optimization variables include the drone's transition point state, the hitting point state, the intermediate point state during the process, and the two-stage drone flight time; Step S22: Construct the optimization problem; construct the optimal control cost term and constraints; Step S23: Multi-segment polynomial trajectory generation; Using minimum control theory, the initial values of the two-stage initial polynomial trajectory generation output are used to directly generate a two-stage multi-segment polynomial trajectory. Step S24: Construct the objective function; transform the constrained trajectory generation problem into an unconstrained nonlinear optimization problem by eliminating time constraints and imposing constraint penalties; Step S25: Construct cost terms and cost functions; construct the penalty form and cost function for each cost term, and obtain the gradient of each cost term with respect to each optimization variable; Step S26: Solve the optimization problem; use the L-BFGS algorithm to solve the entire optimization problem from step S24 to step S25, obtain the optimal variables, and construct the optimal polynomial trajectory; Step S27: Execute the optimal control quantity; Discretize the polynomial trajectory of step S26 into state quantities at each time step, calculate the control quantity through the UAV dynamics model, send the control quantity to the flight controller for calculation, and the flight controller executes the calculated control command to realize the UAV's ball-hitting task under the given target point.
2. The method for planning the trajectory of a drone ball-hitting event according to claim 1, characterized in that: The entire process from step S12 to step S27 involves planning the drone's ball-hitting trajectory and continuously replanning the drone's ball-hitting trajectory during the drone's movement.
3. The method for planning the trajectory of a drone ball-hitting event according to claim 1, characterized in that: In step S11, the UAV is modeled as a six-degree-of-freedom rigid body, wherein linear translation... And rotation R∈SE(3), translational motion depends on gravitational acceleration g and control thrust. Rotational motion at fuselage angular rate The input is as follows; the model is as follows: Where τ represents the net thrust in global coordinates, e i It is the i-th column of I3. Represents the skew-symmetric matrix form of the cross product of vectors; In step S12, the discrete state of the assumed sphere's predicted trajectory is interpolated at time T to obtain the sphere's state at time T; a second-order continuous cubic interpolation function is constructed as follows: To provide gradients for trajectory optimization, formula (b) is used to interpolate the discrete predicted trajectories. The discrete intervals are uniform in the time domain, with a time resolution of θ. An array is constructed to store the discrete positions or velocities of the sphere after prediction. Discretize in the uniform time domain and take four adjacent discrete positions. Interpolation is performed, and the position P is obtained by three interpolations at time T. c (T) is represented as: P c (T)=P a ·W (c) in: The interpolation of the sphere's velocity is performed using the same method as described above.
4. The method for planning the trajectory of a drone ball-hitting event according to claim 3, characterized in that: In step S13, the racket is rigidly mounted on the drone, and the center of mass of the racket is represented as... Where z d (t) represents the change in the racket face normal direction over time, i.e., the change in the drone's attitude over time; the relationship between the racket and the ball only considers the racket face normal direction z. d The instantaneous effect on the racket determines its coefficient of restitution. in and Let represent the velocities of the flying sphere before and after the collision, respectively; the instantaneous collision model is constructed as follows: By decoupling the calculation of the instantaneous attitude and velocity required by the UAV at the time of collision in Euclidean space, the expected hitting attitude z of the UAV at time T at the time of collision can be obtained from formula (f). d (T) and ball speed It can be calculated as: Where V ⊥,des This indicates the racket's desired hitting posture z. d The expected velocity in the direction, and the model of the trajectory of the sphere after the drone collides with the sphere, are also part of the collision dynamics model; A simplified model of the sphere's trajectory after the collision and bounce is presented, considering only gravity g = [0 0g]. T The influence, dynamic modeling is Target point s t The velocity of the sphere before the collision is given manually and used as one of the inputs to the entire system. The unknown variables in the drone ball-hitting problem, obtained through trajectory prediction, include the flight time of the ball after it is hit. Initial velocity of the spheres after the collision Based on the xyz three-axis, the ball striking speed on the drone and thrust τ h =(τ x ,τ y ,τ z The drone's striking position p h =(p x ,p y ,p z Based on the analytical calculation of the ball's flight time before the collision, the following relationship is calculated from equation (g) during the decoupled motion process in Euclidean space: By decoupling the velocity and thrust of the ball, the relationships between the three-axis velocities and the three-axis thrusts after decoupling are obtained analytically using equations (h) and (i) as follows: Formula (k) is abbreviated as τ y =τ y (τ x ,τ z ,T h Formula (j) is abbreviated as The optimization variables for the terminal state of the drone's ball-hitting trajectory include: τ x ,τ z ,T h ; where T h It is the total time of motion during the drone's ball-hitting phase; Design the initial hitting point state of the drone; given the initial hitting time, obtain the initial hitting point position p. h The initial striking point state of the drone is determined by the drone's attitude when the rebounding ball's velocity forms a certain angle with the horizontal plane, and an initial τ is set. z The initial τ can be obtained through equations (g) and (k). x With τ y ; Let the initial The initial value is obtained through equation (j). And set the initial 5. The method for planning the trajectory of a drone ball-hitting event according to claim 4, characterized in that: In step S14, the initial transition point position p of the UAV t The drone starts moving from its initial position p0 and passes through the transition point p. t Reaching the hitting point p h And hit the ball to the designated target landing point s t ; The calculation steps for the transition point are as follows: s0 represents the intersection of the simulated trajectory of the flying sphere integrating backward and the ground. Find s0s t The midpoint s of the line segment mid , through s mid and p h Received ray l r , at p0 and p h Line segment l h Take an offset relative to p0. point p α Then p α Projected onto l r Get point p ⊥ Finally, from p ⊥ Along p ⊥ to p α The line segment l of the perpendicular line t bias The transition point p is obtained. t ;in Initial transition point thrust τ of the UAV t Through its normalized direction vector e τ and To determine, where τ z The thrust component along the z-axis at the aforementioned point of impact; The initial transition point velocity of the drone is designed as follows: in The speed of the drone at the aforementioned striking point, It is a three-dimensional decoupling coefficient vector, and the initial... State of transition point and the drone movement time T during the preparatory phase t The optimization variables are incorporated into subsequent optimization stages; when generating the initial polynomial trajectory, trajectories for two stages are generated separately, namely the preparation stage and the striking stage, with the start and end points being p0→p. t →p h .
6. The method for planning the trajectory of a drone ball-hitting event according to claim 5, characterized in that: In step S15, the polynomial motion primitives for each stage are generated by solving the two-point boundary value control optimality problem; the two stages of motion primitives are generated in the same way, and the start and end states of a single stage are represented as p. s →P g ; The optimal control form is as follows: Where p (i) Let p be the i-th derivative. To represent the control input on a single axis, we first introduce the costate λ = (λ1, λ2, λ3), and define the Hamilton equation as follows: H(s,j,λ)=j 2 +λ T f(s,j)=j 2 +λ1v+λ2a+λ3j (n) And based on the principle of minima, λ satisfies the following relationship: Where * denotes the optimal quantity, and by introducing constant coefficients μ, σ, γ, we can obtain: The optimal control input is obtained by minimizing the Hamilton equation: Substituting equation (q) into equation (m) yields: Integrating equation (q) yields: Optimal trajectory p * If (t) satisfies the start and end point states, substituting the start and end point states into equation (s), we can obtain the constant coefficients as follows:
7. The method for planning the trajectory of a drone ball-hitting event according to claim 6, characterized in that: In step S16, the two-stage polynomial trajectory is sampled at equal time intervals to segment the trajectory into M segments for UAV trajectory optimization. Multiple polynomial segments are generated in each stage, and the intermediate point is denoted as... Where j = (1, 2…M-1) and i = (t, h), combining the above steps, the total optimization variables in the two stages include The optimization variables obtained in step S21 include the intermediate point states during the preparatory stage. Transition point state Midpoint state during the hitting phase Striking point status Preparatory phase exercise time T t The motion time T during the process phase h ; In step S22, the drone ball-hitting trajectory optimization problem is a nonlinear optimization problem, which is constructed as follows: s.t.T i >0,(u2) H min <H<H max , (u6) Where i = t, h represents the preparation phase and the striking phase, and T represents the total motion time of the UAV from the starting point to the striking point; formula (u1) is the control optimal term and the time optimal term; formula (u2) is the natural constraint term; formula (u3) ensures that the trajectory of the two phases is third-order continuous at the transition point; formula (u4) is the dynamic constraint term, including the velocity of the trajectory. angular velocity ω of the machine body i (t) and thrust τ i (t); Formula (u5) is a safety constraint to prevent the drone from colliding with the ground; Formula (u6) is a ball-hitting rule constraint; Formula (u7) is a ball-hitting terminal speed constraint.
8. The method for planning the trajectory of a drone ball-hitting event according to claim 7, characterized in that: In step S23, the Minimum Control Theory (MINCO) is used, with ξ MINCO The polynomial trajectory class can be represented in the following form: Where c represents the coefficient vector of the polynomial segment, m = 3 represents the spatial dimension of the trajectory, the entire trajectory consists of M = 4 polynomial segments, each polynomial is set to order N = 2s⁻¹, where s = 4 is used to minimize the integral of the square of the accelerometer; ξ MINCO All trajectories are constructed using only intermediate points q and time vectors T, with a polynomial c = U(q, T) in linear complexity. Furthermore, any cost function can be mapped: Therefore, it passes within linear complexity. and To calculate and For optimization variables q, p t ,p h In other words, calculate first This is then transmitted to as well as The problem is then solved effectively using a relevant nonlinear optimizer. In step S24, ξ is used MINCO Trajectory-based, time-constraint elimination, and constraint penalty methods transform the constrained trajectory generation problem into an unconstrained nonlinear optimization problem; The objective function is as follows: Where w is the weight vector. For optimal control cost, For the optimal cost of time, For the price of speed, For the sake of the body's angular velocity, For the cost of thrust, For the sake of safe space, For the sake of the rules of hitting the ball, The cost is the speed at the end of the stroke.
9. The method for planning the trajectory of a drone ball-hitting event according to claim 8, characterized in that: In step S25, the penalty form and cost function for each cost are constructed. 1) Controlling the optimal cost Its cost function is the same as the first term of formula (u1), and has the following form: The gradient of the optimization variable is calculated as follows: 2) Optimal time cost Its cost function is the same as the second term of formula (u1), and has the following form: Since formula (u2) is a natural constraint, therefore, the construction is... Will replace As an optimization variable to eliminate this natural constraint, The gradient with respect to the optimization variable is as follows: 3) Continuous time constraints Formulas (u4) and (u5) impose constraints on the entire trajectory, resulting in an infinite number of inequality constraints. These inequalities cannot be solved through constraint optimization. Therefore, formulas (u4) and (u5) are transformed into a finite number of cost terms in the form of soft constraints. As The form of punishment is transformed as follows: in This represents the cost of the trajectory at each stage. Let represent the cost of the j-th polynomial segment, and let κ be the resolution of the discrete cost of constructing each polynomial segment. Let the orthogonal coefficients follow the trapezoidal rule, k = (1,2,…,κ), j = (1,2,…,M), then the cost of all continuous-time constraints in the trajectory at each stage is... The gradient with respect to the optimization variable is as follows: Dynamic constraint cost term The goal is to prevent the drone's motion from exceeding dynamic constraints, and the following penalty form is constructed for this cost term. and cost function L μ : The corresponding equation (E) is: Safety space constraint cost term The goal is to prevent drones from colliding with the ground. The following penalty formula is constructed for this cost term. in This is the lowest altitude that drones are allowed to reach. The gradient of the optimization variable is calculated in the same way as that of formula (H); 4) Costs of the Shooting Rules Formula (u6) is constrained into a cost penalty form; a virtual roof H and a virtual net H are constructed, and the maximum height H of the bouncing ball during its flight is limited to H. max With H min Between these factors, this constraint has a positive impact on the drone's hitting posture, effectively preventing the optimization of unhealthy hitting postures. This cost term The structure is as follows: Where L μ Formula (G) is used to calculate the maximum height H of the bounce ball during its flight: As can be seen from formulas (L) and (i), the ball-hitting rule constraints indirectly limit the decoupled thrust of the drone; The gradient with respect to the optimization variable is as follows: 5) Speed cost at the end of the stroke Formula (u7) is used to construct a cost penalty form; the velocity constraint at the ball's impact point directly limits the drone's speed to prevent excessive speed during impact, which could lead to an unhealthy hitting posture; let the drone's impact point velocity be... This cost item The structure is as follows: According to step S23, it can be known that... but The gradient with respect to the optimization variable is as follows:
10. A drone-based ball-hitting device, comprising a propeller (1), a brushless motor (2), an electronic speed controller (3), a flight controller (4), an onboard computer host (5), a racket (6), and a frame (7), characterized in that: The propeller (8) is mounted on the rotor shaft of the brushless motor (2). The electronic speed controller (3) is connected to the brushless motor (2) and the flight controller (4). The flight controller (4) is connected to the onboard computer host (5). The stator end of the brushless motor (2), the electronic speed controller (3), the flight controller (4), the onboard computer host (5), and the racket (6) are all mounted on the frame (7). The onboard computer host (5) is equipped with a UAV ball-hitting trajectory planning method based on claim 1.