Mouse Input to Gimbal Angle Conversion

Hi y’all,

Last year, my team used the following formula to calculate gimbal angle with mouse input:

pitch += mouse_y * deltaTime * sensitivity
yaw += mouse_x * deltaTime * sensitivity

This worked okay, but definitely wasn’t ideal. This only gives smooth 1:1 motion for an FPV camera mounted in the center of rotation, and is not the case for most RoboMaster robots. It’s akin to having mouse acceleration on in a video game.

If you were to graph all the possible locations for the camera, it would look like a spherical segment or “napkin ring”:

Has anyone tried mapping mouse input to a plane like above, or have any other ways of calculating gimbal angle to feel more “natural?” I’m sort of stumped on this problem.