Thanks for sharing more about your life! I hope you have a great year, and think that it’s very good to be thinking about the future, past these exams. I do know that there is a whole lot of pressure though. I do wish you the best success on the exams and in your college applications.
The point of doing field oriented is to make the robot easier to drive. What it is really doing is translating the inputs from the operator controls. Without field-oriented, moving the controls forward makes the robot move toward it’s front. With field-oriented, the robot will move toward the far end of the field, no matter which way it is facing.
To give a specific example, if the robot is turned so that it is facing the left side of the field, and there is no field oriented control, the operator has to know to command the robot to drive right, in order to move toward the far end of the field. If field-oriented control has been implemented, the operator moves the controls toward the far end of the field and the robot moves that way, no matter which way is it facing.
So, the robot does not have a head, the field has a far end. I hope this makes sense. If it does not, let us know.
If everything works as you expect when you are not using field-oriented, there’s not a whole lot more to get working in order to have this also work. But, if the robot does not drive properly when not using field-oriented, it is probably better to take care of that first, before mixing in field-oriented control.
Take a look at the link I posted before about the coordinate system for the robot. This is one area that can be confusing. Also, the inputs from many controllers are not matched up with these coordinates. So, you may have to do a transform the raw inputs from the joystick or game controller you are using. Here is a comment from the code on the swerve robot for a team I have been mentoring:
// The robot’s frame of reference is the standard unit circle, from
// trigonometry. However, the front of the robot is facing along the positve
// X axis. This means the poitive Y axis extends outward from the left (or
// port) side of the robot. Poitive rotation is counter-clockwise. On the
// other hand, as the controller is held, the Y axis is aligned with forward.
// And, specifically, it is the negative Y axis which extends forward. So,
// the robot’s X is the controolers inverted Y. On the controller, the X
// axis lines up with the robot’s Y axis. And, the controller’s positive X
// extends to the right. So, the robot’s Y is the controller’s inverted X.
// Finally, the other controller joystick is used for commanding rotation and
// things work out so that this is also an inverted X axis.
Again, get the controller inputs to work as you expect without field-oriented control, then add this in. The control inputs for X and Y are normally transformed by applying a rotation that offsets the direction the robot is facing. The control input for rotation does not normally have to be altered in any way for field-oriented control.