A geometric framework for dynamics with unilateral constraints and friction, illustrated by an example of self-organized locomotion. (11th April 2018)