Spacecraft attitude motion planning on SO(3) using gradient-based optimization