I’m using the ODriveArduino library to communicate between a Teensy4.1 and an ODrive (HW ver: 3.6.24 and FW ver: 0.5.4) for a Direct Drive Telescope I have built. I designed and built both the Altitude and Azimuth DC motors (PMAF) and ODrive works great with them. Also, I have written the FW to integrate the OnStep base FW package with the scope and TFT hand controller.
The communication channel works great to set positions, read encoders, read motor current, etc. But, I can’t seem to set (write) the gains even though I can read them. I want to be able to dynamically change the gains based on varying load conditions (like wind).
Is the ability to set the gains using the UART native protocol implemented?
Here is the sample code:
HardwareSerial& odrive_serial = Serial3;
// ODrive object
ODriveArduino odrive(odrive_serial);
void setOdriveVelGain(int axis, float level) {
odrive_serial << “w axis”<<axis<<".controller.config.vel_gain="<<level<<"\n";
}
float getOdriveVelGain(int axis) {
odrive_serial << “r axis”<<axis<<".controller.config.vel_gain\n";
return odrive.readFloat();
}
setOdriveVelGain(ALT, 0.3);