AdvantageKit w 240 fps Limelight 3Gs

The rest of my code runs at the normal 50hz, but since apparently the Limelight 3Gs can capture and process at 240 hz, it seems like a waste to force it to run at 50 and lose performance. I’m pretty sure one could use “addPeriodic()” on TimedRobot, but this method as far as I’m aware does not exist for LoggedRobot. I don’t want to sacrifice logging, so I’m wondering if there’s an alternative where I can still use replay and get that extra juicy performance.

  1. From my experience the limelight does not actually run at 240 hz detecting April tags. We get around 15 fps at the high resolution and 40 at the low resolution.
  2. If you do manage to get a high fps you could consider running your swerve odometry at a faster rate such as 250 hz. I believe there is an example of how to do this for the advantagekit swerve.
  3. Another solution would be to open up a network table listener which will listen to when the limelight posts data and then updates using that data. That way you update from the limelight as soon as it posts data and can take full advantage of it.
2 Likes

I agree with @KfirNeuman, you can only process reflect taps or color detection at 240hz, 720p apriltag detection only runs at 20fps on my ll3.

1 Like

A few notes:

  • With any standard AprilTag pipeline, you’re unlikely to see framerates higher than 50 FPS (in which case capturing high-frequency data is probably a nonissue).
  • You can use standard thread or Notifiers in AdvantageKit, they just need to be isolated to IO implementations. The data from the thread needs to be synchronized to the main loop cycle for input logging, so you might have an input field which contains an array of pose measurements for example.
  • For NetworkTables specifically, using a thread isn’t even necessary in the first place. The readQueue API provides synchronous access to high-frequency measurements, which can be used in an IO implementation to record every measurement (and skip duplicate frames). I don’t think the Limelight library supports this yet, but the Limelight NT API is quite simple to interface with directly.
3 Likes