Autonomous problem help please

Our team noticed that for the same program and measurements, the outcome is not always the same in every try. We do not use any sensors. What’s the reason behind it? :sos::sos::sos:

1 Like

If you are just using telling the motors to run for a specific amount of time there are many factors that could be playing into the fact that your code is not repeatable. These factors can include things your wheels slipping, changes in surface friction, and different battery levels. Something that I am attempting to implement on my robot is something called a PID loop. A PID loop uses sensors to produce repeatable results. I am having some trouble with my own PID loop, but I know it can be done, and I would suggest it.
Check out this thread for more on PID loops.

3 Likes

We do not tell our motors to run for a specific amount of time, instead we use distances, angles and rotations in our program. The problem is that we cannot have sensors due to shipping problems and the competition that is being held very soon. We only use 2 omni wheels in the front of our drivetrain and 2 classic wheels in the back. Could it be the friction of the the classic wheels that is disturbing our program?

1 Like

The internal functions built into vex code can be inaccurate when it comes to things like rotations, and angles. Therefore your problems could be stemming from that. A PID loop could fix these issues by using the internal motor encoders. Our team is using a PID loop for lateral motion we have been able to achieve relative accuracy with just the internal encoders. However, external encoders are more accurate. We are still working out the kinks in our rotational PID.

To more directly answer your question, the friction of the regular wheels could be impacting your code because of slipping that occurs while you are turning. However, I can not say for sure.

It might help to consider where the errors are occurring. Are the inaccuracies largely stemming from turning or do you think they are stemming from lateral motion?

2 Likes

Thank you for trying to help us. I think the problem occurs when the robot turns. Sometimes it does turn more than it is supposed to do, sometimes it turns with a smaller angle. Unfortunately we cannot use pid loops because we have no pid control. Is there any alternative solution we can try.

1 Like

First, off you want to try and make your autonomous with as few turns as possible to minimize error. Also, backing your robot into a wall as a “reset point” may also serve as a good way to minimize error, as error won’t compound as much. Other than that, make sure your robot does not have unnecessary friction anywhere on the base. I don’t know what else you could do in the code without some kind of control loop to minimize error.

What do you mean when you say you have no PID control. Do you not have time to code it? A PID control loop would not take you a long time to code but tuning it and implementing it to accomplish tasks could.

However, a simple ‘P’ loop could fix your errors. This post shows how to code one in PROS, but it could probably be adapted to vex code as well.

2 Likes

Sorry for not being very accurate. When I said that we have no pid control I meant that we didn’t have any sensors to program it.
Also thanks for your help I really appreciate it. We’ll try to minimize the amount of turns in our program as it seems to the only way to get rid of errors.

1 Like

If you use v5 motors you do not need sensors as the v5 motors have built-in encoders. That is what our team has used. While they are not as good as external encoders. The internal encoders would work.

3 Likes

Thank you very much you’re truly amazing. I’ve got one more question. Does it take a lot of time to program a robot using pid loops?
Because we’ve only got 15 days left for the competition
Will that be enough?
and how do we program a pid loop using a v5 motor using
VEX CODE blocks ?

2 Likes

It should not take a long time to code the PID loop. However, I have never tried to implement one into Vex code blocks. If I where you I would try to use a simple P loop or PD loop. It should be accurate enough.

To implement the loop look up some videos on how they work. The forum itself also has many different useful resources. The tutorials specifically for vex are all done in either vex code pro or PROS. Therefore, you will have to do some adapting to code it.

If you do not feel alike you have time to implement a PID, or you feel like you don’t have the right skills. Don’t waste your time on a PID loop 15 days before a competition. Instead focus on optimizing your current autonomous program with the ways I mentioned above.

3 Likes

FYI to anyone using this code (linked in the quote), I forgot to fix the loop exit condition and it won’t let me edit the post on the forums. So if it doesn’t work, that’s probably why. You’re going to need to fix it yourself if you want to work hint hint

2 Likes