K/battery = Motorspeed

Hey All,

So I’m one of those weirdos who believes that with all the mass balancing issues, and the proven strength of Cam shooter, that Flywheels will still reign supreme at the end of this thing. Anyways, So on a full 9.1 battery, I’m operating my motors at 42/127 (33%ish), but as I use my battery longer and longer, though it doesn’t change much, I end up having to change my motor speed value up to somewhere around 62/127 to have that same 90% accuracy we all want to know and love. So, I had the idea of a program that uses a basic inverse formula to create an on-board, speed-changing function; however, I don’t know where to start (other then here!) so I’m looking for community suggestions on how I would go about that with EasyC v4 for cortex or comparable c-compiler.

Pope Praxis
Team 1893, Poly High-tech Parrots

you will need to implement velocity control algorithms, such as PID control or the TBH algorithm, just search PID control on the forums, there are plenty of threads on it

I guess you could implement a controller this way, although I cannot guarantee success :p. You can also look into velocity control options around the forums (like PID & TBH). I would assume you would calculate this with a function like:

// Constant output gain
const float Ko = 0;

float batteryVoltage = battery voltage;
float calculateFlywheelSpeed(float motorSpeed)
	return( ( motorSpeed / batteryVoltage ) * Ko );

You would have to have a play round with Ko value and whether to use mV or V. Then in the main loop you would call it like:

	batteryVoltage = battery voltage;
	motorspeed = calculateFlywheelSpeed( motorspeed );
	motor[flywheel] = motorspeed;

I am considering this concept but I’m sure battery level isn’t proportional to motor speed?

We tried a function which varied the motor speed with the battery level. We found, after various and extensive testing with batteries that the function did not supply us with even near accurate results, and that our batteries were very unpredictable. A PID control function is probably the only way to get accurate results with a speed varying function.

Our programmer has been working on a program where motor speed is controlled by the IME’s. This means that the motor speed wont change regardless of battery power. Its basically the motor cant exceed or go below a certain amount of ticks.

I am going to try to make a table of motor speed and torque versus battery power for different powers from 1-127 and figure out an equation but it might be a while because I need to prepare for a competition on Saturday.

I ended up setting up a scratch program akin to that idea, since each of my wheels is controlled by an independent power bank. I haven’t gotten to test it yet, but by setting a certain RMP or whatever the value is you want to maintain, I think it should resolve the issue of battery-related motor slow-down.

A velocity controller is probably the most effective way of controlling the speed that the flywheel spins at. Make sure to check out some of the threads on the forum, there are a lot of suggestions and sample code you can take a look at!