Fixed joint pos interface

This commit is contained in:
Tim Korjakow 2023-07-11 17:12:53 +08:00
parent 16c64b6f15
commit 95b9decbb6
1 changed files with 1 additions and 6 deletions

View File

@ -1,10 +1,5 @@
#include<MotorWheel.h>
inline int modulo(int a, int b) {
const int result = a % b;
return result >= 0 ? result : result + b;
}
Motor::Motor(unsigned char _pinPWM,unsigned char _pinDir,
unsigned char _pinIRQ,unsigned char _pinIRQB,
struct ISRVars* _isr)
@ -328,7 +323,7 @@ float GearedMotor::setGearedSpeedRPM(float gearedSpeedRPM) {
float GearedMotor::getPosition() {
debug();
int ticks_per_rev = getRatio() * CPR;
return ((float)modulo(Motor::getCurrPulse(), ticks_per_rev))/ticks_per_rev;
return ((float)getCurrPulse())/ticks_per_rev;
}
MotorWheel::MotorWheel(unsigned char _pinPWM,unsigned char _pinDir,