FRC 2021 Robot Autonomous code not working

Hello, I am having trouble with my team’s robot running its autonomous code correctly. although this is my second year in robotics, this is my first year doing programming, my team’s head programmer left, and with no one to learn from, I had to roughly learn how to do programming on my own. Now with the back story out of the way. I am needing my robot to do the BLUE path for the layout -

-we plan on starting from going to E6, then B7, and finally C9. We originally planned on having the robot do 90-degree turns to help it navigate through the course, but we found out that the robot doesn’t consistently be able to properly turn 90-degrees all the time. Out of random trial and error, the robot was able to do a roughly 18-degree turn straight towards the second power cell (B7). That is only the good news, the bad news is, most of the time whenever the robot picks up the first power cell (E6) the robot either barely turns or turns too much. the problem with it is that I don’t even change anything in the code, it just does it randomly. to make things worse is that the robot doesn’t have a gyro-sphere, so all I have for the robot to turn is the motors’ speed and how long they go for.


  1. this is my first time doing programming (I don’t know that much)
  2. I am unsure on how to be able to get the robot to be able to turn either the 90-degrees or the 18-degrees consistently

Hi there! Welcome to the wonderful world of programming. Based on your comments, here is a couple options that might be beneficial to you:

Gyroscope addition: Adding a gyroscope would greatly improve your ability to turn precisely. The NavX is a really great system to use, and has been preforming well for use for a long time.

WPILIB Trajectory: You could definitely look into using the WPILIB motion profile trajectory tutorials, located here. You can also find an example project or two here. Many have said in the past that their strategy to tune profiles involves first determining a kV and kA for the robot, getting a path mostly correct, then tuning the rest with PID. We were able to get fairly consistent results with only a kV and kA, so this might be an option that requires no extra hardware if you currently don’t have encoders on your drivetrain. A warning though, it could take substantial tuning which can be difficult for beginners.

Camera Driving: You can always set up a camera based system. The robot gets turned most of the way towards the direction of the next ball, then it re-aligns itself with the ball before driving towards it. Heck, you could even align as you are driving towards it.

The Reality of the Situation
If your goal is to completely solve this by the deadline this coming Thursday, April 8, 2021 (for those of you in the future looking back on this, I see you,) it’s going to be a lot of work. It’s not impossible, but any solution that requires hardware you don’t already have will be nearly impossible to get, given it’s a two day turn around and there’s a pandemic wrecking havoc on logistical infrastructure. You honestly might be better off focusing your energies on getting higher scores in other categories or continuing to adjust powers. However, I openly support follow up queries if you do choose to go down one of the above routes.

Follow up questions:
What type of drivetrain/motors/motor controllers are you using?
What sensors are both on your robot and functional?
How big is your intake?

Hello again, thank you for the advice, earlier today my team found a problem with our transmission so that could be the problem. if it’s not that then we would be using your advice for next time we might have a problem again. to answer your questions, I believe our drivetrain is a trimotor, I could be wrong on what it is called, but we have 3 motors on each side for driving. for your second question, we don’t have that many sensors on our robot, for the ones that are on it, they don’t really help very much with navigating. And finally, for your final question, our intake has a lot of room for the balls to enter, I think I can guarantee that the intake is not the problem.
Again, Thank you for the help.