For offboard mode using ROS2 + PX4 system (quadcopter), I usually just fix my yaw angle based on the initial value collected from px4_msgs::msg::VehicleOdometry subscriber by doing something like this:
px4_msgs::msg::TrajectorySetpoint traj{};
traj.yaw = current_yaw;
trajectory_setpoint_pub_->publish(traj);
I wonder if this might be wrong to fix the yaw for the actual drone flight as their body usually turn right when they want to go right and vice versa. If yes (my method is wrong), how would you fix it?