For odometry, one useful article is the article on the Purdue wiki, with assistance from 5225A:
Odometry example code: JAR-Template/src/JAR-Template/odom.cpp at main · JacksonAreaRobotics/JAR-Template · GitHub
As for PID, credit to _Colossus’s post,
I think the pdf document on this link here is very useful:
I would suggest looking at page 12 for what to expect inside of the while loop.
I would refer to the JAR-Template for odometry and PID example code with respective OOP. I think the JAR-Template is an excellent baseline: