Returning battery voltage into user program

Hey is there anyway to return the battery voltage to the user program, our team was noticing that we need to aim slightly differently in order to compensate for the drop in voltage caused from running our motors. So I was hoping there was someway to return the voltage and compensate for it in order to be more accurate any help on this would be awesome.

Thanks: 2130 Alpha+

uhmm in Java the battery voltage can be returned as a get method in the driverstation class

Yes however I was needing it in C… where is it under the java though? it might be under a similar file in C.
and It is thank you very much

http://rbmj.github.com/612-code/doc/html/classDriverStation.html#a29be7401b5ccdcf7d86f0cf8030f85bf

Uhmm I think in Java if you import the DriverStation class or it might be in the DriverStationLCD class

There is a method for this in the Driver Station class.

This line code should do what you want I believe:


float voltage;
...
...
voltage = DriverStation::GetInstance()->GetBatteryVoltage();

Zem… you may wish to consider / implement encoder feedback closed loop speed control on shooter motor (PID)
to automatically compensate for battery voltage droop and dynamic IR load drops from drive motors
and apply full power after each shot to most quickly get back to regulated set speed needed for consistent shooting.