Gyroscope controlling 2 servos at once

So I built a HOG drive gimbal in order to thrust vector a model rocket engine.
Here is a pic of what a hog drive looks like, it basically has 2 rings, one controls the x orientation, and the other, mounted inside the first, controls the y.

I am using a mpu 6050 to read orientation values and turn the gimbal in the opposite direction of the accelerometer's value. So far I have written code to control one servo to mimic the gyro's orientation. I was wondering if you guys could help me make it so that both servos work continously, and to get the servos to rotate the opposite direction of the gyro. Thanks and all the best
-High School Student

#include "Wire.h"       // allows communication to i2c devices connected to arduino
#include "I2Cdev.h"     // I2Connection library (communication to serial port)
#include "MPU6050.h"    // IMU library
#include "Servo.h"      // servo control library
 
MPU6050 mpu; //defines the chip as a MPU so it can be called in the future
 
int16_t ax, ay, az;  // x y z orientation values from accelerometer
int16_t gx, gy, gz;  // x y z orientation values from gyrscope
/////////////////////////////////////////////////////////////////////////////////////// 
Servo outer; 
Servo inner;
///////////////////////////////////////////////////////////////////////////////////////
int valo;     // outer val
int prevValo; // outer prev val
///////////////////////////////////////////////////////////////////////////////////////
int vali;  //inner val
int prevVali; //outer prev val
/////////////////////////////////////////////////////////////////////////////////////// 
//initializes the IMU
void setup() 
{
    Wire.begin(); 
    Serial.begin(38400); 
 
    Serial.println("Initialize MPU");
    mpu.initialize();
    Serial.println(mpu.testConnection() ? "Connected" : "Connection failed"); 
    outer.attach(9); //servo on pin 9 for large ring y
    inner.attach(10);//servo on pin 10 for small ring x
}
/////////////////////////////////////////////////////////////////////////////////////// 
void loop() 
{
    mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz); 
 
    valo = map(ax, -17000, 17000, 0, 179);
    if (valo != prevValo)
    {
        outer.write(valo); 
        prevValo = valo; 
    }
    
     vali = map(ay, -17000, 17000, 0, 179);
    if (vali != prevVali)
    {
        inner.write(vali); 
        prevVali = vali; 
    }
}
///////////////////////////////////////////////////////////////////////////////////////
    valo = map(ax, -17000, 17000, 0, 179);
    if (valo != prevValo)
    {
        outer.write(valo); 
        prevValo = valo; 
    }
    
     vali = map(ay, -17000, 17000, 0, 179);
    if (vali != prevVali)
    {
        outer.write(vali); 
        prevVali = vali; 
    }

Why are you writing to outer in both blocks? Shouldn't you be writing to inner in one of them?

PaulS:

    valo = map(ax, -17000, 17000, 0, 179);

if (valo != prevValo)
    {
        outer.write(valo);
        prevValo = valo;
    }
   
     vali = map(ay, -17000, 17000, 0, 179);
    if (vali != prevVali)
    {
        outer.write(vali);
        prevVali = vali;
    }



Why are you writing to outer in both blocks? Shouldn't you be writing to inner in one of them?

thanks for catching that, lol

I would make the gimbal lever arms quite a bit longer than the servo arms so a lot of servo movement translates to very little movement at the nozzle. This will give you more precision out of your servos. IE 5 degrees of movement at the servo means one degree of movement at the nozzle. If this doesnt make sense, I will draw a picture.
Also, make them point straight outwards instead of at an angle at 0, 0. This will allow you to use more of the servos range.

There's no need to keep prevVal0, prevVal1, there's no real cost with calling
servo.write () every time.

Changing output range to map will allow reversing the sense of the output I think
(well, I'd hope it works that way):

    outer.write (map (ax, -17000, 17000, 179, 0);
    inner.write (map (ay, -17000, 17000, 179, 0);

sorry for being a newbie, but how would I implement this

but how would I implement this

Implement what? The code in the previous post?