mavros coordinate system conversion and direction

This article was written on January 21, 2021, and the direction of the mavros coordinate system may change in the future.

The coordinate system of mavros is really messy, and it is different from the coordinate system commonly used by px4. The coordinate system used by px4 is NED (north east) coordinate system or FRD (front lower right) coordinate system. However, the ENU (Northeast Sky) coordinate system or body system is often used in mavros. Mavros will automatically convert the input ENU coordinate value or body system coordinate value to the NED coordinate system, and then send it to the flight controller through mavlink . For specific instructions, please refer to the instructions in the github repository of mavros

Common coordinate systems in the topic of mavros are global system, local system, body system

The global system is easy to understand, it is the GPS coordinate system, latitude and longitude, and not much.

local refers to the local coordinate system, which is generally the ENU coordinate system, and the origin of the coordinate is generally at the take-off point. If there is an offset, the origin of the coordinates is on the plane, which is actually the navigation coordinate system at this time.

The body department is more interesting. If you install ros-kinetic-mavros (binary installation) with apt, that is, the kinetic version of mavros, the body system is the RFU (front right upper) coordinate system, and the coordinate origin is on the body. This RFU coordinate system is a bit similar to the ENU system on the surface, but in fact it is not used in the engineering field and major textbooks. Therefore, in the melodic version, the body system has been changed to the FLU (front upper left) coordinate system. In the latest mavros source code , the body system has also been replaced with the FLU coordinate system. Therefore, if the mavros is compiled with the source code, the body system is all the FLU system.

This mavros change occurred at: https://github.com/mavlink/mavros/pull/1446/files

Among them, the baselink system is the body system (FLU) used by mavros, and the aircraft system is the body system (FRD) used by px4. The details of the transform used can be found in /mavros/mavros/src/lib/ftf_frame_conversions.cpp and /mavros Found in /include/mavros/frame_tf.h .

Therefore, when using kinetic and melodic versions of mavros, you must pay attention to the difference in the body system.

 

Specific to the topics in mavros , such as our commonly used mavros/setpoint_raw/local topics , the topic type is mavros_msgs/PositionTarget , the official explanation of this topic type is as follows:

The description of coordinate_frame is not only wrong, but also extremely misleading. Although coordinate_frame=1 means sending the NED coordinate value to px4, the coordinate system you send to this topic should use ENU, and mavros will automatically complete the conversion of this coordinate system. Similarly, coordinate=8 and 9 are not NED systems, but FLU systems.

Related issue in px4: https://github.com/mavlink/mavros/issues/1500

It is recommended to change this topic type description document to:

The premise is the melodic version of mavros. If it is the kinetic version of mavros installed with apt, the body system is still a strange RFU system. Remember to remember.

 

Guess you like

Origin blog.csdn.net/benchuspx/article/details/112970682