This was the algorithm used for Turning Intention control in the transfer thesis