Navigation API Positional information mavros topic


#1

Hi,

Which topic does the navigation API get the drone’s positional data from? Is it from mavros/local_position/local topic? We are using PX4 Optical Flow Sensor to obtain positional data for our system in FlytOS. It is currently being published in mavros/local_position/local. We observed that the z value in this topic is not very accurate. After publishing mavros/px4flow/ground_distance, we realised it is much more accurate than the z-value in local_position/local. We wanted to know if there is any way to get the navigation APIs such as position_set and velocity_set to use x and y values from local_position/local and z values from px4flow/ground_distance.

Thanks!


#2

FlytOS uses ‘mavros/local_position/local’ topic data for internal state reference. However, the navigation APIs do not use this information.

So, any error in z estimation will not result in any change to the commands sent from FlytOS to Autopilot. However, error in z estimation will affect the execution of the commands at the autopilot level due to bad state estimation.

Also, the ‘mavros/local_position/local’ topic is actually data in MavLink topic local_position_NED. The z value in this topic is computed using GPS, Barometer and IMU. Default height estimation accuracy is not good, due to sensor noise. In case a SONAR/LiDAR is available then it is used to increase the accuracy.

So, you need to search for ways to integrate optic flow sensors ‘ground distance’ data into height estimation loop inside the autopilot. Or, the best way is to use a separate rangefinder. The px4flow sensor’s SONAR has several known issues. I remember reading a lot of related queries on Ardupilot forums.