Assistance requested to implement a steering PID on a differential drive rover

Thank you for taking the time to answer. Your efforts are really appreciated.

To control the rover I actually write 2 values to the motor controller. As the motor controller is setup on MIXED MODE the first command sets the forward and reverse speeds of the 2 motors. So a write value of 0 is 100% reversed, 90 is stop and 180 is 100% forward. I generally drive forward at 120.

The second command controls the speeds of the 2 wheels to create a turn.
0 stops one wheel and turns the other at 100%, 90 is straight ahead with both wheels and 180 turns the other way. I tend not to reverse the motors as I do not need to pivot.
As the differential steering is very very positive and the wheel base is short on this rover I tend to keep the turning commands to between 60 and 120 otherwise it turns too fast and unsettles the compass.
Example enclosed

   if (turnDirection == straight)
               {
               forwardSpeed = 115; 
               forwardBackMotor.write(forwardSpeed);
               turn = 90;;
               leftRightMotor.write(turn);
               }
               

    if (turnDirection == left)
               {
                forwardSpeed = 115;   
               forwardBackMotor.write(forwardSpeed); 
               turn = 130;
               leftRightMotor.write(turn);
               }  
     
    if (turnDirection == gentleLeft)
               {
                forwardSpeed = 115;   
               forwardBackMotor.write(forwardSpeed); 
               turn = 100;
               leftRightMotor.write(turn);
               }  
                   
     if (turnDirection == gentleRight )
                {
                forwardSpeed = 115;    
                forwardBackMotor.write(forwardSpeed); 
                turn = 80;
                leftRightMotor.write(turn);
                }    

      if (turnDirection == right )
                {
                forwardSpeed = 115;    
                forwardBackMotor.write(forwardSpeed); 
                turn = 50;
                leftRightMotor.write(turn);
                }

I have also programmed relationships between the heading error and the turn commands.

    // calculate which way to turn to intercept the targetHeading
    if (abs(headingError) <= HEADING_TOLERANCE)      // if within tolerance, don't turn
      turnDirection = straight; 
       
      else if (headingError < -30)
      turnDirection = left;

     else if ((headingError < -5) and (headingError >= -30))
      turnDirection = gentleLeft;
      
    else if (headingError > 30)
      turnDirection = right;

     else if ((headingError > 5) and (headingError <= 30))
      turnDirection = gentleRight;
    
 //   else
 //     turnDirection = straight;

This is all working well but it is a little basic and jerky.

I have never implemented a PID so I currently can not quite see all the steps required to get it working.

I have copied recently the PID basic example into my code but I am not sure if it is working.

I would appreciate if you can show me the actual lines of Arduino code that are required. Once I get it once I will
be able to do this on my own in future. Its just the first time that is the difficulty.

Also if there is a better way to drive a straight line I would appreciate the guidance. What ever the "best" way I still want to implement a PID so I can really understand what is going on

Many thanks

Max