Robot manipulation has been an interesting topic for researchers over decades. While researches are going on, different problems occurred. One of the most important problems is energy consumption. Because operation time of mobile robots is fully related with energy consumption. In this study two main problems are taken into consideration, first one is minimization of energy consumption and second one is obstacle avoidance. For this purpose, a simple robot manipulator with two degrees of freedom is chosen. The objective function is selected as a function of applied torque values at the joints, minimization of objective function, results in minimization of motor currents. The algorithm checks if there is a contact between the obstacles and the manipulator, while the algorithm is searching for the trajectory polynomial that requires minimum energy consumption. Finally, the algorithm finds the trajectory polynomial that contains no contact between the manipulator and the obstacles, also minimizes energy consumption.