Monday, February 26, 2007

Update 2/26/2007:

It's been a long time since I last posted. I have only one excuse CNC :) It's consumed me and my attention for 3 months now. What do I have to show for it? A mini mill, a wish list, a parts list, and an AWAOL machinist that was going to help me get there.

On the robotic front I got inspired to help the local college team again and thus worked on some A2D stuff for line sensors. I also spent 5 hours with them troubleshooting their LCD, braiding wires, and answering questions. The results: they were able to follow a line fairly well before the night was over. But, the system was a bit unstable if the angle to the line was too great the robot would run right over it. Thus we started discussing how to slave the wheel speeds together to truly go straight.

Enter PID (proportional integral derivative) loops and controls. Mobile Robotics implements a PI loop, while others using a PD (http://www.geology.smu.edu/~dpa-www/robots/doc/speedctl.txt). This weekend I typed out the code in the Mobile Robotics book modifying what I thought needed to be and letting her rip. Let me just say that I am using anti-phase PWM where 0 to 128 is reverse and 128 to 255 is forward with the duty cycle getting bigger the further you get from 128. Well, the robot did in fact slave the two motors together, but in opposite directions! When I added code to stop it after 4000 ticks (4 revolutions) the robot then when in a straight line. Great ... now why is it doing that?!

Long story short, I knocked together an Excel spreadsheet to simulate the result of the PI loop today. I had a multiplication error when trying to convert -100% <> 100% duty to and actual PWM value. DOH! On the otherhand, I changed over tot he PD loop David uses and now understand a lot better what is really going on. Can't wait to try it out later tonight.

Onward
Jay



A screenshot of my excel spreadsheet