Drosophila larva tumbling motion modeling and optimizing method based on material point method
Through the neuromechanical model based on the matter point method and the improved MLP controller, combined with the optimization module of the gradient and TPE algorithm, the problem of rolling motion modeling and optimization of the fruit fly larvae is solved, and multi-mode rolling behavior simulation under limited computing resources is realized, which improves the efficiency of the software robot.
Patent Information
- Application Number
- CN202411798507.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-09
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-12-09
AI Technical Summary
The prior art is difficult to effectively model and optimize the rolling motion of fruit fly larvae, especially in complex environments, and traditional methods rely on manual measurement of data and long training.
A neuromechanical model based on the matter point method is adopted, combined with the improved multi-layer perceptron (MLP) as the controller of the model, and the model optimization module of the gradient and TPE algorithm are used to model and optimize the rolling motion of the fruit fly larvae.
Under limited computing resources, generalizable simulation modeling of the rolling motion of fruit fly larvae is realized, and behaviors containing multiple rolling modes are generated, which improves the task execution and environmental exploration efficiency of software robots.
Smart Images

Figure CN119647227A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of soft bionic robots, and in particular to a method for modeling and optimizing the tumbling motion of fruit fly larvae based on the Material Point Method (MPM). The present invention realizes the tumbling modeling and motion control of fruit fly larvae, and can simulate the tumbling motion behavior of fruit fly larvae in a complex environment and its interaction with the environment under limited computing resources, and perform corresponding optimization. This research provides an important reference for the design of soft bionic robots in reality, and improves the efficiency of task execution and environmental exploration of soft robots inspired by fruit fly larvae under limited computing resources. Background Art
[0002] Soft bionic robots are biologically inspired robots that imitate the structure, morphology and movement of organisms. They are usually made of flexible materials, have good softness and deformation ability, and can adapt to various operations and environments. Their design inspiration comes from organisms such as fruit fly larvae and sea cucumbers. Compared with traditional rigid robots, soft robots have higher flexibility and are suitable for complex tasks. They have a wide range of applications, including health care (such as endoscopic surgery and rehabilitation assistance), rescue and search and rescue (for searching and rescuing trapped people and detecting disaster sites) and marine exploration. In addition, soft bionic robots also have good interactivity and can work closely with humans or other robots to improve work efficiency. In recent years, the field of soft bionic robots has made significant research progress, but unique challenges have also emerged. The design of soft robots rarely targets the coordination of their behavior and morphology. Unlike pure manual control or physical design optimization, collaborative design algorithms need to simultaneously optimize the robot's brain and body to find more effective solutions.
[0003] The integration of neural circuits and body mechanics, called neuromechanics, is one of the basic methods to reveal the mechanism of motor control. Establishing a neuromechanical model can link neural mechanisms with motor behavior, simulate the interaction between organisms and the environment in complex environments, and provide a reference for the collaborative design of soft robots in reality. As a common model organism, Drosophila larvae have clear anatomical structures and rich neuro-muscle-behavior observation methods, making them ideal modeling objects. Their tumbling motion enables the larvae to quickly reposition themselves to avoid predators, which is of great research value.
[0004] Modeling the tumbling motion of Drosophila larvae involves many challenges, such as the high degrees of freedom of the soft body model, the significant deformation caused by the tumbling motion, and the interaction of multiple materials. These factors make the modeling and optimization process complicated. The material point method can accommodate large deformations, automatically handle self-collision and fracture, and can easily implement multi-material interactions, making it very suitable for modeling soft biological motion.
[0005] In recent years, researchers around the world have proposed a series of motion modeling methods for fruit fly larvae. Sun et al. designed the model based on a series of physical parameters of the larvae measured, and made new breakthroughs in the biological interpretability of the model. Shruti et al. introduced reinforcement learning (RL) into the model and further studied the connection between neural mechanisms and motor behavior. Although the above methods have initially achieved modeling of fruit fly larval motion, there are still shortcomings. Using physical measurement data to construct neuromechanical models usually relies on a set of complex parameters, which are time-consuming to obtain and not universal. Early reinforcement learning methods usually explored too large a space and could not achieve complex target motion. Later, some scholars proposed early termination strategies and adversarial reinforcement learning schemes based on this method, which enabled RL-based methods to achieve richer behaviors. However, it is still time-consuming to train a good reinforcement learning model in complex tasks such as soft robot control.
[0006] When building an effective neuromechanical model, the input of control signals is crucial. Traditional methods usually rely on expert knowledge and manually set a set of control signals. However, this method is often based on experience and lacks versatility and flexibility. To overcome this limitation, more and more studies have begun to use trained neural networks to generate control signals, thereby more accurately controlling the behavior of neuromechanical models. Summary of the invention
[0007] In view of the above-mentioned difficulties in modeling and optimizing the rolling motion of fruit fly larvae and the problems that the traditional method relies on manual measurement data and time-consuming training, the purpose of the present invention is to provide a method for modeling and optimizing the rolling motion of fruit fly larvae based on the material point method, which is a modeling and optimization method combining neuromechanics, motion control and deep learning. The method includes three modules, the first module is a fruit fly larvae neuromechanics model construction module based on the material point method, and the simulator is constructed with reference to the biological structure of the larvae; the second module is a model controller construction module based on an artificial neural network, using an improved multilayer perceptron (Multilayer Perceptron, referred to as MLP) as the controller of the model; the third module is a model optimization module based on the gradient and TPE algorithm, which effectively achieves the expected motion control effect by training the controller based on the gradient method in the framework of differentiable physics and optimizing the model hyperparameters by combining the optimization method of the TPE algorithm. Through the series connection of the three modules, the rolling behavior of fruit fly larvae can be generalized and simulated, and rolling behaviors including multiple rolling modes are generated.
[0008] The method of the present invention is achieved by the following steps: (S1) Drosophila larvae neuromechanical model construction module based on material point method: Based on the physical simulation mechanism of the material point method, the neuromechanical model is established with reference to the biological structure of the Drosophila larvae. The model can control the corresponding muscle contraction based on the current state and the received signal, and output the simulation result at the next moment; (S2) Model controller construction module based on artificial neural network: Based on the Drosophila larvae neuromechanical model established in module (S1), the improved MLP is used as the controller of the model to process the input sine wave signal and generate the driving signal of the model; (S3) Model optimization module based on gradient and TPE algorithm: Based on the neuromechanical model of fruit fly larvae and the artificial neural network controller, a customized loss function and Adam optimizer are used to train the model using gradient information. The trained model can simulate the tumbling motion of fruit fly larvae and store the position information at each moment during the simulation. After the simulation, the stored data is used for rendering to generate a visualization file. Based on the principle of Bayesian optimization, the hyperparameter optimization method of the fruit fly larvae tumbling motion model is designed in combination with the TPE algorithm to explore the optimal hyperparameters of the model.
[0009] Preferably, the specific contents of the Drosophila larvae neuromechanical model construction module based on the material point method constructed in (S1) are: (1-1) Based on the real biological structure of Drosophila larvae, a Drosophila larvae model was constructed. The Drosophila larvae were spatially divided into a series of small pieces of the same size. Each small piece was represented by a spherical particle, and the particles were deployed in a three-dimensional coordinate system. In the constructed Drosophila larvae model, the outer layer was composed of hyperelastic material, the lower layer was muscle tissue, and the innermost layer was fluid. By setting different Young's moduli (E), the outer layer was divided into nine regions, corresponding to the nine segments of the Drosophila larvae. A total of eight muscles were established in the model, and different serial numbers were set for muscles in different regions. These muscles can be represented by the following formula: Tri=[Tri1,Tri2,...,Tri8] When setting muscles, you need to set the particles around the muscle particles as muscle anchor points according to the direction of muscle contraction.
[0010] (1-2) Based on the material point method, a model update method is established. The material point method involves the transformation of the Eulerian perspective (grid method) and the Lagrangian perspective (particle method). Particles are used as the basic unit to construct the operation of the fruit fly larvae model, which corresponds to the Lagrangian perspective. The operation performed by MPM at each time step starts from the Lagrangian perspective and ends at the Lagrangian perspective. The whole process is divided into two parts: particle to grid (Particle to Grid, abbreviated as P2G) and grid to particle (Grid to Particle, abbreviated as G2P).
[0011] P2G, this step will interpolate the particle physical quantity to the grid and solve the momentum conservation formula to obtain the new momentum on the grid at the next moment; in this step, the model first receives the muscle activation signal from the controller to control the contraction of muscles with different numbers, and then handles the collision according to the boundary conditions; in specific implementation, the model will calculate the muscle contraction force in units of particles, and only particles set as muscles will perform this operation; the whole process is divided into calculating the magnitude and direction of the force. The formula for calculating the magnitude of muscle contraction force is as follows:
[0012] Act=Signal·Strength Among them, Signal is the control signal size corresponding to the muscle where the muscle particle is located, Strength is the parameter of the control force size, and Act is the muscle contraction force applied to the particle; the direction of the muscle force on the particle is determined by the relative position of the particle and the anchor particle. First, calculate the vector between the particle and the anchor particle:
[0013] vec A =xx anchor where x and x anchor are the position coordinates of the particle and the anchor particle respectively, vec A is a three-dimensional vector. Then convert the vector into a unit vector:
[0014]
[0015] Then the obtained unit vector norm A Through the outer product operation, a matrix is created, which represents the tensor representation of the muscle force direction: Where tmp is a 3×3 matrix, It is norm A The transpose of ; then multiply the matrix used to represent the muscle force direction tensor by the magnitude of the muscle force. To calculate the force A exerted by the muscle, the formula is as follows:
[0016] A=tmp·Act After obtaining the force A exerted by the muscle, it needs to be combined with the deformation gradient matrix to correctly transfer the muscle force to the current deformation state and accumulate it to the stress of the particle. The formula is as follows:
[0017] cauchy+=new_F·A·new_F T Where cauchy is the stress matrix of the particle, and new_F is the deformation gradient matrix of the particle obtained during the MPM calculation process.
[0018] G2P, this step will recalculate the physical quantities of each particle through interpolation based on the new physical quantities on the grid, and then update the state of the particle based on these new physical quantities.
[0019] By repeating the two steps of P2G and G2P, a simulator can be obtained that produces different effects according to the signal.
[0020] Preferably, the specific content of the model control right construction module based on artificial neural network constructed in (S2) is: (2-1) Set the input signal for the motion controller of the Drosophila larvae tumbling motion model. Use a set of sinusoidal functions with different frequencies, phases, and deviations at different time steps as controller inputs. The formula is as follows:
[0021] Where t is the number of simulation time steps, dt is the simulation time step, ω is the activation frequency, n sw is the total number of sine waves used for fitting, o is the offset value used to adjust the waveform at the beginning of the simulation, U is the signal generated for each time step as the input of the controller, U is a multidimensional vector, u j Represents the jth element in this vector.
[0022] (2-2) An artificial neural network controller for the tumbling motion model of fruit fly larvae is constructed, and the improved MLP is used as the controller of the model; compared with the general MLP, the present invention uses xavier to initialize the neural network weights, uses the sin function as the activation function, and additionally processes the output result with the ReLU function to limit the value range to [0,1]. The formula of the ReLU function is as follows:
[0023]
[0024] The controller can be expressed as follows: M = ReLU(MLP(U)) Where M = [m1,m2,...,m k ] represents the signal of control weight output, and k is the total number of muscles in the model.
[0025] Preferably, the specific content of the model optimization module based on the gradient and TPE algorithm constructed in (S3) is: (3-1) Based on the Drosophila larvae neuromechanical model (simulator) in module (S1) and the artificial neural network (controller) in module (S2), the movement of Drosophila larvae can be simulated; two different motion targets, linear rolling and offset rolling, are set in the simulation process, and customized loss functions are designed according to different evaluation indicators; the completion of the target is evaluated from three indicators: position, velocity and angular velocity, and only solid particles in the model are considered in the evaluation process; the position mean of the solid particles in the model is set to the center of mass c, which is a three-dimensional vector; evaluating the target from the position indicator requires uniform sampling of the positions at different time steps during the simulation process, specifically:
[0026] S(t)=c(t),t%p=0t∈[0,s max ] where s max represents the total number of simulation time steps, p represents the sampling time interval, and the result S is a three-dimensional vector. When evaluating the target from the speed index, it is necessary to calculate the average speed within the specified time step during the simulation process to obtain a three-dimensional vector V, which is:
[0027]
[0028] In order to evaluate the angular velocity index of the target, it is necessary to calculate the cumulative distance of each point in the model relative to the center of mass position within a certain time step during the simulation process. In this calculation process, the influence of global translation is eliminated by subtracting the center of mass position. Specifically:
[0029] Where L represents the set of solid particle positions in the model, l represents the position of a single particle, which is a three-dimensional vector, and the calculated result A is also a three-dimensional vector.
[0030] (3-2) For the linear rolling target, a customized loss function is defined based on the above evaluation indicators; the initial position of the model is set near the origin of the coordinate system, and the positive direction of the x-axis is set to the direction of the linear rolling target. The design of the subsequent loss function is based on this premise; the loss of executing the linear rolling target can be defined as: during the simulation process, the target completion status is cumulatively evaluated from three perspectives. The entire loss calculation process can be expressed by the following formula:
[0031] λs, λv, λa are the weights for calculating the target loss at different viewing angles. s1 represents the component of S in the x-axis direction, the subsequent subscript 1 represents the component of the corresponding vector in the x-axis direction, and the subscript 2 represents the component of the corresponding vector in the y-axis direction. The function of the L function is to calculate the square norm of the vector, specifically:
[0032] V=[v1,v2,···,v n ] f x The (t) function is used to correctly calculate the loss. If the model rolls in the opposite direction of the preset direction, the loss of the corresponding part should be set to a positive value. When calculating speed-related losses, the "sliding window" method is used to accumulate the contributions of all steps.
[0033] (3-3) For offset rolling targets, when defining a customized loss function, the offset in the y-axis direction must be considered. For the convenience of calculation, the positive direction of the y-axis is also set to the rolling offset direction. The loss calculation process is expressed by the following formula:
[0034] Function f y (t) and f x (t) is similar, the goal is to make the model shift to the preset direction during the rolling process; this method combines the differentiable programming framework in the design process and supports the function of automatic differentiation. The present invention uses the gradient information obtained by reverse automatic differentiation to train the artificial neural network. During the training process, a simulation is run once for each iteration; in each time step of the simulation, the artificial neural network generates a muscle drive signal, which is input into the neuromechanical model together with the current model state to generate the state of the next time step. After thousands of time steps, the loss is calculated by a customized loss function, and then the Adam optimizer uses the gradient calculated by the automatic differentiation system to update the weights of the neural network. After multiple iterations, the model can learn how to perform rolling motion; the model obtained after training is used to simulate the rolling motion of fruit fly larvae, and the position information at each moment in the process is stored, and finally the obtained data is used to render the simulation process to generate a visualization file.
[0035] (3-4) The learning rate of training, Young’s modulus of the elastic material on the surface of fruit fly larvae, and the number of sine waves are selected as the optimization objects. The upper and lower bounds of the value range of these hyperparameters are set through expert knowledge, and this range is used as the parameter space.
[0036] (3-5) In each trial, for each hyperparameter, a Gaussian mixture model b(x) is maintained for the hyperparameter that is related to the optimal target value (in this method, it means that the model tumbling motion has a higher degree of completion, that is, the Loss takes a smaller value), and another Gaussian mixture model o(x) is maintained for the remaining hyperparameters; in the set parameter space, the hyperparameters corresponding to the maximum value of b(x) / o(x) are selected as the next set of search values; in this way, this method can adaptively adjust the size of the parameter search space and find the global optimal solution in the fewest possible iterations.
[0037] At this point, the modeling and optimization method of Drosophila larvae tumbling motion based on the material point method has been completed.
[0038] The beneficial effects of the present invention are: (1) Inspired by the biological structure of fruit fly larvae, the present invention proposes a fruit fly larvae neuromechanical model construction module based on the material point method, models the rolling motion behavior of fruit fly larvae, and can well simulate the real biological structure of fruit fly larvae and the characteristics of the real escape behavior of larvae; (2) According to the neural signal characteristics of the rolling behavior of fruit fly larvae, the present invention proposes a fruit fly larvae rolling motion control module based on artificial neural network. Different loss functions are formulated according to the rolling characteristics of fruit fly larvae, so that fruit flies can complete different motion tasks in a three-dimensional environment space. At the same time, xavier is used to initialize the weights of the neural network, the sin function is used as the activation function of the neural network, and the ReLU function is introduced to limit the output, so as to achieve fast and stable convergence of the network training process; (3) The present invention avoids the time-consuming data acquisition and training of traditional simulation modeling methods for fruit fly larvae, which rely on manually designed features and rules and have poor generalization ability. By introducing the material point method, the problem of the easy breakage of the soft model when it is greatly deformed is solved, and the interaction of multiple materials can be easily realized. Under limited computing resources, the rolling behavior of fruit fly larvae containing multiple modes can be generated according to the configuration; (4) The present invention can assist in experimental research on biobehavior and provide an effective simulation experimental environment for the perception, decision-making and movement of soft organisms. It can also be applied to the design and research of bionic robots to improve the efficiency of task execution and environmental exploration of soft robots inspired by fruit fly larvae under limited computing resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 It is a schematic diagram of the body structure of the fruit fly larvae in the present invention.
[0040] Figure 2 It is a schematic diagram of the cross-sectional structure of the fruit fly larvae body in the present invention.
[0041] Figure 3 This is a schematic diagram of the muscle distribution direction of the Drosophila larvae model of the present invention.
[0042] Figure 4 Schematic diagram of the Drosophila neuromechanical model in the present invention.
[0043] Figure 5 It is the overall framework flow chart of the present invention.
[0044] Figure 6 This is the linear rolling simulation posture and data statistics of the model in the present invention.
[0045] Figure 7 This is the model offset roll simulation posture and data statistics diagram in the present invention. DETAILED DESCRIPTION
[0046] In order to better understand the technical solution of the present invention, the following further introduces the implementation of the present invention in combination with the drawings and specific examples. Note that the aspects described below in combination with the drawings and specific examples are only exemplary and should not be understood as limiting the scope of protection of the present invention.
[0047] Example 1 This example is performed on a computer equipped with an Intel 13th Gen Intel(R) Core(TM) i5-13600K CPU and an NVIDIA GeForce RTX 3080 GPU. The operating system version is Windows 11 Professional Edition 23H2, the Python version is 3.10.11, and the Taichi version is 1.7.0.
[0048] The present invention provides a method for modeling and optimizing the tumbling motion of fruit fly larvae based on a material point method, comprising the following steps: Step 1: Establish a fruit fly larva model with particles as the basic unit. In a three-dimensional coordinate system, take a cube with a side length of 1 from the origin to the positive direction of the x, y, and z axes, and divide it into units of 1 / 64 within the range to obtain a set of coordinates. Each coordinate can represent a particle with the coordinate as the center. The coordinate Pos can be expressed by the following formula:
[0049]
[0050] The body of a fruit fly larva can be seen as a cylinder and two hemispheres spliced together, such as Figure 1 The body of a fruit fly larva consists of an outer layer of superelastic material, a middle layer of muscle, and an inner layer of fluid, such as Figure 2 As shown. The body length of the fruit fly larva model is set to 0.5, the outer diameter of the body is set to 0.1, the inner diameter is set to 0.08, and the muscle thickness is set to 0.03. When building the body, we must first determine the center of the cylinder and the two spheres, and then use the Euclidean distance to calculate whether the particle belongs to the body of the fruit fly larva and which part it belongs to, and record the results corresponding to each particle. There are eight muscles in the fruit fly larva model, and these eight muscles are evenly distributed in 8 directions, such as Figure 3 These 8 directions can be expressed as:
[0051]
[0052] When setting the muscle, calculate the vector perpendicular to the midline formed by the particles in the area that can be set as the muscle and the points on the midline of the cylinder that serves as the larval body, and then find the angles between the vector and the eight direction vectors. If the angle is less than the set value, set the particle as the muscle, and set different numbers for the muscle particles in different positions. When setting the muscle, it is necessary to set the surrounding particles as muscle anchor points according to the direction of muscle contraction. By setting different Young's moduli (E), the outer layer of the fruit fly larvae model is divided into nine areas corresponding to the nine segments of the fruit fly larvae. After completing this step, you can get the initial fruit fly larval body model, as shown below. Figure 1 shown.
[0053] Step 2: Establish a model update method based on the material point method. Interpolate the particle physical quantities onto the grid (P2G), calculate the deformation gradient of each particle, constrain the deformation gradient according to the material properties, and limit its deformation gradient to a certain range. Control the muscle force according to the signal generated by the controller, and add a prestress to the internal liquid before rolling begins with reference to the actual structure of the fruit fly larvae. Based on the deformation gradient and the obtained muscle force, prestress of the internal liquid and other forces, calculate the Cauchy stress stress (stress multiplied by the direction can calculate the force on each grid point). Based on the particle's mass, velocity, stress and other physical quantities, interpolate the mass, momentum and force on the grid.
[0054] Step 3: Calculate the change in momentum on the grid based on the explicit integration of force over time, complete the calculation of the momentum conservation formula, calculate the new momentum on the grid at the next moment, and handle the collision based on the boundary conditions.
[0055] Step 4: Based on the grid velocity and displacement obtained in step 3, recalculate the velocity and displacement of each particle (G2P) through interpolation and other methods. Control each particle to move according to its velocity and displacement, and update the particle's position and posture information. Repeating the two steps of P2G and G2P can obtain a simulator that produces different effects according to the signal, such as Figure 4 shown.
[0056] Step 5: Construct the improved MLP as the artificial neural network controller of the fruit fly larvae rolling motion model, and use the xavier initialization method to initialize the weights of the neural network. The above system frameworks are combined with differentiable programming and support automatic differentiation functions.
[0057] Step 6: Based on the fruit fly larvae neuromechanical model and artificial neural network controller, use a customized loss function and Adam optimizer for training. The number of training iterations is set to 500, and each training includes a simulation of 2000 time steps and a neural network weight update. After the training is completed, the obtained model is used to simulate the rolling motion of the fruit fly larvae, and the position information of the model at each moment in the simulation process is stored. After the simulation is completed, the stored data is used for rendering to generate a visualization file. At this point, the design of the entire fruit fly larvae rolling motion model is completed, and the entire system framework is as follows. Figure 5 shown.
[0058] Step 7: Based on the principle of Bayesian optimization, use the TPE algorithm to optimize the Drosophila larvae tumbling motion model and explore the optimal hyperparameters of the model.
[0059] Step 8: Simulate and verify the effectiveness of the designed model and control method: Based on the invented modeling and optimization framework, use the controller to process the sinusoidal wave function to generate muscle drive signals, and then pass these signals to the trained and optimized tumbling motion model of the fruit fly larvae to generate the corresponding motion state. Figure 6 and Figure 7 Sub-figures A and B in the figure show the changes in the movement trends of the model in the x-axis and y-axis directions during the movement of the model. It can be seen from the figure that when the model performs the two tasks of linear rolling and offset rolling, in the x-axis direction, it rolls at a lower speed at the beginning, and maintains a higher speed after acceleration until the end of the simulation. The entire displacement curve is very smooth; in the y-axis direction, the offset rolling has an obvious offset trend relative to the linear rolling. Figure 6 and Figure 7 Sub-figure C in the figure shows the posture changes of the model when performing the two tasks of straight rolling and offset rolling. It can be seen from the figure that the model does not break or collapse during the rolling process, and can handle the collision with the ground normally.
[0060] From the above simulation results, it can be seen that the fruit fly larvae soft robot can quickly and stably perform multi-mode tumbling motions in a virtual environment, handle boundary conditions, and maintain body stability. This method solves the problems of time-consuming data acquisition and training, reliance on manually designed features and rules, and poor generalization ability in traditional simulation modeling methods for fruit fly larvae. By introducing the material point method, the problem of fracture during large deformation of the soft model is avoided, and multi-material interaction can be easily realized. This method can generate multi-mode tumbling behaviors of fruit fly larvae with limited computing resources, which is not only helpful for biobehavioral research, but also can serve as a reference for the collaborative design of soft bionic robots.
Claims
1. A method for modeling and optimizing the tumbling motion of fruit fly larvae based on the material point method, characterized in that: This method consists of three modules: (S1) A Drosophila larvae neuromechanical model construction module based on a material point method, which establishes a neuromechanical model based on the physical simulation mechanism of the material point method and the biological structure of the Drosophila larvae. The model can control the contraction of the corresponding muscle based on the current state and the received signal, and output the simulation result at the next moment; (S2) a model controller construction module based on artificial neural network, based on the Drosophila larvae neuromechanical model established in module (S1), using an improved multilayer perceptron as the controller of the model, processing the input sine wave signal, and generating a driving signal for the model; (S3) A model optimization module based on gradient and TPE algorithm, based on the fruit fly larvae neuromechanical model and artificial neural network controller, uses a customized loss function and Adam optimizer to use gradient information to train the model. The trained model can simulate the rolling motion of the fruit fly larvae and store the position information at each moment during the simulation process. After the simulation is completed, the stored data is used for rendering to generate a visualization file; Based on the principle of Bayesian optimization and combined with the TPE algorithm, a hyperparameter optimization method for the Drosophila larvae tumbling motion model was designed to explore the optimal hyperparameters of the model.
2. The method according to claim 1, characterized in that In module (S1), a fruit fly larvae model is constructed based on the real biological structure of fruit fly larvae; the fruit fly larvae are spatially divided into a series of small pieces of the same size, each of which is represented by a spherical particle, and the particles here are deployed in a three-dimensional coordinate system; in the constructed fruit fly larvae model, the outer layer is composed of hyperelastic material, the middle is muscle tissue, and the innermost layer is a hydrostatic skeleton; when setting muscles, muscles in different areas are represented by different numbers, and the particles around the muscle particles are set as muscle anchor points according to the direction of muscle contraction.
3. The method according to claim 2, characterized in that In module (S1), based on the constructed model, a model update method is established based on the material point method; the material point method involves the transformation between the Euler perspective and the Lagrangian perspective; Using particles as basic units, the operations of constructing the Drosophila larvae model correspond to the Lagrangian perspective; The operations performed by the material point method at each time step start from the Lagrangian perspective and end at the Lagrangian perspective. The whole process is divided into two parts: particle to grid and grid to particle; Particle to grid, this step will interpolate the particle physical quantity to the grid and solve the momentum conservation formula to obtain the new momentum on the grid at the next moment; in this step, the model first receives the muscle activation signal from the controller to control the contraction of muscles with different numbers, and then handles the collision according to the boundary conditions; in specific implementation, the model will calculate the muscle contraction force on a particle basis, and only particles set as muscles will perform this operation; the whole process is divided into calculating the magnitude and direction of the force, and the formula for calculating the magnitude of the muscle contraction force is as follows: Act=Signal·Strength Among them, Signal is the control signal size corresponding to the muscle where the muscle particle is located, Strength is the parameter of the control force size, and Act is the muscle contraction force applied to the particle; the direction of the muscle force on the particle is determined by the relative position of the particle and the anchor particle. First, the vector between the particle and the anchor particle is calculated: thing A =xx anchor where x and x anchor are the position coordinates of the particle and the anchor particle respectively, vec A is a three-dimensional vector; then convert the vector to a unit vector: Then the obtained unit vector norm A Through the outer product operation, a matrix is created, which represents the tensor representation of the muscle force direction: Where tmp is a 3×3 matrix, It is norm A The transpose of ; then multiply the matrix used to represent the muscle force direction tensor by the magnitude of the muscle force to calculate the force A exerted by the muscle, as shown below: A=tmp·Act After obtaining the force A exerted by the muscle, it needs to be combined with the deformation gradient matrix to correctly transfer the muscle force to the current deformation state and accumulate it to the stress of the particle. The formula is as follows: cauchy+=new_F·A·new_F T Where cauchy is the stress matrix of the particle, and new_F is the deformation gradient matrix of the particle obtained during the MPM calculation process; from grid to particle, this step will recalculate the physical quantities of each particle by interpolation based on the new physical quantities on the grid, and then update the state of the particle based on these new physical quantities.
4. The method according to claim 1, characterized in that: In module (S2), the controller of the fruit fly larvae tumbling motion model consists of an artificial neural network and an input signal, where the input signal is a set of values of a sine function with different frequencies, phases and deviations at different time steps, and the formula is as follows: Among them, t is the number of simulation time steps, dt is the simulation time step, ω is the activation frequency, n sw is the total number of sine waves used for fitting, o is the offset value used to adjust the waveform at the beginning of the simulation, U is the signal generated for each time step as the input of the controller, U is a multidimensional vector, u j Represents the jth element in this vector.
5. The method according to claim 1, characterized in that In module (S2), the controller of the fruit fly larvae tumbling motion model is composed of an artificial neural network and an input signal, wherein the artificial neural network is an improved multilayer perceptron. Compared with the general multilayer perceptron, this method uses xavier to initialize the neural network weights, uses the sin function as the activation function, and additionally processes the output result with the ReLU function to limit the value range to [0,1]. The formula of the ReLU function is as follows: The controller can be expressed as follows: M = ReLU(MLP(U)) Where M = [m1,m2,...,m k ] represents the signal of control weight output, and k is the total number of muscles in the model.
6. The method according to claim 1, characterized in that In module (S3), the movement of fruit fly larvae is simulated based on the fruit fly larvae neuromechanical model in module (S1) and the artificial neural network in module (S2); two different motion targets, linear rolling and offset rolling, are set in the simulation process, and customized loss functions are designed according to different evaluation indicators; the target completion is evaluated from three indicators: position, velocity and angular velocity, and only solid particles in the model are considered in the evaluation process; the position mean of the solid particles in the model is set to the center of mass c, which is a three-dimensional vector; evaluating the target from the position indicator requires uniform sampling of the positions of different time steps during the simulation process, specifically: S(t)=c(t),t%p=0t∈[0,s max ] where s max represents the total number of simulation time steps, p represents the sampling time interval, and the result S is a three-dimensional vector. When evaluating the target from the speed index, it is necessary to calculate the average speed within the specified time step during the simulation process to obtain a three-dimensional vector V, which is: In order to evaluate the angular velocity index of the target, it is necessary to calculate the cumulative distance of each point in the model relative to the center of mass position within a certain time step during the simulation process. In this calculation process, the influence of global translation is eliminated by subtracting the center of mass position. Specifically: Where L represents the set of solid particle positions in the model, l represents the position of a single particle, which is a three-dimensional vector, and the calculated result A is also a three-dimensional vector.
7. The method according to claim 6, characterized in that In module (S3), for the linear rolling target, a customized loss function is defined based on the above evaluation indicators; the initial position of the model is set near the origin of the coordinate system, and the positive direction of the x-axis is set to the direction of the linear rolling target. The design of subsequent loss functions is based on this premise; the loss of executing the linear rolling target can be defined as: during the simulation process, the target completion status is cumulatively evaluated from three perspectives. The entire loss calculation process can be expressed by the following formula: λs, λv, and λa are the weights for calculating the target loss under different indicators. s1 represents the component of S in the x-axis direction. The subsequent subscript 1 represents the component of the corresponding vector in the x-axis direction, and the subscript 2 represents the component of the corresponding vector in the y-axis direction. The function of the L function is to calculate the square norm of the vector, which is: f x The (t) function is used to correctly calculate the loss. If the model rolls in the opposite direction of the preset direction, the loss of the corresponding part should be set to a positive value. When calculating speed-related losses, the "sliding window" method is used to accumulate the contributions of all steps.
8. The method according to claim 6, characterized in that In module (S3), for the offset rolling target, when defining the customized loss function, the offset in the y-axis direction must be considered. For the convenience of calculation, the positive direction of the y-axis is also set to the rolling offset direction. The loss calculation process is expressed by the following formula: Function f y (t) and f x (t) is similar, and the goal is to make the model deviate to a preset direction during the rolling process; this method combines a differentiable programming framework in the design process and supports the function of automatic differentiation. The present invention uses the gradient information obtained by reverse automatic differentiation to train the artificial neural network. During the training process, a simulation is run once for each iteration; in each time step of the simulation, the artificial neural network generates a muscle drive signal, which is input into the neuromechanical model together with the current model state to generate the state of the next time step. After thousands of time steps, the loss is calculated by a customized loss function, and the weights of the neural network are updated by the Adam optimizer based on the gradient calculated by the automatic differentiation system. After multiple iterations, the model can learn how to perform rolling movements; The model obtained after training is used to simulate the tumbling motion of fruit fly larvae, and the position information at each moment in the process is stored. Finally, the obtained data is used to render the simulation process and generate a visualization file.
9. The method according to claim 1, characterized in that: In module (S3), the parameter space is set for the hyperparameters based on the experimental data of the model establishment and training process; the hyperparameters such as the training learning rate, the Young's modulus of the elastic material on the surface of the fruit fly larvae, and the number of sine waves are selected as optimization objects, and the upper and lower bounds of the value range of these hyperparameters are set through expert knowledge.
10. The method according to claim 1, characterized in that In module (S3), based on the principle of Bayesian optimization and combined with the TPE algorithm, a hyperparameter optimization method for the fruit fly larvae tumbling motion model is designed. In each experiment, for each hyperparameter, a Gaussian mixture model b(x) is maintained for the hyperparameter related to the optimal target value, and another Gaussian mixture model o(x) is maintained for the remaining hyperparameters; in the set parameter space, the hyperparameters corresponding to the maximum b(x) / o(x) are selected as the next set of search values; in this way, the method can adaptively adjust the size of the parameter search space and find the global optimal solution in the fewest possible iterations.
Citation Information
Patent Citations
Bee poiser-based bionic three-dimensional angular velocity sensor
CN102539815A
Bionic motion control method based on caenorhabditis elegans neural network
CN114897125A
Robot inverse kinematics solving method of neural network algorithm based on fruit fly optimization
CN114925799A
Flight behavior generation model inspired by drosophila trajectory distribution and interaction mode
CN118133511A
Biomemetic systems
WO2017011756A1