Strafing Acceleration Function Not Working

I am currently working on creating an acceleration function for my programming skills, particularly while my robot is strafing. Simply put, the robot will strafe faster the further away it is from the encoder tick goal, and strafe slower as it gets closer to that goal. However, for some reason, in my calculations, I keep getting 0 as my final result for the ideal strafing speed, which is not correct. I was hoping that with a fresh set of eyes, someone would be able to spot the issue in my calculations, since I have not been able to for the past hour and a half.
Thank you so much for your time!

can you show the function call? also i dont believe that semicolon after the final closing brace is necessary.

1 Like

Here’s one of the loops in which the function is called.
You’ll notice there is a “minStrafePower” variable. This is the minimum power that the strafing can have, so even though I am getting 0 in my calculations, the robot still strafes with 30 power since 0 < 30.

That is true. Not sure why I put that there.

Never mind, I did not know that dividing two integers by each other (even if the variable is defined as a float) would give you an integer. Silly me!