I am still new to oDrive and need to read the encoder status with my Arduino.
My questions:
Can someone tell me what the range is of shadow_count? I guess this is a signed integer?
How do I implement this? Something more or less like:
odrive_serial.write(“r axis0.encoder.shadow_count\n”);
int myEncoderStatus = odrive.readInt();
Thanks a lot.
That looks right. But why do you want shadow_count? Do you need your position in terms of encoder counts? Or do you want it in terms of “turns”?
hi, Wetmelon. Number of turns is fine, however as a float, not as an integer because counting entire turns is too low resolution. In the meanwhile, I have added this function to the ODriveArduino.cpp which I found was missing:
float ODriveArduino::GetEncTurns(int motor_number) {
serial_ << "r axis" << motor_number << ".encoder.pos_estimate\n";
return ODriveArduino::readFloat();
}
and correspondingly in the ODriveArduino.h I added:
float GetEncTurns(int motor_number);