Dynamical systems and optimal control. A friendly introduction.