Unmanned aerial vehicle simulation test method and system based on ROS and Gazebo
Through the drone simulation testing method based on ROS and Gazebo, the scene environment model and functional system are built, and the problems of low efficiency and poor effectiveness of simulation testing in the existing technology are solved, and the reliability of simulation conclusions and the portability of algorithms are improved. , achieving more efficient drone simulation testing.
Patent Information
- Application Number
- CN202410968169.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-18
- Publication Date
- 2024-11-08
AI Technical Summary
The existing drone simulation testing methods have problems such as high trial and error cost, low efficiency, difficulty in troubleshooting, and the simulation conclusions cannot be directly applied to actual scenarios. The simulation effect is poor and cannot truly reflect the performance of the algorithm in the real physical environment.
Using the drone simulation test method based on ROS and Gazebo, the scene environment model and drone model are built through Gazebo, the drone function system is built based on ROS, the simulation test boot file is established, the drone simulation test is completed, and the drone simulation test is used to utilize perception. Modules, positioning and mapping modules, path planning modules and control modules perform data transmission and drone control.
Improve the reliability of the drone simulation conclusions, reduce development difficulty, improve simulation testing efficiency, ensure the effectiveness of simulation testing, enhance the portability of the algorithm, can effectively simulate scenes in the physical environment, and improve the non-existence Safety of human-machine flight.
Smart Images

Figure CN118916988A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of unmanned aerial vehicles, and in particular to a simulation test method and system for unmanned aerial vehicles based on ROS and Gazebo. Background Art
[0002] With the continuous innovation and development of drone technology, drones have begun to show a practical trend and have shown great application prospects in civil and military fields, such as irrigation drones, fire rescue drones, etc. Drones are mainly composed of flight control systems, central computing units, a series of motors and sensors, etc. In actual development, the conventional debugging method is to first build the physical structure of the drone, and then complete algorithm testing and function debugging on the actual machine. Although this debugging method can more realistically detect algorithm functions and test robustness, this method has the disadvantages of high trial and error costs, low efficiency, and difficult troubleshooting.
[0003] In response to the above problems, many current UAV development solutions are to complete the simulation test of the algorithm to be tested through computer software, and further deploy it to the real machine, such as completing the simulation based on Matlab software. However, such simulation solutions have problems such as poor effect and difficulty in overall functional testing. They cannot truly reflect the performance of the algorithm in the real physical environment, resulting in a series of problems such as the simulation conclusions cannot be directly applied to actual scenarios. Therefore, there is an urgent need to provide an effective UAV simulation method to improve the reliability of the simulation conclusions. Summary of the invention
[0004] The purpose of the present invention is to provide a UAV simulation test method and system based on ROS and Gazebo, aiming to solve the above-mentioned problems in the prior art and to improve the reliability of UAV simulation conclusions.
[0005] The embodiment of the present invention provides a UAV simulation test method based on ROS and Gazebo, comprising:
[0006] Build scene environment model and drone model through Gazebo;
[0007] Build drone functional system based on ROS;
[0008] A startup file for the simulation test is established according to the scene environment model and the drone model, and the drone simulation test is completed through the drone functional system based on the startup file.
[0009] The embodiment of the present invention provides a UAV simulation test system based on ROS and Gazebo, including:
[0010] The first building module is used to build the scene environment model and drone model through Gazebo;
[0011] The second building module is used to build a drone functional system based on ROS;
[0012] The simulation test module is used to establish a startup file for the simulation test according to the scene environment model and the drone model, and complete the drone simulation test through the drone function system based on the startup file.
[0013] An embodiment of the present invention also provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the steps of the above-mentioned drone simulation test method based on ROS and Gazebo are implemented.
[0014] An embodiment of the present invention further provides a computer-readable storage medium, on which a program for implementing information transmission is stored. When the program is executed by a processor, the steps of the above-mentioned drone simulation test method based on ROS and Gazebo are implemented.
[0015] The use of the embodiments of the present invention can include the following beneficial effects: the UAV simulation test method based on ROS and Gazebo provided by the embodiments of the present invention constructs a scene environment model in Gazebo, improves the authenticity of the constructed scene environment model, solves the technical problem that the simulation effect is quite different from the actual effect, improves the reliability of the UAV simulation conclusion, and builds a UAV functional system based on ROS, improves the portability of the algorithm, greatly reduces the development difficulty, and improves the simulation test efficiency of the UAV. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate one or more embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0017] Figure 1 is a flow chart of a UAV simulation test method based on ROS and Gazebo according to an embodiment of the present invention;
[0018] Figure 2 1 is a flow chart of an embodiment of a UAV simulation test method based on ROS and Gazebo according to an embodiment of the present invention;
[0019] Figure 3 is a schematic diagram of the structure of the drone functional system according to an embodiment of the present invention;
[0020] Figure 4Schematic diagram of a UAV simulation test system based on ROS and Gazebo according to an embodiment of the present invention. DETAILED DESCRIPTION
[0021] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of this specification, the following will be combined with the drawings in one or more embodiments of this specification to clearly and completely describe the technical solutions in one or more embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on one or more embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this document.
[0022] Method Embodiment
[0023] According to an embodiment of the present invention, a UAV simulation test method based on ROS and Gazebo is provided. Figure 1 FIG. 1 is a flow chart of a UAV simulation test method based on ROS and Gazebo according to an embodiment of the present invention. Figure 1 As shown, the UAV simulation test method based on ROS and Gazebo according to an embodiment of the present invention specifically includes:
[0024] Step S101, constructing a scene environment model and a drone model through Gazebo;
[0025] Step S102, constructing a drone functional system based on ROS;
[0026] Step S103, establishing a startup file for the simulation test according to the scene environment model and the drone model, and completing the drone simulation test through the drone function system based on the startup file, specifically includes:
[0027] The visual unit of the perception module in the drone functional system uses an RGBD depth camera to obtain depth image information, the drone status information is obtained through an inertial measurement unit, and the depth image information and the status information are transmitted to a positioning and mapping module;
[0028] The depth image information and the state information are obtained through the positioning and mapping module, the Google Cartographer algorithm is used to estimate the drone pose and construct a two-dimensional grid map for the depth image information and the state information, the current state information and the navigation map information of the drone are obtained, and the current state information and the navigation map information are transmitted to the path planning module;
[0029] Acquire the current state information and the navigation map information through a path planning module, perform autonomous path planning for the UAV according to the current state information, the navigation map information and the sliding sub-map information, and transmit the obtained path planning result to the control module;
[0030] The decision unit of the control module selects the corresponding path planning result and determines the flight parameters of the UAV according to the current environmental information of the UAV, and the control subunit controls the position and attitude of the UAV according to the flight parameters;
[0031] Establish ROS nodes for the perception module, positioning and mapping module, path planning module and control module through the interactive module in the drone functional system, and use the ROS nodes to realize data transmission between modules and communication between the drone and the ground station;
[0032] Wherein, the depth image information includes obstacle information and wall information;
[0033] The state information includes three-axis acceleration and linear acceleration;
[0034] The current state information includes the position, speed and attitude information of the UAV;
[0035] The sliding sub-map information is a two-dimensional grid sub-map within a given range of the UAV.
[0036] The above technical solution of the embodiment of the present invention is described in detail below in combination with the specific situation of a drone simulation test method based on ROS and Gazebo in an embodiment of the present invention.
[0037] The embodiment of the present invention proposes a UAV simulation test method based on ROS and Gazebo, such as Figure 2 As shown, the following steps are included:
[0038] 1. Build scene environment model and drone model based on Gazebo, and import them into Gazebo;
[0039] 2. Build a drone functional system based on ROS;
[0040] 3. The simulation test is completed by the scene environment model, the UAV model and the UAV functional system, that is, the startup file of the simulation system is established according to the model, and the simulation test under the UAV functional system is completed based on the startup file. The file format of the scene environment model is sdf, the file format of the UAV model is xacro, and the file format of the startup file is launch.
[0041] Among them, Figure 3 As shown, the drone functional system includes a perception module, a positioning and mapping module, a path planning module, and a control module;
[0042] The perception module is used to obtain the status information and depth image information of the UAV during flight; the positioning and mapping module is used to obtain the real-time position and posture of the UAV during flight, and at the same time complete the autonomous construction of the navigation map; the path planning module completes autonomous path planning based on the current status information of the UAV, navigation map information, and sliding sub-map information; the control module realizes control of the UAV based on the target point of the above path planning.
[0043] The perception module includes a visual unit and an inertial measurement unit. The visual unit obtains depth image information based on an RGBD depth camera, and the depth image information includes obstacle information and wall information. The inertial measurement unit is used to obtain state information, and the state information includes three-axis angular velocity and linear acceleration.
[0044] The positioning and mapping module includes the following contents: combining the depth image information and state information with the Google Cartographer algorithm to complete the autonomous pose estimation of the drone and the construction of a two-dimensional grid map.
[0045] The path planning module includes the following contents: the current state information of the UAV represents the position, speed, and attitude information of the UAV; the navigation map information represents the two-dimensional grid map information obtained based on the Google Cartographer algorithm; the sliding sub-map information represents the two-dimensional grid sub-map within a given distance neighborhood around the UAV; the UAV autonomously completes path planning based on this sub-map and the artificial potential field algorithm.
[0046] The control module includes a decision-making unit and a control unit. The decision-making unit is used to autonomously select a suitable path planning strategy and determine the flight parameters of the UAV according to the current environmental information of the UAV; the control unit completes the posture control of the UAV based on the flight parameters.
[0047] Before conducting a UAV simulation test, the following preparations are required: establishing ROS nodes for the perception module, positioning and mapping module, path planning module, and control module, including the publishing and subscription rules for messages between modules, data transmission methods, and communication methods between the UAV and the ground station.
[0048] The embodiment of the present invention provides a UAV simulation test method based on ROS and Gazebo, which builds a scene environment model, a UAV and related sensor model based on Gazebo, and further builds a UAV functional system based on ROS and completes the simulation function test. The UAV functional system established by the embodiment of the present invention includes a perception module, a positioning and mapping module, a path planning module, and a control module. The perception module is used to obtain the state information and depth image information of the UAV during flight; the positioning and mapping module is used to obtain the UAV posture information and scene navigation map; the path planning module is used to complete the path planning in real time according to the current state information, depth image information and local grid map of the UAV; the control module is used to autonomously select the appropriate path planning strategy according to the current environmental information of the UAV, so as to determine the flight parameters of the UAV, so as to complete the posture control of the UAV.
[0049] In the embodiment of the present invention, the perception module includes a visual unit and an inertial measurement unit. The visual unit is used to obtain scene depth information (depth image information), including wall and obstacle information, and the inertial measurement unit is used to obtain state information, including the three-axis angular velocity and linear acceleration of the drone. Based on the depth image information and the state information combined with the Google Cartographer algorithm, the autonomous posture estimation of the drone and the construction of a two-dimensional grid map are completed. The sliding sub-map information represents the two-dimensional grid sub-map within a given distance neighborhood around the drone. The drone autonomously completes path planning based on the sub-map and the artificial potential field algorithm. The decision unit autonomously selects a suitable flight strategy and determines the flight parameters based on the environmental information. Finally, the control unit performs actions based on the flight parameters.
[0050] Before completing the simulation test, it is necessary to establish the ROS nodes of the perception module, positioning and mapping module, path planning module and control module, including the publishing and subscription rules of messages between modules, the data transmission method and the communication method between the drone and the ground station, so as to complete the functional test of the algorithm. In the embodiment of the present invention, the file format of the scene environment model is sdf, the file format of the drone and sensor model (the drone itself has some sensors, and the embodiment of the present invention also adds vision and height sensors to the original drone) is xacro, and the file format of the startup file is launch.
[0051] In the embodiment of the present invention, ROS refers to the Robot Operating System, which is an open source system for operating robots on computers and is composed of a large number of nodes, any of which can communicate with other nodes based on topics, services, etc. At the same time, ROS contains a large number of tool software, library codes and agreed protocols. It is a highly flexible software architecture for writing robot software programs and has been widely used in the fields of drones and unmanned vehicles. It can greatly simplify the creation and stability behavior control of complex tasks on various robot platforms, and improve the software reuse rate in robot development.
[0052] Gazebo is a 3D dynamic simulator that provides high-fidelity physical simulation and a set of sensor models suitable for simulation testing of drones.
[0053] The specific steps of building a scene environment model based on Gazebo are as follows: add a cuboid in the model database through the "Insert" tab to build a ground model, build walls and obstacles through the Building Editor, set the gravity, inertia and other physical properties of each model, and complete the site modeling.
[0054] The embodiments of the present invention can improve the reusability of each functional module and greatly reduce the difficulty of expanding or matching new functions by modularizing the drone functional system. It can also improve the diversity and scalability of drone simulation testing and reduce the complexity of drone simulation testing, thereby further improving the efficiency of drone simulation testing.
[0055] The sensors used in the embodiments of the present invention include an RGBD depth camera and an inertial measurement unit. Since optical devices such as cameras have high requirements on accuracy, in order to reduce the impact of sensor data on the robustness of the algorithm, in the actual engineering test process, the camera sensor can be calibrated with the help of calibration tools such as camera_calibration. The inertial measurement unit is a device for measuring the three-axis attitude angle (or angular rate) and acceleration of an object. An IMU includes three single-axis accelerometers and three single-axis gyroscopes. The accelerometer detects the independent three-axis acceleration signal of the object in the carrier coordinate system, and the gyroscope detects the angular velocity signal of the carrier relative to the navigation coordinate system, measures the angular velocity and acceleration of the object in three-dimensional space, and uses this to calculate the attitude of the object.
[0056] The embodiment of the present invention adopts the Google Cartographer method to complete SLAM mapping (simultaneous localization and mapping). After obtaining the two-dimensional map, the local two-dimensional grid map is maintained, and autonomous path planning is completed based on the artificial potential field method. During the autonomous path planning process, it is also necessary to autonomously select a suitable path strategy according to the actual scenario to ensure that the drone safely reaches the target point.
[0057] In the embodiment of the present invention, the file format of the scene environment model is sdf format, the file format of the drone model is xacro format, and the file format of the startup file is launch format. The sdf format file is a complete description of all contents from the world level to the robot level, and can describe all aspects of static and dynamic objects, terrain and even physics. The sdf format file also provides a method for defining various environments, including ambient lighting, terrain, etc., which can well simulate the real physical environment.
[0058] Xacro is the abbreviation of XML Macros. Xacro is an XML macro language, which is programmable XML. By setting the file format of the drone model to Xacro format, the Xacro file can be converted to a urdf file or used directly in the launch file. Compared with directly writing a urdf file, a more concise and easy-to-read drone model file can be achieved, which improves writing efficiency.
[0059] System Example
[0060] According to an embodiment of the present invention, a UAV simulation test system based on ROS and Gazebo is provided. Figure 4 Schematic diagram of a UAV simulation test system based on ROS and Gazebo according to an embodiment of the present invention. Figure 4 As shown, the UAV simulation test system based on ROS and Gazebo according to an embodiment of the present invention specifically includes:
[0061] A first construction module 40 is used to construct a scene environment model and a drone model through Gazebo;
[0062] The second building module 42 is used to build a drone functional system based on ROS;
[0063] A simulation test module 44 is used to establish a startup file for simulation test according to the scene environment model and the drone model, and complete the drone simulation test through the drone function system based on the startup file;
[0064] The drone functional system includes:
[0065] A perception module, connected to the positioning and mapping module, including a visual unit and an inertial measurement unit, for obtaining depth image information using an RGBD depth camera through the visual unit, obtaining drone status information through the inertial measurement unit, and transmitting the depth image information and the status information to the positioning and mapping module;
[0066] A positioning and mapping module, connected to the perception module and the path planning module, for obtaining the depth image information and the state information, using the Google Cartographer algorithm to estimate the drone's posture and construct a two-dimensional grid map for the depth image information and the state information, obtaining the drone's current state information and navigation map information, and transmitting the current state information and the navigation map information to the path planning module;
[0067] A path planning module, connected to the positioning and mapping module and the control module, is used to obtain the current state information and the navigation map information, perform autonomous path planning for the UAV according to the current state information, the navigation map information and the sliding sub-map information, and transmit the obtained path planning result to the control module;
[0068] A control module, connected to the path planning module, comprising a decision unit and a control subunit, configured to select a corresponding path planning result and determine flight parameters of the UAV according to current environmental information of the UAV through the decision unit, and perform posture control of the UAV according to the flight parameters through the control subunit;
[0069] The drone function system further includes:
[0070] An interaction module, connected to the perception module, the positioning and mapping module, the path planning module and the control module, for establishing a ROS node for each module, and realizing data transmission between modules and communication between the UAV and the ground station through the ROS node;
[0071] Wherein, the depth image information includes obstacle information and wall information;
[0072] The state information includes three-axis acceleration and linear acceleration;
[0073] The current state information includes the position, speed and attitude information of the UAV;
[0074] The sliding sub-map information is a two-dimensional grid sub-map within a given range of the UAV.
[0075] The embodiment of the present invention is a system embodiment corresponding to the above-mentioned method embodiment. The specific operations of each module can be understood by referring to the description of the method embodiment, which will not be repeated here.
[0076] In summary, compared with the prior art, the embodiment of the present invention uses the Gazebo simulation software to build the scene environment model and the UAV model, and combines ROS to build the functional system of the UAV, verifies the reliability of the UAV's positioning, mapping and path planning in a variety of complex scenarios, and further reduces the safety risks of the actual flight of the UAV by evaluating the performance of the algorithm in different challenging scenarios; in addition, the embodiment of the present invention fully utilizes the advantages of ROS's multi-threaded and distributed software architecture, improves the execution efficiency of the simulation, and provides reliable tool support for more comprehensive and accurate UAV system performance, including the following
[0077] Beneficial effects:
[0078] (1) The UAV simulation test method based on ROS and Gazebo provided in the embodiment of the present invention constructs a scene environment model in Gazebo, solves the technical problem that the simulation conclusion is quite different from the actual machine, and ensures the effectiveness of the simulation test;
[0079] (2) The embodiment of the present invention builds a UAV functional system based on ROS, which improves the portability of the algorithm, greatly reduces the development difficulty, and improves the simulation test efficiency of the UAV.
[0080] (3) The simulation scheme proposed in the embodiment of the present invention can simulate almost all scenarios in the physical environment and can effectively improve the safety of UAV flight.
[0081] Device Example 1
[0082] An embodiment of the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps described in the method embodiment when executed by the processor.
[0083] Device Example 2
[0084] An embodiment of the present invention provides a computer-readable storage medium, on which a program for implementing information transmission is stored. When the program is executed by a processor, the steps described in the method embodiment are implemented.
[0085] The computer-readable storage medium in this embodiment includes, but is not limited to, ROM, RAM, magnetic disk or optical disk, etc.
[0086] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements 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 UAV simulation test method based on ROS and Gazebo, characterized in that: include: Build scene environment model and drone model through Gazebo; Build drone functional system based on ROS; A startup file for the simulation test is established according to the scene environment model and the drone model, and the drone simulation test is completed through the drone functional system based on the startup file.
2. The method according to claim 1, characterized in that The drone simulation test completed by the drone functional system specifically includes: The visual unit of the perception module in the drone functional system uses an RGBD depth camera to obtain depth image information, the drone status information is obtained through an inertial measurement unit, and the depth image information and the status information are transmitted to a positioning and mapping module; The depth image information and the state information are obtained through the positioning and mapping module, the Google Cartographer algorithm is used to estimate the drone pose and construct a two-dimensional grid map for the depth image information and the state information, the current state information and the navigation map information of the drone are obtained, and the current state information and the navigation map information are transmitted to the path planning module; Acquire the current state information and the navigation map information through a path planning module, perform autonomous path planning for the UAV according to the current state information, the navigation map information and the sliding sub-map information, and transmit the obtained path planning result to the control module; The decision unit of the control module selects the corresponding path planning result and determines the flight parameters of the UAV according to the current environmental information of the UAV, and the control subunit controls the position and posture of the UAV according to the flight parameters.
3. The method according to claim 2, characterized in that The drone simulation test completed by the drone functional system specifically includes: The interactive modules in the UAV functional system are used to establish ROS nodes for the perception module, positioning and mapping module, path planning module and control module, and the ROS nodes are used to realize data transmission between modules and communication between the UAV and the ground station.
4. The method according to claim 2, characterized in that: The depth image information includes obstacle information and wall information; The state information includes three-axis acceleration and linear acceleration; The current state information includes the position, speed and attitude information of the UAV; The sliding sub-map information is a two-dimensional grid sub-map within a given range of the UAV.
5. A UAV simulation test system based on ROS and Gazebo, characterized in that: include: The first building module is used to build the scene environment model and drone model through Gazebo; The second building module is used to build a drone functional system based on ROS; The simulation test module is used to establish a startup file for the simulation test according to the scene environment model and the drone model, and complete the drone simulation test through the drone function system based on the startup file.
6. The system according to claim 5, characterized in that The drone functional system includes: A perception module, connected to the positioning and mapping module, including a visual unit and an inertial measurement unit, for obtaining depth image information using an RGBD depth camera through the visual unit, obtaining drone status information through the inertial measurement unit, and transmitting the depth image information and the status information to the positioning and mapping module; A positioning and mapping module, connected to the perception module and the path planning module, for obtaining the depth image information and the state information, using the Google Cartographer algorithm to estimate the drone's posture and construct a two-dimensional grid map for the depth image information and the state information, obtaining the drone's current state information and navigation map information, and transmitting the current state information and the navigation map information to the path planning module; A path planning module, connected to the positioning and mapping module and the control module, is used to obtain the current state information and the navigation map information, perform autonomous path planning for the UAV according to the current state information, the navigation map information and the sliding sub-map information, and transmit the obtained path planning result to the control module; The control module is connected to the path planning module and includes a decision unit and a control subunit, which is used to select the corresponding path planning result and determine the flight parameters of the UAV according to the current environmental information of the UAV through the decision unit, and perform posture control of the UAV according to the flight parameters through the control subunit.
7. The system according to claim 6, characterized in that The drone function system further includes: The interaction module is connected to the perception module, the positioning and mapping module, the path planning module and the control module, and is used to establish a ROS node for each module, and realize data transmission between modules and communication between the UAV and the ground station through the ROS node.
8. The system according to claim 6, characterized in that The depth image information includes obstacle information and wall information; The state information includes three-axis acceleration and linear acceleration; The current state information includes the position, speed and attitude information of the UAV; The sliding sub-map information is a two-dimensional grid sub-map within a given range of the UAV.
9. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the steps of the UAV simulation test method based on ROS and Gazebo are implemented as described in any one of claims 1 to 4.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores an implementation program for information transmission, and when the program is executed by the processor, the steps of the UAV simulation test method based on ROS and Gazebo as described in any one of claims 1 to 4 are implemented.
