6. If the function $f(\cos x)=\frac{x}{2}(0 \leqslant x \leqslant \pi)$, then the value of $f\left(-\frac{1}{2}\right)$ is $\qquad$
6. $\frac{\pi}{3} \cdot \cos \frac{2 \pi}{3}=-\frac{1}{2}, f\left(-\frac{1}{2}\right)=f\left(\cos \frac{2}{3} \pi\right)=\frac{1}{2} \cdot \frac{2 \pi}{3}=\frac{\pi}{3}$.