External position Estimation, MAVSDK commands

Hello.

I am trying to implement external positon estimation from custom camera system from which I can get rotation matrix and translation vector to express multicopter frame in Camera coordinate frame.

I was looking into, how to forward this information to be used by PX4 controller EKF and here I found VISION_POSITION_ESTIMATE command. It says that :

The messages should be streamed at between 30Hz (if containing covariances) and 50 Hz.

Found this also in MAVSDK-python
mavsdk.VisionPositionEstimate(time_usec, position_body, angle_body, pose_covariance)
And should probably use it with await drone.mocap.set_vision_position_estimate() command.

Now there is a similar command :
mavsdk.AttitudePositionMocap(time_usec, q, position_body, pose_covariance) ( ATT_POS_MOCAP)
And I would like to know the difference between the two. For what purpose AttitudePositionMocap can be used, if EKF is only subscribed to VisionPositionEstimate command uORB topic?

On the side not, what will happen if the VisionPositionEstimate is streamed at lower rate then required? If this is supposed to replace the GPS messages, then why the streaming rate is so much higher? (I believe it is heigher, but cannot find the actual documentation on the lowest acceptable GPS streaming rate at the moment).

I assume the higher the rate the better, however, to say more I’d have to look at the ekf2 code and see what is happening.

Regarding VisionPositionEstimate and AttitudePositionMocap I have no idea what the difference really is when the messages arrive on the PX4 side. Let me ping @TSC21, he might have an idea.

@Themaksiest ATT_POS_MOCAP is only consumed by LPE at this point, not EKF2. If you want to use Mocap with EKF2, you will need to inject it as a VISION_POSITION_ESTIMATE message or as an ODOMETRY message with the estimator_type field set to MAV_ESTIMATOR_TYPE_VISION.

@TSC21 Thank you for the response. By following the guide I linked previously, I can now send vision_position_estimate, but as I have set the PX4 parameter MAV_ODOM_LP to 1 to troubleshoot, I noticed that in QGroundControl in MAVLink inspector under the topic Odometry , the frequency is not constant.

I try to await set_vision_position_estimate with constant values each second, but the frequency in Odometry jumps around 0.2 , 0.8 and 1 Hz. I am using 433MHz radio to set_vision_estimate, and I am monitoring in Qgroundcontrol through USB cable. (Originaly I tried sending vision_position_estimate every 0.25s but the frequency also jumps around, just at values from 1.5 to 4 Hz)

Is this supposed to be like this due to the nature of await and the hardware I am using or am I missing something? Any comments will be appreciated as I am stuck at explaining this phenomenon.

Maybe this is more of a question for @JulianOes, but are there any ways to check when the message has been received in MAVSDK-Python?