I am looking for advice on how to program our robot to shoot while moving. Our robot has a turret flywheel shooter with an adjustable hood. We can already shoot while stationary by using the limelight to determine the angle and distance to goal (and thus flywheel speed, turret angle, and hood angle; we have done tests to determine the ideal flywheel speed and hood angle for several distances and we interpolate the rest). I would like to incorporate the robot’s velocity into consideration when determining these three variables.

As for thinking of this as a physics problem, we know the robot’s distance from the goal (determined by limelight & some code utils), as well as the robot’s velocity (determined by WPILib’s `ChassisSpeeds`

class). What makes this problem difficult is how little information we have about the ball. Since its launch speed, angle, and time in the air are all determined by the distance to the goal (which determines flywheel speed and hood angle), I’m thinking I could have another data table that relates distance from goal to time in the air. Given these quantities, I could determine the turret angle that should result in the ball going in the direction of the goal.

However, even if the ball is now going in the right direction, it will still overshoot or undershoot the goal if the robot’s velocity component in the y direction is nonzero. I have also realized that adjusting the flywheel speed or hood angle to counter this problem would alter the ball’s time in the air, which would mess up my earlier calculations.

Does anyone have suggestions as to how I should alter my approach? I am trying to avoid getting too deep into the physics of the ball (launch speed based on flywheel speed and friction, Magnus effect, etc) as I worry any approach I could take would be oversimplified and inaccurate. But if the only way forward is to investigate this approach, that would be useful to know as well.

Any advice and help would be appreciated! Thank you : )