Text this: Nonlinear optimal control of the planar inverted pendulum