Aiming and trajectories

My team is trying to use trajectories for the first time but we don’t have a turret so we have to physically turn our robot to aim with our limelight. Will our robot move to the wrong place following the next path after it aims itself, or will it compensate for the slight rotation? (The robot isn’t built yet so I can’t test but I’d like to work on the code in the mean time)


1 Like

There are two choices you could do for auto (I’m assuming your talking about trajectories for autonomous).

  1. You could not use limelight to aim and just trust trajectory. This should usually work pretty well and is arguably better than using the limelight, since the limelight could see a weird reflection.

  2. This depends on how you implement the trajectory follower, but you should be able to just drive to the next trajectory as long as you don’t reset the robots pose in between.

so for 2. if the robot was in the same position just at a different rotation, it would correct for it and then follow the path?

This once again depends on your implementation, but if you don’t reset your pose with every path then, in theory it should work.


One thing you can do is after the shot run a turn to angle command that puts you at the expected angle for the next leg of the trajectory


Our experience with exactly this situation was that the error induced by the autoaim was not worth dealing with. However, our trajectory implementation resets odometry each time, so any offset would affect following paths. Attempting to follow a trajectory at all without resetting odometry led to highly unpredictable (not following trajectory) behavior. We ended up just trusting the aim of the trajectory, while still using the limelight to adjust shooter RPM. There is probably a better solution, as I was in “get it working as fast as possible” mode at the time.

1 Like

The Ramsete controller should handle this error. You shouldn’t count on it though, so I would make the next trajectory start with the angle you expect to be shooting at, or turn to the starting angle before following the path.

1 Like

We run multiple paths with two different LimeLight aiming steps added. We do not reset odometry. The ramsette controller will adjust for deviations between current heading and path heading.

In this video, we are blue on the far side. First trajectory is drive straight back. You’ll see the robot steer right at the end before firing. That’s the aim step. We then run three more paths and there is one more aiming step at the end. It will adjust to the right again before firing.

Not sure if this is the most efficient way to add aiming but it worked for us.

We use this code for aiming.

FRC 4451

1 Like

What about setting the next path to start with the robot facing the goal? Assuming your auto aiming is accurate enough it should be at an angle facing the goal when it’s done shooting.

You could also trust the trajectory following will be close enough and just calculate distance to goal using the robot x,y and goal location. This will also give the drivetrain the angle it needs to turn to. Then turn back the direction you wanna drive before starting next path.


If you have a navx or other gyro you could store the angle before you auto aim and then after turn back to that angle. The. Resume the trajectory.


Thanks so much everyone! I’m going to try all of the suggestions to see which one works best!!!

We didn’t find this was accurate enough or repeatable for a 5 ball routine. We did use this strategy for a 2 ball routine.

For 5 ball, it was easier to square the robot to the TARMAC line directly in front of the CARGO by the side wall. This position was offset from center of the hub so we had to turn slightly to aim. After driving all the paths, the final pose angle was aimed to the goal but it was not tuned tight enough to be accurate. One final LimeLight adjustment fixed it.

Basically, the aiming step takes a bit more time in the routine. Our thought was the extra aiming time to increase accuracy was worth it.


Sorry, I realize I was vague, yeah I think you for sure want to use the limelight (that’s what I meant by autoaim) but could have the next path setup to assume the robot would be aimed at the goal for it’s starting pose.

I am also naive on this subject as we have not used a differential drive since 2015 so I am not familiar on how exactly the path following is setup. Unless this is swerve then I think the method above would would quite well.

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