1
Fork 0

time conversion

This commit is contained in:
Andy Killorin 2024-10-23 20:11:01 -04:00
parent e2b0360f10
commit be7060bc16
Signed by: ank
GPG key ID: 23F9463ECB67FE8C
2 changed files with 3 additions and 2 deletions

View file

@ -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 * CONTROL_LOOP_PERIOD_S);
rightMotor.SetTargetSpeed(rightSpeedCMperSec * RIGHT_TICKS_PER_CM * CONTROL_LOOP_PERIOD_S);
}
/**

View file

@ -19,6 +19,7 @@ protected:
* avoid rounding errors.
*/
const uint16_t CONTROL_LOOP_PERIOD_MS = 20;
const float CONTROL_LOOP_PERIOD_S = CONTROL_LOOP_PERIOD_MS / 1000.;
protected:
/**