Optimal locomotion of micro-organisms (on a small Reynolds number flow) can be regarded as a sub-riemannian geometry on a principal bundle with a mechanical connection. Aiming at robotic applications, flagella are modeled as concatenated line segments with variable hinge angles. As an example, we consider E.~Purcell's 2-hinged animat \cite{Purcell}, the simplest configuration capable to circumnvent Stokes flow reversibility.