Quote:
Originally Posted by jwakeman
Thanks for the help everyone. I put together the subclass that Alexander described and will post it here in case it helps anyone else. It does compile but hasn't been tested in any way. ...
|
You just described what I want to do this year with our robot. We are also going to use an elevator and we want to use the Distance function of the Encoder for a PIDSource.
I have tried for 2 years to use the PIDSource class to drive our robot a certain distance with the encoders and failed each time. I always run out of time, and I, still after 2 years of beating through the C++ code, do not understand classes completely. I muddle through.
This year me and the students HAVE to figure this out in order for the robot they designed to work correctly, so needless to say, I am very interested in this thread.
How do you use your above PIDEncoder in the robot main code to get the elevator to stop at the correct distance? I see the class and that looks nice but I don't know how to use it. If you want to PM me to keep "spoilers" away that's fine, though honestly I guarantee you there are many students and mentors out there running into the same problems.