The uncertainty principle between two observables is related to their commutator in a general and profound way. The generalized uncertainty principle can be proved quite generally using simple matrix algebra and the Cauchy-Schwartz Inequality.
I) Suppose we have two Hermitian operators (aka observables) $\hat{A}$ and $\hat{B}$. The possible results of a measurement are their eigenvalues and the dispersion in the measurement is:
$$({\Delta\hat{A}})^2 = \langle\hat{A}^2\rangle-\langle\hat{A}\rangle^2.$$
We can always choose a new reference system to set $\langle\hat{A}\rangle=0$ so we get:
$$({\Delta\hat{A}})^2 = \langle\hat{A}^2\rangle = \int\psi^*\hat{A}^2\psi \mathrm{d}x =\langle\psi|\hat{A}^2|\psi\rangle$$
and the same obviously holds for $\hat{B}$.
II) Using the Cauchy-Schwartz Inequality:
$$\langle\psi|\hat{A}\hat{A}|\psi\rangle\langle\psi|\hat{B}\hat{B}|\psi\rangle \geqslant |\langle\psi|\hat{A}\hat{B}|\psi\rangle|^2$$
one can immediately obtain:
$$({\Delta\hat{A}})^2({\Delta\hat{B}})^2 \geqslant |\langle\psi|\hat{A}\hat{B}|\psi\rangle|^2.$$
III) Now, we can reduce the term on the right
$$|\langle\psi|\hat{A}\hat{B}|\psi\rangle| \geqslant \left|\operatorname{Im}\Big[\langle\psi|\hat{A}\hat{B}|\psi\rangle \Big] \right| = \left|\frac{1}{2i}\Big[\langle\psi|\hat{A}\hat{B}|\psi\rangle - \langle\psi|\hat{A}\hat{B}|\psi\rangle^* \Big]\right|$$
where I have used that the modulus of a complex number is bigger than its imaginary part and then I used the fact that if $f= \operatorname{Re}(f)+i \operatorname{Im}(f)$, then $\operatorname{Im}(f)=\frac{1}{2i}(f-f^*)$.
IV) Because $\hat{A}$ and $\hat{B}$ are observables, then $\langle\psi|\hat{A}\hat{B}|\psi\rangle^*=\langle\psi|(\hat{A}\hat{B})^{\dagger}|\psi\rangle=\langle\psi|(\hat{B}\hat{A})|\psi\rangle$.
V) Finally, using this result we can rewrite the inequality as:
$$({\Delta\hat{A}})^2({\Delta\hat{B}})^2 \geqslant \left|\frac{1}{2i}\Big[\langle\psi|\hat{A}\hat{B}|\psi\rangle - \langle\psi|\hat{B}\hat{A}|\psi\rangle \Big]\right|^2 = \left|\frac{1}{2i}\Big[\langle\hat{A}\hat{B}\rangle - \langle\hat{B}\hat{A}\rangle \Big] \right|^2 = \left|\frac{1}{2i}\langle[\hat{A},\hat{B}]\rangle\right|^2.$$
So the dispersion in any two Hermitian operators is related to their commutator
$$({\Delta\hat{A}})^2({\Delta\hat{B}})^2 \geqslant \left|\frac{1}{2i}\langle[\hat{A},\hat{B}]\rangle\right|^2.$$
I suppose that you could measure the dispersion of two observables with increasing accuracy to find some upper limit on their commutator.
Note that this works for any two observables you like to use, not just canonical ones like $\hat{X}$ and $\hat{P}$.