Friday, November 13, 2009

Real world vs. software ... Real world wins :-)

The good thing about software is that, generally, you can get things working pretty well.

However, sometimes it doesn't always work first time. In my experience, this happens even more when you are dealing with the 'real world' more than usual, like in a Robot. Since I don't have a full mathematical model (or, in fact, any mathematical model) for the Robot work I'm doing, I have to use my mental model, known principles (e.g. DC motor drive, torque, skidding, etc.) and testing. But that leads to some head scratching when things don't work as they should.

Case in point: I have a problem where the robot thinks it moves so far in a straight line but actually moves some amount less. I think this is probably because the torque on acceleration is too high leading to some wheel spinning. It certainly appears to the be most likely cause.

So, since I can't control the motor current, I'm going to ramp up the motor terminal voltage using a technique called PWM (pulse width modulation). As long as the ramp up is slow enough it should help a lot.

No quite as simple as it would appear because the code needs to integrated with position adjustment (keeps it running in a straight line) and speed adjustment (keeps it running at a certain speed). But not too hard.

So ... I have a software switch (#define) to turn on and off the code that does the all new PWM based voltage ramp up and down.

Guess what? With the new ramp ON it appears to move a random distance not in a straight line. This is worst than the (skidding) original :(

Oh well, time for more tests and head scratching (also know as mental model adjustment).
Newer›  ‹Older