Jitter problem with the servos managed by Arduino UNO and IMU sensor (BNO055)

Hello, everyone. I am struggling with the management of two servos to stabilize a camera. To do this I use an inertial sensor mounted on an Adafruit board (BNO055) and an Arduino UNO.
In short, the program reads the Euler angles provided by the sensor and converts them to the angle at which the servo should position itself.
The problem is in the jitter of the servos. It occurs every 3-4 seconds, and is 5-10 degrees, even though the sensor is immobile. The jitter of one servo is independent of the other servo. The data sent to the servo signals (controlled by a serial print) do not change.
The problem occurs when using both the Arduino UNO and Arduino NANO.
The servos are not the cause of the problem, in fact two Tower Pro Micro Servo SG90, two Grove-Servo, two GWServo S03N STD, two Master Midi-Servo DS3010 have been tested.
The power supply and wiring are not the cause of the problem, as I use a DC power supply that powers the system. The problem also occurs when using a 12v battery and the necessary voltage regulators.
The code is as follows. It is based on the code found online at “Capturing IMU Data with a BNO055 Absolute Orientation Sensor - Projects” by Mark Hughes:

//---- Included Libraries ----//  
#include <Wire.h>                           // I²C library
#include <math.h>                           // trig functions
#include <Adafruit_Sensor.h>                // Base library for sensors
#include <Adafruit_BNO055.h>                // BNO055 specific library
#include <utility/imumaths.h>               // Vector, Matrix, and IMUMath library
#include <servo.h>                          // Standard Servo library

#define BNO055_SAMPLERATE_DELAY_MS (20)     // Set pause between samples

//---- Variable Declaration ----//

boolean debug = true;                       // true/false = extra/no information over serial

int rollPin  = 9;                           // Digital pin for roll
int pitchPin = 10;                          // Digital pin for pitch

float roll, pitch;                     // Variable to hold roll, pitch information

Adafruit_BNO055 bno = Adafruit_BNO055();    // Use object bno to hold information

Servo rollServo;                            // Create servo rollServo
Servo pitchServo;                           // Create servo pitchServo

void setup(void) {
  
  rollServo.attach(rollPin);                // The rollServo is connected at rollPin
  pitchServo.attach(pitchPin);              // The pitchServo is connected at pitchPin

  Serial.begin(115200);                     // Create serial connection at 115,000 Baud

  if (!bno.begin())                         // Attempt communication with sensor
  /*{
    Serial.print("Ooops, no BNO055 detected ... Check your wiring or I2C ADDR!");
  }*/

  delay(1000);                               // Wait 1 seconds to allow it to initialize
  bno.setExtCrystalUse(true);               // Tell sensor to use external crystal
}

//---- Main Program Loop ----//
void loop() {

  //---- Request Euler Angles from Sensor ----//
  sensors_event_t event;
  bno.getEvent(&event);

 /* if (debug) {                             // If debug is true, send information over serial
    Serial.print("Measured Euler Roll-Pitch");
    Serial.print("\t pitch: "); Serial.print(event.orientation.y, 4); Serial.print("\t");
    Serial.print("\t  roll: "); Serial.print(event.orientation.z, 4); Serial.println();
  }
  */
  /* Remap information from the sensor over the 0° - 180° range of the servo
     The Roll values are between -90° and +90°
     The Pitch values are between -180° and +180°
  */
  int servoRoll =  map(event.orientation.z,  -90, 90, 180, 0);
  int servoPitch = map(event.orientation.y, -90, 90, 0, 180);

  servoRoll = constrain(servoRoll, 45, 135);  //limits roll angle range
  servoPitch = constrain(servoPitch, 70, 115);//limits pitch angle range


 /* if (debug) {                             // If debug is true, send information over serial
    Serial.print("Measured Euler Roll-Pitch");
    Serial.print("\t Pitch Servo: "); Serial.print(servoPitch); Serial.print("\t");
    Serial.print("\t  Roll Servo: "); Serial.print(servoRoll);  Serial.println();
  }
  // If debug is true, send information over serial
  if (debug) {
    Serial.println("Calculated Servo Roll-Pitch");
    Serial.print("\t roll:");  Serial.print(servoRoll, DEC);  Serial.print("\t");
    Serial.print("\t pitch:"); Serial.print(servoPitch, DEC); Serial.print("\t");
  }
  */

  rollServo.write(servoRoll);              // Send mapped value to rollServo
  pitchServo.write(servoPitch);            // Send mapped value to pitchServo

  delay(BNO055_SAMPLERATE_DELAY_MS);       // Wait before rerunning loop
}

Looking at other topics and forums, I realized that it could be a problem with timers and interrupts, but I can’t find a solution that eliminates the problem.

If someone had already had a similar problem and was able to give me some advice I would be extremely grateful.

Cordially, BWild

Hello, everyone! I wanted to tell you that I managed to solve the problem of jitter. To do this I replaced the servo.h library with the "Adafruit_TiCoServo.h" library found on the "https://learn.adafruit.com/neopixels-and-servos/the-ticoservo-library" page. This library controls servos (only on certain pins) without being influenced by an i2c bus (I tested it out and it works perfectly).