Running trajectory following offboard/at a higher loop rate

Are there any significant advantages in running the RamsetCommand or its PID loops at a higher loop rate / offboard, if it’s possible?
We’re using the WPILib Trajectory lib, SparkMaxes as drivetrain motor controllers, and a navX for gyro. I tried creating a class to convert between the WPILib PIDController and Rev’s CANPIDController so I could offload the PID loops, but I got stuck, as the effects are different (WPILib’s returns an output, Rev’s activates the motor).
Any ideas/tips about this?

Depends on how fast your robot dynamics are. A flywheel that can reach its target speed in 20ms, for example, definitely benefits from updating at a faster rate. Drivetrains can happily run at 20ms update rates though. In fact, the default period of PIDController used to be 50ms, which is longer than the default TimedRobot update period. No one noticed.

A related question: Is it possible to run a command at a higher loop rate?
Since Commands are executed by CommandScheduler I would guess that it isn’t, not without running the whole robot at a higher loop rate, which isn’t neat.

So there aren’t advantages to running it at a higher rate?
And if the Ramsete/PID is running at 20ms, does updating the odometry faster change anything? It seems a bit of a waste running at 50hz if both the navX and the SparkMaxes can run faster…

And on a different note, does navX firmware upgrade change anything?

It’ll run at whatever rate you call at. If you increased TimedRobot’s update rate, your commands would be run at a higher rate. If one of those commands does controller updates for a fast-moving mechanism, that might be a good idea. Idk.

For a drivetrain, usually not. It depends on your team’s performance criteria. If you’re 971, you care more because you need fast, consistent updates to maintain tight controller tracking and keep your observer estimates clean. Again, the definition of “good enough” varies by team.

You might get marginal improvements in accuracy, but it might not be enough to be worth it. Use the simplest thing that’ll meet your desired performance specifications.

Idk. I don’t use the navX.

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