In the general case, there's value in knowing that a particular sonar sensor is pointing straight ahead and telling you you're about to hit a wall vs. maybe pointing downward and actually being useful for helping you land.  This implementation isn't really the general case due to the way it's being bound directly to an altitude measurement.

The range on these sensors is only 1.5m (on some) and up to 5m (on this one).  This implementation is very narrowly intended to provide an altitude measurement so I'm not sure if it even makes sense to support pointing it anywhere but directly down (relative to body).  For this particular use-case, I'm inclined to hard-code the board-to-body rotation rather than allowing it to be specified by the user.  This means telling our users that they must point the sonar sensor straight down to be useful as a fine distance-above-ground measurement.

It makes some sense to make an effort to adjust for the body's rotation in the world coordinates but if your airframe isn't approximately straight/level when you're <5m (or 1.5) above the ground during a landing, we may be quite screwed.  This would basically be a projection of the measurement onto an (assumed) flat surface of the earth if I'm understanding your suggestion properly.