Attitude Control for Optimal Generation of Energy From Multiple Energy Sources