|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#16
|
||||
|
||||
|
Re: Driving Straight
Quote:
I am only going to be using this outside of auto. During auto we use a gyro. The method i am trying now is to use a velocity control PID for each side. however it would be nice to have a slave/master configuration but i am not sure hot to deal with turning |
|
#17
|
|||||
|
|||||
|
Re: Driving Straight
Quote:
|
|
#18
|
|||
|
|||
|
Re: Driving Straight
We've found LabView compensates fairly well for the drift. We usually see a few degrees per minute, which has been more than accurate enough for our matches. If you need more than that, you can extend the duration it uses to measure the drift.
|
|
#19
|
||||
|
||||
|
Re: Driving Straight
I believe that the CAN bus library has built in PID. All we had to do last year was set it to speed control mode and to read off the encoder.
|
|
#20
|
||||
|
||||
|
Re: Driving Straight
Quote:
|
|
#21
|
|||
|
|||
|
Re: Driving Straight
We used the gyro for driving straight for Auto and during the matches this year. The gyro is the easiest way to make sure you are going in a certain direction. We used the drive straight to drive to the step and drive straight to back up from the step. This way we did not knock over a stack of totes. We had a lance sticking out that we used for auto to move the recycle bins out of the way. If the driver turned while backing up it would move the stack. This function to drive straight back was a huge hit with the drivers.
The NavMXP had very little drift. We left it running for 20 minutes one time and had no drift. Way better than the old kit gyro. If you are trying to drive straight and you have a gyro why would you do it any other way? Tim |
|
#22
|
||||
|
||||
|
Re: Driving Straight
Its important to tune your gyro properly or you'll get noise and drift. 316 ran into this problem last year.
|
|
#23
|
|||||
|
|||||
|
Re: Driving Straight
As with so many things, it's important to understand how much noise and drift you can accept. If you're only using the gyro for autonomous (15 seconds long) or to do short-term maneuvers (like backing up in a straight line without your probe knocking down a stack), you can allow significantly more drift than if you're expecting your "arena coordinates" mecanum drive to be stable through a full 2-1/2 minute match. If you're looking for full-match alignment and can't get it from your gyro or encoders, consider if your strategy puts you up against a wall or other well-defined feature of the field on a regular basis, and see if you can use that as an opportunity for a heading correction.
|
|
#24
|
||||
|
||||
|
Re: Driving Straight
Quote:
|
|
#25
|
|||
|
|||
|
Re: Driving Straight
Quote:
|
|
#26
|
||||
|
||||
|
Re: Driving Straight
Here is a comparison based "drive straight" code example that doesn't use PIDs. It is handy for demonstrations, programming practice, etc. where you need to be able to follow along without getting wrapped up in more advanced functions (such as PIDs) useful, like it was said before, if the user hasn't taken basic calculus. Works like a charm, it may be a little sparsely commented, but just PM me if you have any questions.
FYI: Top encoder is left side, bottom is right side. This code makes the robot REVERSE at 50% speed. (I just pulled it out of one of our autonomous routines). The .06125 constant is "inches traveled/encoder tick" (you will need to update this to accommodate for your drive train reduction between the encoder shaft and the wheels). The 85 constant is the desired distance in inches. You can import this vi code snippet into Labview. Cheers, Skye |
|
#27
|
|||
|
|||
|
Re: Driving Straight
I've seen a number of FLL teams use an approach similar to what I attached. They will have three to five cases where they tune the coefficients or return hard-coded numbers. Sometimes the sensor is an ultrasonic sensor to follow a wall instead of two encoders. Sometimes they reset the sensors inside the loop instead of accumulating.
These approaches work pretty well if the loop runs fast enough. It gives them a piece to tune and once they gain a sense of how the control works, you can add storage and have both integrated and term-to-term error, and pretty soon you have a simple PID, or at least the portion of it that you need for that problem. Since FRC robots take lots of space and infrastructure to run, you may find it useful to use a smaller robot to structure the code, then try it out on an FRC bot. Greg McKaskle |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|