A rectilinear motion of a capsule system along a horizontal rough plane is considered. The system consists of a housing and an internal mass moving periodically along an inclined straight guide rigidly connected to the housing. The friction between the housing and the underlying plane is assumed to be Coulomb's one. The motion of the housing with a periodically changing velocity is investigated. Such a motion may be reversible, in which case the housing alternately moves forward and backward, or irreversible, in which case the housing moves forward or stays at rest and never moves backward. The problem under consideration is the maximization of the distance traveled by the housing for a period with respect to the parameters of the system, for both reversible and irreversible modes of the motion.