We consider a kinematic model of a spherical robot on an inhomogeneous surface. We study a problem of the optimal motion of the robot from a given initial configuration to a given final one. The problem is formulated as the problem of optimal rolling of a sphere on a plane with a given external cost. The external cost describes the landscape and encodes the inhomogeneity of the surface. We apply a necessary optimality condition — Pontryagin maximum principle, and characterize the extremals. Finally, we present an example of the rolling along the extremal trajectory, obtained via an interface developed in Wolfram Mathematica.