Development of Guidance Laws Updated in Real Time for Optimal Control of Spacecraft Attitude