The optimal trajectory planning is a problem that needs to be solved in robotic applications. The trajectory is optimally designed in terms of travel time, at the same time must satisfy different constraints such as limited torque, range of movement of joints in workspace and velocity of joints. This paper presents the design of optimized trajectory using genetic algorithm. Being different from previous researches, the reference trajectory is assumed to be the same as the real one. Therefore, the controlled torque is calculated by using the inverse kinematic and dynamic equation of robot. This paper proposes adding the controller when the optimal trajectory planning is designed, the controller torque is caculated from controller outputs. This proposed calculation guarantees the similarity between design and implementation processes. Simulations with different types of trajectories have been done to verify the effectiveness of the proposed approach.