Yaw setpoint issue in EKF2

Dear for evryone @Jaeyoung-Lim

I have a Yaw control issue.
My Quadrotor use offboard with EKF2 External Vision Yaw…

When UAV is takeoff, it rotates about 10~15 degree, even I put setpoint 0degree Yaw like below picture.
Yaw setpoint follows estimated Yaw angle…

After 3~4seconds, it returns to normal that means Yaw setpoint 0degree.

Could anybody helps this for me?

This is flight log

Thank you

Could you share us the log of which this is happening? also it would be helpful if you can share us which version of the firmware you are using

Thank you, the firmware version is 1.9.0
I just updated the flight log

@jongbeom.her It seems like you have high interference between the mag and thrust. This can be seen from the thrust / mag plot.

Could you elaborate on how the compass sensor is mounted on the vehicle? Is it possibly close to a power cable / ESC? It might be a good idea to compare the results when you have the compass sensor positioned further away from the vehicle

I also have already checked the mag and thrust plot.
Actually my compass sensor of UAV is very close to ESC.

But, how the yaw set point is changed? even I fixed the yaw set point.
It’s hard to understand…

@jongbeom.her Can you give more information on how / what setpoints you were sending, especially the following fields

  • mavros_msgs topic name
  • coordinate frame
  • type_mask

From the log it looks like it is trying to hold the current yaw, rather than your setpoint as yaw=0 deg, or yaw=0 that is not defined in the local frame

Yes, that is our UAV problem. It looks that the setpoint yaw try to hold the current yaw after take-off.

  • mavros_msgs topic name : setpoint_position/local
  • coordinate frame : pixhawk - pixhawk body frame, UAV - self made frame(x/forward, z/up)
  • type_mask : EKF2_AID_MASK 24

Like above picture, although we send yaw command 0deg using ‘setpoint_position/local’ topic, desired yaw of pixhawk follows current yaw for seconds and then it drops to 0deg.

@jongbeom.her I am confused on your coordinate frame

  1. Do you mean you are putting the frame_id defined as pixhawk? coordinate frame is defined in the mavlink message SET_POSITION_TARGET_LOCAL_NED
  2. If it is defined in the bodyframe, yaw=0 means hold current yaw, and will move when ever yaw yaw estimate changes anyway. If this was the desired outcome, your logs show that it is more or less doing that. You are resetting your target attitude to the current attitude.

@jongbeom.her Any updates?

Um, we don’t set, define ‘SET_POSITION_TARGET_LOCAL_NED’ so, I think it remains just default value?

If our UAV is defined in the bodyframe, it always holds current yaw. This issue occur just after take-off for few seconds,

@jongbeom.her If you are sending through the mavros topic setpoint_position/local it is sending the SET_POSITION_TARGET_LOCAL_NED mavlink message to the flight controller. It would be helpful if you check what is in the type_mask field. By default you don’t send attitude commands in the bodyframe.

That explains why it only happens on take off. Your attitude estimate is being influenced by the mag only on take off. Therefore your bodyframe is turning. As you are sending the target attitude(yaw) as 0 in the bodyframe, it will try to follow the turned attitude.

Thank you, I understand a little bit now.
The type_mask field means EKF2_AID_MASK??

@jongbeom.her No, it is not a firmware parameter. You can see the type_mask in mavros_msgs/PositionTarget.msg which maps to the mavlink message SET_POSITION_TARGETL_LCOAL_NED as I have mentioned before