Programming troubleshooting

Trying to help a team troubleshoot the beginning of their autonomous code. The robot is setup with drivetrain and a 1:2 input:output. The driver sprocket on the motor is 32t and the driven sprockets at the wheels are 16t.

The robot is supposed to turn 90° and drive forward, but it overshoots the turn and wiggles back and forth several times before proceeding.

image

1 Like

image

2 Likes

Nice job on that robot.

Anyway, back to the question, I think that your problem is in your robot, not the code (thanks anyway for posting your code). When you have that speedy of a drivetrain, it can cause many inconsistencies, especially in programming.

My solution to that is slowing down the drivetrain so you will have much less wiggle room in your drivetrain. I think that wiggle is due to it trying to get to the angle, and it overshoots it, so it turns the other way, overshoots, and I think you get the point.

I am not 100% sure this will work, so just post if you are still having problems.

3 Likes

yea, as @FRC973 says, not many options when using blocks other than slowing down the turns or writing your own control loop for making the robot turn. Is the robot using a gyro to make the turns or just relying on the motor encoder ?

4 Likes

There is a gyro set up but the code block says “turn right for 90°”.

I had always presumed it uses the gyro for that 90° but now that you mention it, it may be a calculation based on wheel size and drivetrain ratio.

It is slowed down to 25% turn speed and that cleared it up. I wonder if “turn to heading” would behave differently

All of the gyro based turn code uses the same core P controller, so turn to heading would behave the same, If you were using C++, you could adjust the P controller constant, but there is no block to do that, the C++ API has far more functionality than blocks exposes.

4 Likes