Hello, I am trying to incorporate ideas seen in multiple posts (post 1 about rotational feedforward and post 2 about tangential feedforward) to code the feedforward for our turret this year. As I want the turret to stay locked on the target as we move around the field, I think the feedforward will have to take into account the tangential velocity of the robot with respect to the target as well as the rotational velocity of the robot (we are using mecanum drive).
I think I have figured out how to find the tangential feedforward based on the robotâs tangential velocity and distance to the target, and the rotational feedforward would just be the opposite of the robotâs angular velocity.
Also I was thinking I should use the WPILib SimpleMotorFeedforward class along with the SysID tool to make it more accurate.
So I was wondering how exactly to implement all of this together on top of PID control. I was thinking something along the lines of
motorTurret.setVoltage(pidController.calculate(getEncoderVelocity(), setpoint) + simpleFeedforward.calculate(setpoint) + tangentialFeedforward + rotationalFeedforward);
Would this work? Should I be using a velocity or positional PID here? I am pretty new to complicated control stuff like this. Thanks.
-Samuel