This contribution shows a geometric optimal control procedure to solve the trajectory generation problem for the navigation (generic motion) of mechanical systems with revolute joints. The mechanical system is analyzed as a nonlinear Lagrangian system affected by dry friction at the joint level. Rayleigh’s dissipation function is used to model this dissipative effect of joint-level friction, and regarded as a potential. Rayleigh’s potential is an invariant scalar quantity from which friction forces derive and are represented by a smooth model that approaches the traditional Coulomb’s law in our proposal. For the optimal control procedure, an invariant cost function is formed with the motion equations and a Riemannian metric. The goal is to minimize the consumed energy per unit time of the system. Covariant control equations are obtained by applying Pontryagin’s principle, and time-integrated using a Finite Elements Method-based solver. The obtained solution is an optimal trajectory that is then applied to a mechanical system using a proportional–derivative plus feedforward controller to guarantee the trajectory tracking control problem. Simulations and experiments confirm that including joint-level friction forces at the modeling stage of the optimal control procedure increases performance, compared with scenarios where the friction is not taken into account, or when friction compensation is performed at the feedback level during motion control.