ROBOTC.net forums
http://www.robotc.net/forums/

How to Adjust the Motor Power as the Battery Level Decreases
http://www.robotc.net/forums/viewtopic.php?f=11&t=10289
Page 1 of 1

Author:  ThatOneGuy [ Sun Jan 18, 2015 9:42 pm ]
Post subject:  How to Adjust the Motor Power as the Battery Level Decreases

Hi,
My team has an autonomous which works the best when our battery level is close to full. However, we can never guarantee the success of the autonomous as our accuracy is decreased when the speed of the motor decreases due to a lower battery level. If the max battery level is around 8000, is there a way to program our code so that when the battery level is around, say, 5000, the motors go at the same pace as when the battery is at full power? Thanks!

Author:  terbos [ Mon Jan 19, 2015 2:41 pm ]
Post subject:  Re: How to Adjust the Motor Power as the Battery Level Decre

It sounds like what you want to do is have your autonomous specify the motor speeds instead of the motor power.

To do this, the autonomous script should never set the motor power directly. Instead, it can request motor speeds similar to how it requests power now, but a separate task monitors the speed requests and then controls the actual power to achieve the desired speed.

The parts of the system required to make this work:
- Each drive motor needs to have an encoder. The big red encoder or the IME will work for this.
- Create a task in the software that watches the current motor speed (how fast the encoder is changing) and varies the motor power to get the correct speed. There are plenty of examples online for speed control algorithms.

Terry

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/