JaciBrunning / Pathfinder

Cross-Platform, Multi-Use Motion Profiling and Trajectory Generation
MIT License
255 stars 78 forks source link

Time step vs. RoboRIO cycle #49

Closed laghai closed 6 years ago

laghai commented 6 years ago

First, thank you for making this available -- it was super easy to add to our FRC robot code with gradle and we had the robot going in minutes.

Please help us understand the relationship between Time Step and RoboRIO cycle time. The command execute method is called pretty consistently every 0.02 seconds. Your example uses the time step of 0.05 seconds.

// Time Step: 0.05 Seconds

Should we try to stick with the standard 50Hz/20ms RoboRIO timing? If we use a larger time step, do you interpolate values for actual time when RoboRIO needs the input values? We haven't dug into the code enough to understand how this works and your guidance would be welcome.

Thank you!

JaciBrunning commented 6 years ago

The time step is how often your control loop is called. Generally, the higher, the better. You can tune it to whatever time period your code is running at, which in the case of timedrobot, is about 0.02. We use 0.05 as the default since pathfinder was written before timedrobot.

laghai commented 6 years ago

Thank you, everything works like a charm.