I had to solve this same issue with a quadruped robot. These were two issues, (1) generating the PWM signal accurately is harder than you might think. You can see this if you have a logic analyser to measure the signal. and (2) calibrating the servo.
I wrote some software in Micro Python that can control up to 16 servos. It has a test mode and a run mode. In test mode, you enter angles in degrees and then measure the actual angles with a protractor. You can measure as many points as you like. Then the software computes a correction function using a least-squares fit.
The test mode also allows you to change the direction and set angle limits for safety and also to define a “zero”.
One big thing it does is the driver allows you to set a rate and acceleration and then the driver computes all the small positions and updates the PWM. It all runs on ESP32 and uses hardware-generated PWM. Micro Python makes this easy. “Mico” is not like normal Python and can produce compiled code if you ask and can do true multitasking.
This is the only good solution I could come up with, basically impose a least-squares calibration function and offload the hard real-time control. The ESP32-S3 has no trouble generating 16 channels of near perfect PWM using only one of its CPU cores and then the other core to handle the data interface to the Raspberry Pi. There is some shared data in RAM that both cores look at.
All that said, while this driver does extract every last bit of performance from a hobby servo, my problem was that servos are at least an order of magnitude underperforming for my application. You need three-phase BLDC for anything that walks.
The code is on GitHub (someplace)