Per a great suggestion on here, our team generates a trajectory at runtime to help us ‘backtrack’.
We use our vision system to drive us to the ball, and then taking the starting pose, and our ending pose (no points in between), generate a trajectory.
This works great. However I’ve noticed some latency on the call to do this. It seems that it takes the TrajectoryGenerator’s generate function at least a second to run, which normally isn’t a big deal, but we are in a stage where seconds matter!
Is that normal? Even though its more or less generating a straight line I’m assuming its a fairly complex calculation. Does anyone have any experience with this?
Are you generating any trajectories at robot startup? Typically the first call to TrajectoryGenerator takes longer but once the JIT compiler kicks in most calls are <100ms. Someone did a benchmark test on the roborio and posted about it recently, if anyone wants to find the post.
If you’re not generating any trajectories before you run your auto, I would try generating a dud trajectory during robotInit so that the JIT compiler can optimize future calls.