2 Wheel robot attaining straight line motion

I am working on a robot that moves in a straight line and rotates (basic left and right).
I am using PID to control the motion.

However I am stuck at using PID. When I want the robot to move in a straight line, should I use two separate PID for the two wheels to count my encoder values and keep track? But I feel that doesn't solve the initial problem of trying to make the two wheels move together.
Left wheel rotation=Right Wheel rotation

Or
Error=Left-Right;
//Adjustments
Left=Left-Error;
Right=Right+Error;

I am using the PID_v1 library as well, so what I am basically looking for is an optimal logic.

It is not clear to me, why you would want to use PID at all, in that context.

To control what ? The speed ? The direction.

Oh, sorry
Basically my motive is to make the robot move in a straight line upto a particular distance.

Say i will command my robot to move 100cm forward. It should move in a straight line till 100cm and then stop.

void updatePID(){
double fwd, rtn; 
rotationLeft=encoderLeft;
rotationRight=encoderRight;
forward_input=rotationLeft+rotationRight;
rotation_input=rotationLeft-rotationRight;
dist.Compute();
fwd=forward_output;
rotn.Compute();
rtn=rotation_output;
md.setM2Speed(-(fwd+rtn));  //right wheel
md.setM1Speed(-(fwd-rtn));  //Left Wheel
}
void forward(double block){   //where 1 block=10cm 
   reset();
  //Sum of the right and left encoders, thus into 2
  forward_setCnt=(block*1194)*2;           //in 10 cm 1194 clock counts theoretically based on my wheel diameter and rotations
  rotation_setCnt=0; 
}

So what I am trying to do here is put two PID loops:

  1. The first one ensures that the robot has moved the correct distance forward.
  2. The other one is to ensure that leftwheelrotation=rightwheel rotation in order to make them move in a straight line. (i.e. not turn left or right)

md is my motor shield which drives my two wheels