Visual Interial Odometry with ZED 2i and ROS1

I have setup ROS with MAVROS to publish XYZ values and their corresponding velocities to a Pixhawk Cube Black. I can see these values in QGroundControl and the flight controller enters POSITION flight mode. However it is really unreliable, is always exiting POSITION flight mode (and not returning to it without a complete reset) and I constantly get errors like in the image provided. Does anyone have any advice on what might be wrong? I can provide the code that I am using.