Odometry Refresh

Hello. I am currently trying to make an odometry system. There is one part that I am stuck on: How to make the system refresh every 10 milliseconds. I am trying to put a while loop outside of the autonomous, preauton, and user control. The picture below is what I am trying to refresh every 10 milliseconds. Any help will be greatly appreciated.

You can just do this:

while(true){
    //insert your odom code here
    this_thread::sleep_for(10);
}
1 Like

This error pops up. Am I doing something wrong? image

This needs to be inside a function. I recommend making one for odom. So your code will look something like this:

void odom(){
  while(true){
    //insert your odom code here
    this_thread::sleep_for(10);
  }
}
2 Likes