<span>This paper deals with implementing the tuning process of the gains of fractional order proportional-integral-derivative (FOPID) controller designed for trajectory tracking control for two-link robotic manipulators by using a Bat algorithm. Two objective functions with weight values assigned has been utilized for achieving the minimization operation of errors in joint positions and torque outputs values of robotic manipulators. To show the effectiveness of using a Bat algorithm in tuning FOPID parameters, a comparison has been made with particle swarm optimization algorithm (PSO). The validity of the proposed controllers has been examined in case of presence of disturbance and friction. The results of simulations have clearly explained the efficiency of FOPID controller tuned by Bat algorithm as compared with FOPID controller tuned by PSO algorithm. </span>