Solving $a \sin\theta + b \cos\theta = c$

here is a trick: write $$\frac{a}{\sqrt{a^2+b^2}}\sin(\theta)+\frac{b}{\sqrt{a^2+b^2}}\cos(\theta)=\frac{c}{\sqrt{a^2+b^2}}$$ Setting $$\cos(\phi)=\frac{a}{\sqrt{a^2+b^2}}$$ and $$\sin(\phi)=\frac{b}{\sqrt{a^2+b^2}}$$ then you will get $$\sin(\phi+\theta)=\frac{c}{\sqrt{a^2+b^2}}$$ so $$\theta=\arcsin\left(\frac{c}{\sqrt{a^2+b^2}}\right)-\phi$$