Educational materials
function DrainMA = computeBatteryDrain (DutyX, DutyY) 
% usage:   [DrainMA] = computeBatteryDrain (DutyX, DutyY)
% purpose:   Compute the drain on the battery (DrainMA) of the 
%           motors for the horizontal and vertical aspects in 
%           terms of mA normalized to a sampling rate of 
%           10 times / second 

consumeX = 0;
consumeY = 0;
DrainMA = 0;

% Idle Power - power to simply hover

consumeY = consumeY + 5;
consumeX = consumeX + 0;

% Base power application - 20 mA / 10% of motor

consumeX = consumeX + abs(DutyX) / 10 * 20;
consumeY = consumeY + abs(DutyY) / 10 * 20;

DrainMA = consumeX + consumeY;

% Power is no penalty at less than 40 mA, 1.05 at 40 mA w/exp increase
%  beyond that level


if DrainMA < 40
    DrainMA = DrainMA * 1.0;
else 
    DrainMA = DrainMA * (1.05)^((DrainMA - 40) / 40);
end

% Adapt DrainMA for 10 samples per second
DrainMA = DrainMA * 0.1;


end
r1 - 20 Aug 2008 - 17:33:09 - AaronStriegel
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Syndicate this site RSSATOM