I honestly have no idea where to even start when programming a robot with this functionality. I have looked all over the forums and the internet and I can’t find anything useful. Could someone possibly help me program a field-oriented robot? Thanks in advance.
essentially having read the ‘forward’, ‘turn’ and ‘right’ (ie. strafe) values from the joystick you rotate them in this way before sending to the drive motors.
// Get gyro angle in radians
theta = degreesToRadians( GyroGetAngle() );
// rotate coordinate system
temp = forward * cos(theta) - right * sin(theta);
right = forward * sin(theta) + right * cos(theta);
forward = temp;
So I have been going through the code that you have posted on Github, and I am honestly lost. I am not the best programmer in the world, so I apologize if I don’t understand. I am trying to incorporate the field-oriented code into the existing code I have below. I believe that I understand what the code that you provided me with means, but I am just unsure of how I would incorporate it into my mecanum drive code so that it works seamlessly. Could you please help out me and point me in the right direction? Thank you very much.