time conversion
This commit is contained in:
parent
e2b0360f10
commit
6e51d4f249
2 changed files with 3 additions and 2 deletions
|
@ -117,8 +117,8 @@ void Chassis::UpdateMotors(void)
|
|||
*/
|
||||
void Chassis::SetWheelSpeeds(float leftSpeedCMperSec, float rightSpeedCMperSec)
|
||||
{
|
||||
leftMotor.SetTargetSpeed(leftSpeedCMperSec * LEFT_TICKS_PER_CM);
|
||||
rightMotor.SetTargetSpeed(rightSpeedCMperSec * RIGHT_TICKS_PER_CM);
|
||||
leftMotor.SetTargetSpeed(leftSpeedCMperSec * LEFT_TICKS_PER_CM * SECONDS_PER_CONTROL_LOOP);
|
||||
rightMotor.SetTargetSpeed(rightSpeedCMperSec * RIGHT_TICKS_PER_CM * SECONDS_PER_CONTROL_LOOP);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,6 +19,7 @@ protected:
|
|||
* avoid rounding errors.
|
||||
*/
|
||||
const uint16_t CONTROL_LOOP_PERIOD_MS = 20;
|
||||
const float SECONDS_PER_CONTROL_LOOP = 1. / CONTROL_LOOP_PERIOD_MS;
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue