I am trying to calculate expected current from the velocity and voltage. I graphed some values and I have some questions.
Firstly the voltage delivered (which I get from
pros::c::motor_get_voltage) shows that the voltage ramps up, is this something VEXos does, is it something the motor does, or is this just an effect of the motor controller circuitry?
Another question is about the reported current draw. The current values have a peek very close to when the motor reaches optimal speed for the given voltage, then slowly goes back down. I would expect the peak to be at the very beginning or at least close to (because of the voltage ramp). @jpearman Is the reported current values the actual current at the given moment or are they smoothed with previous values to remove noise?
Here is a graph which is supposed to output correct current. My code is…
double expectedSpeed = pros::c::motor_get_voltage(1) * 0.0191; double actualSpeed = pros::c::motor_get_actual_velocity(1); double expectedCurrent = (expectedSpeed - actualSpeed) * 25;
In the code
expectedSpeed is the speed the motor should settle on for the given voltage (I got this from testing). It clearly doesn’t match the current draw, but why. Am I doing something incorrectly in my code, or is VEXos smoothing/filter the current values?