How to implement motion profiling with a turn?

So I was wondering how I could implement feedback with a set motion profile. This is my current code ( just for feedback on the left motor) :

    double errorL = setpointL.position - Robot.encLeft.getDistance()*0.3048; // calculate error, convert to meters
    double error_derivL = (errorL-error_lastL)/dt - setpointL.velocity; //derivative error minus setpoint velocity 


I got these calculations by watching Cheesy Poof’s 2015 talk on motion profiling. How can this take care of when the robot is turning though since the error is only using the position and not the angle given by the gyro…?

If you want to do just a controlled rotate In place you can use a gyro signal in place o of the encoder, or use encoders on both sides. You would need either encoder (gyro optional) for a full motion profile. If you are using talon SRX’s check out the code examples at CTRE.

We use 2 encoders(average of the two for distance ) plus a pigeon for heading control and it works very well. Our code is modeled after the CTRE motion arc profile example code.