There have been a few requests for field centric X-drive code in the past couple of weeks. I’ve linked to an old RobotC example, but I revised that code today for my demo drivetrain and pushed out to github. My drive uses 8 motors, but it should be easy to revise the code for four. Obviously, it needs a V5 Inertial sensor to run.
in the first line. you cannot update ctrl_fwd as it’s used in the second line, so temp holds the value that will be used for ctrl_fwd after the next calculation is done.