2. The range of the function $f(x)=\arctan x+\frac{1}{2} \arcsin x$ is
A. $(-\pi, \pi)$
B. $\left[-\frac{3 \pi}{4}, \frac{3 \pi}{4}\right]$
C. $\left(-\frac{3 \pi}{4}, \frac{3 \pi}{4}\right)$
D. $\left[-\frac{\pi}{2}, \frac{\pi}{2}\right]$
The function $f(x)$ is an increasing function defined on the interval $[-1,1]$, and $f(-1)=-\frac{\pi}{2}, f(1)=\frac{\pi}{2}$, which means the range of the function $f(x)$ is $\left[-\frac{\pi}{2}, \frac{\pi}{2}\right]$. Therefore, the correct choice is $D$.