In the aerial process of UAV, will it feel that the simple pointing flight is too simple and the flight track is too straight? In this paper, WE try to use more interfaces of Mavros to make the flight track of UAV look silkier, which is reflected by the movement of eight circles.

Few words said, look at the video effect: www.bilibili.com/video/BV1BL…

Aircraft tracks in QGC

Graph data points

Speaking of the movement around eight, do you think of Bernoulli double wireThe parametric equation of Bernoulli binormal is:** Two, MAVROS interface code implementation Among the interfaces provided by Mavros, there is the mavros/ setpoint_RAW /local topic, which is the interface for uav position, speed, acceleration, heading Angle and heading Angle rate control.

Px4 Mavros Offboard official case demo provides a simple position data control, multiple position points, the drone track is not smooth enough, here we need to control the mavros/ setpoint_RAW /local all data control!

In order for each data to be represented, using the parametric equation of Bernoulli’s double newline,

Position. X; Position. Y; Velocity. X; Velocity. Y; Afx; Afy; yaw

In the code is represented asThe whole time our altitude direction above the specified height, velocity and acceleration are zero.

The full code is figure_8_circle.cpp, see bottom.

** 3. Save the data and generate track graph **

The above motion control code of circling eight has been basically realized. In order to accurately process uav data in ROS and generate trajectory map similar to that in MATLAB, we obtained the topic data of Mavros/LOCAL_position /pose and saved it into TXT document data in TUM format. The code for save_traj_as_tum. CPP

PIP install evo –upgrade –no-binary Evo PIP install evo –no-binary Evo

Timestamp TX ty tz qx qy qz qw (each line has 8 elements, no space at the end, time in seconds)We subscribe to mavros/local_position/pose using save_traj_as_tum. CPP and save the file to /home/amov/test.txt. See the complete code at the end of this article. The actual result of the test. TXT file is as follows:

Evo_traj tum test. TXT -p generate track map using the command evo_traj tum test. TXT -p

Four,

In general, the realized motion around eight can not reach 100% as smooth as Bernoulli double wire. Here is another way to control THE UAV. Do not only consider the use of pure position control or pure speed control, but also consider some compound control, so that the UAV can be smooth and smooth. Mavros under PX4 has a lot of plugins, and also has a lot of functions. The functions that can be realized on THE UAV ground station QGC can also be realized on the airborne computer. “Amu Lab, make machine development more efficient!” , hope to give you the idea of inspiration after reading the article.

See the comments section for the full source code

5. Reference links

ROS tracks are saved in TUM format and drawn with EVO tracks: its301.com/article/jus…

Bernoulli Double link: zh.wikipedia.org/wiki/%E4%BC…

Data type: docs.ros.org/en/api/mavr…

Author: Amu Laboratory – Shinichi

  • End –

With the rapid development of technology, AMu Lab will keep up with the pace of technology and constantly recommend the latest technology and hardware in the robot industry to everyone. The greatest value of our training is to see our trainees make rapid progress in technology. If you are in the robotics industry, please follow our official account, we will continue to publish the most valuable information and technology in the robotics industry. Amu Lab is committed to providing open source software and hardware tools and course services for robot r&d to make r&d more efficient!