Rotating Robot using Limelight

Currently our team has a Limelight running at 90 fps, and uses it to rotate the robot to the target. Sometimes, when attempting to get the robot to turn faster to reach the setpoint (PID), we notice some oscillation around the setpoint. I think it is due to the latency and/or update time of the limelight data. Would it be preferable to convert the data from the limelight into a gyro angle and use the gyro to turn? If so, how would I go about doing that?

Did you try to increase the KD first?

We did, and eventually it led to overdamped movement that didn’t turn the robot very fast.

The limelight is way faster than anything else on the robot (the main loop runs at 50hz). The oscillations are likely from either a poorly-tuned PID or target hunting. We were having similar issues due to the latter; as the robot turned, the limelight would switch targets to another one of the tape strips.

3 Likes

At 90 fps and the limelight latency, there should be a combination of Kp and Kd that works…
Using the limelight to define a wanted gyro angle and closing the error based on gyro, will have lower latency… leading to easier tuning. But it adds other issues.
Now… That there is no time pressure, maybe try both options?

1 Like

Another possible option is to increase your tolerance band- a 4ft target is pretty big.

1 Like

Ohh forgot another important thing… Usually you will need to add Ks… to cancel the effect of friction
Ks is the minimal power to the motor to start moving
Multiply the ks by the sign of direction of the wanted velocity

3 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.