Wheel Encoder Calibration trouble
Jo B.
Posts: 5
Hi, I'm trying to use the calibration program for the digital encoder kit from Parallax as found here: www.parallax.com/StoreSearchResults/tabid/768/txtSearch/encoder/List/0/SortField/4/ProductID/80/Default.aspx The first three stages of the program work fine but once I try to use the fourth stage it doesn't move the motors. I put in debug commands in the code to determine where it gets caught up and it gets caught up just after it enters the "DoMove" function. Actually... it won't let me even put a debug command in that function because the BASIC Stamp program doesn't let me and instead throws up an error saying "Data occupies same location as program"
I'm not sure what this means or how to fix it. Has anybody else had this problem or have suggestions on how to fix it? Here's the .bs2 file.
I'm not sure what this means or how to fix it. Has anybody else had this problem or have suggestions on how to fix it? Here's the .bs2 file.
Comments
There's a five-second delay built into the start so that you can stand back and stand still during the process. Also, you need to have a photoresistor wired into your circuit, per the instructions, so that the program can "see" light as the Boe-Bot rotates. Without that, you may experience further delays.
Actually... it won't let me even put a debug command in that function because the BASIC Stamp program doesn't let me and instead throws up an error saying "Data occupies same location as program"
That's because the program is near capacity, as-is. By adding the DEBUG instruction, you're forcing the program (which builds from the end of memory backwards) into the DATA area. If you remove your other DEBUG statements, you will make more room for the one you want to add.
-Phil
As for the fourth stage of the calibration program, I've tried the photoresistor circuit with both the 0.1uF and 0.01uF capacitors and ensured that all the ports are the same as those specified in the program and waited over 30 seconds for the bot to move but it doesn't move. I've tried it under varying lighting conditions as well and still nothing. When I go back to the 1 stage of the calibration where it dumps the data collected the calibration data corresponding to the photoresistors, it outputs something like 221, 232, 8307, 0, 0, 0, 0, 0 for the first line and then everything line after that is all 65558 values or something like that ((which I think is the max value for Word) not at home w/ my bot so I can't check atm)
I'm not sure, but I think it might be getting the first 2 values fine and then getting stuck in on the last one, hence the larger value, and it doesn't get any new ones because it doesn't move.
Not quite sure why it'd stop, I've checked all the circuits to ensure they're the same as in the diagrams provided and that the ports all sync up with those in the program.
I'm gonna put some debug stuff in the DoMove code and also where the program takes the photoresistor readings to see if there's an issue there as well, but other than that I'm out of ideas.
-Phil
I've also determined that it always sends the motors to pulse out at 750 and so that's why the motors don't move (this is due to the Pulse variable being = to 0). If I manually move the motors it exits the "do while" loop and takes the next photoresistor readings.
After deconstruction the values of the arguments that go into the declaration of Pulse, it looks like the first part seems to be causing the error because the value of it is zero and thus makes the rest of it zero all the time. (Veloc was declared immediately before entering the DoMove function to = 1) However, changing the MIN 3 to MIN 1 changed the value of that argument but Pulse is still = 0.
Gonna deconstruct it further once I finish some assignment.
-Phil
I'm actually not sure how I'm supposed to use the calibration data once I've got it anyway. The guide just says to copy/paste the output into programs later on. The data outputted looks like this:
Then the photoresistor data comes after that.
-Phil
So after looking through the code extensively it turns out that the data that I collected during the velocity calibration was actually telling it not to move. After using the provided example calibration output data I was able to use the fourth stage to get proper angle calibration data.
After that I fine tuned the constants outputted by Calibrate_All.exe and the Wheel_Motion.bs2 ran pretty nicely.
I'm currently looking for ways to increase the value for the pulses sent to the motor that don't compromise the accuracy. (one way I tried was just to multiply the amount that's subtracted from NULL by 9 (because then the final value sent to the motor is below 650 and just at 850 for the other, thus making both go at max speed and having no variance between the two)) I did it that way because I'm not really sure why/what is going on in the determination of a motor pulse value.
Anyway, I've got it running, I just need to make it run at a decent speed now. Thanks for your help Phil.
'Glad you got it running!
-Phil