A friend and I have been working on autonomous mode programming (we’re both rookies with no background) and have just gotten pretty good at dead reckoning. We have decided to use the Hall-Effect sensors and gyros to make it more accurate. But we have no idea where to start the programming for either of these. We’re not even sure which inputs to put them in. Any help would be great. Example code and description in english would be the best. Thanks a lot.
We’re in the same position. We were going to use the CMUcam, but we fried it last night.
Start with the examples Kevin Watson has generously provided at http://kevin.org/frc/
Then hit the ChiefDelphi threads.
We already have that code and we’ve been searching on the forums but we still aren’t having much luck. As I said before neither of us has any background in programming and are learning as we go. Any help is much appreciated. We would really like the basics of the code functions we need to use.
Yes it can be overwhelming. I just sent this message to another rookie team who asked for assistance:
Our team has not used the hall effect sensors but the programming should be very similar to the encoder code found in Kevin Watson’s code library.
The encoder project and the navigation project (if you have a gyro) have the best examples of encoder (or just counting) programming.
In the file encoder.c the Handler routines need to be changed if you do not have two sensors on each side as described in this thread:
Read this thread and at least the most recent of the other ones when you do a search for hall effect sensors in the CD forums. They have a lot of useful information.
You would need to change the if statement to only count up if all of your moves are forward, or sense the direction you told each side to move instead of the second input value.
In your main autonomous code (or for testing, your regular processing also) you can then call Get_Left_Encoder_Count() and Get_Right_Encoder_Count().
Average the values to get distance traveled, take the difference to get an approximation of turning. If you keep speeds low enough that you don’t have wheel slippage you should end up fairly close to where you want to go.
We’ve made our own encoders last year using optical sensors and a slotted disk, this year we bought encoders from USdigital.com. In 2003 we just did moves by setting joystick input variables to a desired value for a desired amount of time (based on a counter in the autonomous code). It didn’t work every time, but at least we were on our way to where we wanted to be instead of standing still. Sometimes it even worked great!
Good Luck!
Thanks for your help, I think we’re going to have to settle with a counter for our first year. We were hoping to get the hall effect up and running, but I don’t think we’re going to actually be able to get them working on time. We were working with the counter, but turning was our biggest problem. It being very hard to measure a turn on different surfaces with wheel slippage and all. Hopefully we can do it on carpet and get it working atleast somewhat well. Any tips would be greatly appreciated. Thanks.
The sensor should be very straight forward to read (encoder but easier). Please post your most recent code and others might be able to help. We have the hall effect working well with +/- 5 cm error (which will hopefully be lower).
Remember to create a test setup with the Hall effect sensor 2 cm away from a sprocket to verify the sensor readings indpendent of your moving robot. Attempt to do this before mouting onto the robot.