Due to their compliant structure, industrial robots without precision-enhancing measures are only to a limited extent suitable for machining applications. Apart from structural, thermal and bearing deformations, the main cause for compliant structure is backlash of transmission drives. This paper proposes a method to improve trajectory tracking accuracy by using secondary encoders and applying a feedback and a flatness based feed forward control strategy. For this purpose, a novel nonlinear, continuously differentiable dynamical model of a flexible robot joint is presented. The robot joint is modeled as a two-mass oscillator with pose-dependent inertia, nonlinear friction and nonlinear stiffness, including backlash. A flatness based feed forward control is designed to improve the guiding behaviour and a feedback controller, based on secondary encoders, is implemented for disturbance compensation. Using Automatic Differentiation, the nonlinear feed forward controller can be computed in a few microseconds online. Finally, the proposed algorithms are evaluated in simulations and experimentally on a real KUKA Quantec KR300 Ultra SE.