The uncertainty principle between two observables is related to their commutator in a general and profund way. The generalized uncertainty principle can be proved quite generally using simple matrix algebra and the Cauchy-Schwartz Inequality:
I) Supose we have two hermitian operators (aka observables) $\hat{A}$ and $\hat{B}$. The possible results of a measurment are their eivenvalues and the dispersion in the measurment is:
\begin{equation}
({\Delta\hat{A}})^2 = \langle\hat{A}^2\rangle-\langle\hat{A}\rangle^2
\end{equation}
We can calways chose a new reference system to set $<\hat{A}>=0$ so we get:
\begin{equation}
({\Delta\hat{A}})^2 = \langle\hat{A}^2\rangle = \int\psi^*\hat{A}^2\psi dx =\langle\psi|\hat{A}^2|\psi\rangle
\end{equation}
And obviusly the same holds for $\hat{B}$.
II) Using the Cauchy-Schwartz Inequality:
\begin{equation}
\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
\end{equation}
One can inmediately obtain:
\begin{equation}
({\Delta\hat{A}})^2({\Delta\hat{B}})^2 \geqslant |\langle\psi|\hat{A}\hat{B}|\psi\rangle|^2
\end{equation}
III) Now,we can reduce the term in the right
\begin{equation}
|\langle\psi|\hat{A}\hat{B}|\psi\rangle| \geqslant |Im\Big[\langle\psi|\hat{A}\hat{B}|\psi\rangle \Big] = |\frac{1}{2i}\Big[\langle\psi|\hat{A}\hat{B}|\psi\rangle - \langle\psi|\hat{A}\hat{B}|\psi\rangle^* \Big]|
\end{equation}
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= Re(f)+i Im(f)$ then $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:
\begin{equation}
({\Delta\hat{A}})^2({\Delta\hat{B}})^2 \geqslant |\frac{1}{2i}\Big[\langle\psi|\hat{A}\hat{B}|\psi\rangle - \langle\psi|\hat{B}\hat{A}|\psi\rangle \Big]| =|\frac{1}{2i}\Big[\langle\hat{A}\hat{B}\rangle - \langle\hat{B}\hat{A}\rangle \Big] |=|\frac{1}{2i}\langle[\hat{A},\hat{B}]\rangle|
\end{equation}
So the dispersion in any two hermitian operators is related to their commutator
\begin{equation}
({\Delta\hat{A}})^2({\Delta\hat{B}})^2 \geqslant|\frac{1}{2i}\langle[\hat{A},\hat{B}]\rangle|
\end{equation}
I suppose that you could measure the dispersion of two observables with increasing accuracy to find some upper limmit on their commutator.
Note that this work for any two observables you like to use, not just canonical ones like X and P.