JAR Template Zero Tracker Odom

I was looking at the zero tracker odom setup in JAR template. Looking at this screenshot,


Would you set the distance based on the actual drive, the motor, or a wheel?

That’s just the distance from the center of the robot to your tracker (which in this case is the drive wheels on the right side of your robot).

In practice it’s the width of your drive from center of wheel to center of wheel divided by 2.

1 Like

Looking through the backend code some more, I realized that it’s based on the drivetrain side in general since it uses motor groups.
However, this did give me another, entirely different question: what is the point of the heading PID?

Heading PID keeps the robot facing in the proper direction as it drives.

The drive function uses two PIDs concurrently: heading and drive. It adds them together to keep the robot going straight.

1 Like

ohhh, that makes sense. Thank you!

1 Like

unrelated, but another question about JAR template so I’m just gonna ask here.
What is the point of these functions in util?

float reduce_0_to_360(float angle) {
  while(!(angle >= 0 && angle < 360)) {
    if( angle < 0 ) { angle += 360; }
    if(angle >= 360) { angle -= 360; }
  }
  return(angle);
}

float reduce_negative_180_to_180(float angle) {
  while(!(angle >= -180 && angle < 180)) {
    if( angle < -180 ) { angle += 360; }
    if(angle >= 180) { angle -= 360; }
  }
  return(angle);
}

float reduce_negative_90_to_90(float angle) {
  while(!(angle >= -90 && angle < 90)) {
    if( angle < -90 ) { angle += 180; }
    if(angle >= 90) { angle -= 180; }
  }
  return(angle);
}

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.