<abstract><title><italic>Abstract.</italic></title> A 3DOF mobile Cartesian robotic harvester for two-dimensionally distributed crops such as melons is being developed. A two-step procedure to calculate the trajectory of its manipulator that will result in the maximum number of melons harvested is described in this article. The goal of the first step is to calculate the minimum-time trajectory required to traverse between any two melons while adhering to velocity, acceleration, location, and endpoint constraints. This step is accomplished in a hierarchal manner by solving several subproblems involving optimal control and nonconvex optimization, enabling optimal (maximum) melon harvesting to be formulated as an orienteering problem with time windows. In the second step, the orienteering problem is solved using the moving branch and prune method, based on dynamic programming. This enables suboptimal sequences of melons (out of all options) to be eliminated on the fly without the need to solve the entire problem at once. An example is shown to demonstrate the efficacy of the algorithm.