Optimal Control: From Variations to Nanosatellites