need help to improve my project

I am building a ultrasonic based human following tri wheel robot.
i have used three ultrasonic sensor to detect presence of human at angles of 45, 90,135 degrees.
a l298d motor drives turns two dc motors.the front wheel is a caster wheel.
the project is done and working but not prefect.
can anyone help me in improving my project.

#include <Servo.h>
#include <NewPing.h>2
NewPing sonar_left(6, 7, 200);
NewPing sonar_front(8, 9, 200);
NewPing sonar_right(10, 11, 200);
int motor1_1 = 2;
int motor1_2 = 3;
int motor2_1 = 4;
int motor2_2 = 5;
void setup() {

  pinMode(motor1_1, OUTPUT);
  pinMode(motor1_2, OUTPUT);
  pinMode(motor2_1, OUTPUT);
  pinMode(motor2_2, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  delay(50);
  unsigned int dist1 = sonar_left.ping_cm();
  Serial.print("dist1: ");
  Serial.print(dist1);
  Serial.println("cm");
  delay(50);
  unsigned int dist2 = sonar_front.ping_cm();
  Serial.print("dist2: ");
  Serial.print(dist2);
  Serial.println("cm");
  delay(50);
  unsigned int dist3 = sonar_right.ping_cm();
  Serial.print("dist3: ");
  Serial.print(dist3);
  Serial.println("cm");
  if ((dist1 > 0) && (dist1 < 100)) {
    turn_left();
  }
  if ((dist2 > 10) && (dist2 < 100)) {
    move_forward();
  }
  if ((dist2 > 1) && (dist2 < 10)) {
    move_backward();
  }
  if ((dist3 > 0) && (dist3 < 100)) {
    turn_right();
  }
  if ((dist1 == 0 || dist1 > 100) && (dist2 == 0 || dist2 > 100) && (dist3 == 0 || dist3 > 100)) {
    mstop();
  }
}
void move_forward() {
  Serial.println("moving forward");
  digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  digitalWrite(4, HIGH);
  digitalWrite(5, LOW);
  delay(500);
}
void move_backward() {
  Serial.println("movingbackward");
  digitalWrite(2, LOW);
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  digitalWrite(5, HIGH);
  delay(500);
}
void turn_left() {
  Serial.println("turning left");
  digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, HIGH);
  delay(500);
}
void turn_right() {
  Serial.println("turning right");
  digitalWrite(2, LOW);
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  digitalWrite(5, LOW);
  delay(500);
}
void mstop() {
  digitalWrite(2, LOW);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  delay(500);
}

the project is done and working but not prefect.

So what is wrong ?

The code would be easier to understand if you gave the distances more meaningful names.

UKHeliBob:
So what is wrong ?

first of all the ultrasonic sensor does not continuously detect the presence. i tried changing them but same problem.
second, once detected after the motor moving it stop even when the person is in front of the sensor.

UKHeliBob:
The code would be easier to understand if you gave the distances more meaningful names.

#include <Servo.h>
#include <NewPing.h>2
NewPing sonar_left(6, 7, 100);
NewPing sonar_front(8, 9, 100);
NewPing sonar_right(10, 11, 100);
int motor1_1 = 2;
int motor1_2 = 3;
int motor2_1 = 4;
int motor2_2 = 5;
void setup() {

  pinMode(motor1_1, OUTPUT);
  pinMode(motor1_2, OUTPUT);
  pinMode(motor2_1, OUTPUT);
  pinMode(motor2_2, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  delay(50);
  unsigned int dist_left = sonar_left.ping_cm();
  Serial.print("dist_left: ");
  Serial.print(dist_left);
  Serial.println("cm");
  delay(50);
  unsigned int dist_front = sonar_front.ping_cm();
  Serial.print("dist_front: ");
  Serial.print(dist_front);
  Serial.println("cm");
  delay(50);
  unsigned int dist_right = sonar_right.ping_cm();
  Serial.print("dist_right: ");
  Serial.print(dist_right);
  Serial.println("cm");
  if ((dist_left > 0) &&(dist_front==0)&&(dist_right==0)) {
    turn_left();
  }
  if ((dist_front > 10) &&(dist_left==0)&&(dist_right==0)) {
    move_forward();
  }
  if ((dist_front > 1) && (dist_front < 10)) {
    move_backward();
  }
  if ((dist_right > 0) &&(dist_left==0)&&(dist_front==0)) {
    turn_right();
  }
  if ((dist_left == 0 ) && (dist_front == 0 ) && (dist_right == 0 )) {
    mstop();
  }
}
void move_forward() {
  Serial.println("moving forward");
  digitalWrite(motor1_1, HIGH);
  digitalWrite(motor1_2, LOW);
  digitalWrite(motor2_1, HIGH);
  digitalWrite(motor2_2, LOW);
  delay(500);
}
void move_backward() {
  Serial.println("movingbackward");
  digitalWrite(motor1_1, LOW);
  digitalWrite(motor1_2, HIGH);
  digitalWrite(motor2_1, LOW);
  digitalWrite(motor2_2, HIGH);
  delay(500);
}
void turn_left() {
  Serial.println("turning left");
  digitalWrite(motor1_1, HIGH);
  digitalWrite(motor1_2, LOW);
  digitalWrite(motor2_1, LOW);
  digitalWrite(motor2_2, HIGH);
  delay(500);
}
void turn_right() {
  Serial.println("turning right");
  digitalWrite(motor1_1, LOW);
  digitalWrite(motor1_2, HIGH);
  digitalWrite(motor2_1, HIGH);
  digitalWrite(motor2_2, LOW);
  delay(500);
}
void mstop() {
  digitalWrite(motor1_1, LOW);
  digitalWrite(motor1_2, LOW);
  digitalWrite(motor2_1, LOW);
  digitalWrite(motor2_2, LOW);
  delay(500);
}

i have used three ultrasonic sensor to detect presence of human at angles of 45, 90,135 degrees.

The three ultrasonic sensor will detect SOMETHING at 45, 90, or 135 degrees, but they can not tell you that the something is human or that it is moving or that it is, or is not, the thing you want to follow.

first of all the ultrasonic sensor does not continuously detect the presence.

Well

of

course

not.

Why are you burying your head in the sand all the time? GET RID OF ALL DELAYS!

  if ((dist_left > 0) &&(dist_front==0)&&(dist_right==0)) {
    turn_left();
  }

Please explain, in English, what need to happen, in terms of where the human is, in order for the robot to turn left. Keep in mind that the sensors did NOT measure the distance to a human. Also, keep in mind what a distance of 0 really means.

You ARE aware of what a distance of 0 means, right? That is, of ALL the things that a distance of 0 means.