I am trying to create a roll gimbal as well. I was going to post a similar question. I think thought this would be easy for the people on this forum.
Does nobody that uses this forum to help Cluaran and me by proxy.
I am new as well. I have read a lot of posts. There are some seriously smart people on this forum. I find it hard to believe, no body is able to help with is.
I think you would need to power the servo independently, convert the IMU values to radians or degrees. Attach the servo signal wire to a PWM pin. The have a level value for the shelf level then plus minus the number of degrees to keep the shelf level by having servo move by plus minus the delta.
Best guess. I am still trying to get the ESP32 to connect to laptop. But don’t like seeing people left hanging