Field-Oriented Driving Question

Hello, our team is using field-oriented driving this year, and I just had a quick question. How does the robot determine what direction it considers “down-field” is this simply a gyro angle of 0? Thus when we reset the gyro, whichever direction the robot is facing will be considered downfield?

If this is the case, then how are teams planning on managing the fact that their robots will not be facing downfield when the match starts if they plan to start right up against the hub? Will drivers need to manually zero the gyro to be “downfield” once teleop starts? Or would it be better to only zero the gyro in robotInit(), so that the drive team can turn on the robot while it’s facing downfield and then afterwards turn the robot to face the hub?

I’ve thought of this as well, and it would seem that the WPILib odometry classes handle this. Reset odometry to a certain pose regardless of gyro heading, and the odometry class will handle offsetting it. (If I remember correctly, that’s the gyroAngle param on the reset method.)

1 Like

There are a couple of strategies I can think of off the top of my head… One is to place at known angles for each auto and have it set the gyro angle to a specific angle. Another is to place it downfield turn it ion then move it to the autonomous position.

1 Like

We setup our autonomous commands to always set the robot pose (x,y,theta) to that of the initial state our the autonomous trajectory. The concerns I have this year will be making sure the drive team is properly angling the robot on the field. I think we will probably use the tape on the field as a guide as that angle is known and should be “close enough”, and then drivers will maintain the option of resetting the gyro manually when the robot is squared up if it gets off.

1 Like

We do our field-relative driving using the NavX heading ± an offset, and our autonomous routines start with a command to initialize that offset based on the expected orientation of the robot when the match starts. It’s working well.

(similar to Bmongar’s approach)

2 Likes

Ah, that makes sense. We might try doing it this way, thanks for the tip!

Good! Ping me if you need more details!

Good luck this season!

1 Like

Thanks, good luck to your team as well! :slight_smile:

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