ftPeter / RomiPi

ROS library for Pololu Romi with Raspberry Pi.
7 stars 11 forks source link

Incorrect variable used when calculating the avg wheel velocity? #4

Open markwomack opened 2 years ago

markwomack commented 2 years ago

https://github.com/ftPeter/RomiPi/blob/cc958aed5e19ca468e657f5ba309f9c5a3e4fc76/Arduino/Romi-RPi-I2CSlave/motor_pid_control.ino#L33

The above referenced line uses the variable 'i' for the value from the velocity array, but shouldn't it be 'j' instead? Using i just adds the same value from the same index for the window size. It doesn't actually use all the values in the array as I would expect. Same problem in both of the methods.

ftPeter commented 2 years ago

Good catch. Thanks for posting. I have pushed the new version with the fix.

ftPeter commented 2 years ago

Can I ask what you're using the code for?