I didn't get a chance to try it yet. I had to watch one of the foster kids, who was really really naughty. I had an idea about the throttle.
At 0 rpm, the torque is maximum and rpm is minimum. At max rpm, torque is minimum and rpm is maximum. So, what if we took a cue from the nature of the motor. pwmDuty is proportional to speed, and current is proportional to torque. So what if we tried this:
Try to make:
C*current + (1 - C)*pwmDuty
equal to throttle.
C would be a number from 0 to 1. If throttle was 0, then C would be 0. And if throttle was maximum, then C would be 1. To get this, we could do:
attempt = (throttle*current + (MAX_THROTTLE - throttle)*pwmDuty)/MAX_THROTTLE
Then, you change pwmDuty based on if attempt is too little or too big, compared to throttle.
Last edited by MPaulHolmes; 07-24-2009 at 01:30 AM..
|