Current control / torque control arduino

I have my odrive interfaced to the Arduino via uart communication. Position and velocity control work well. However when I try to do current control using odrive.SetCurrent(0, 10.0f) the motor moves a little and then it seeems like it hit a safety switch and stops powering the motor. I have to restart ODrive to continue using it.

I have used the following commands to remove any current or velocity limits but it doesn’t seem to have helped.

odrive_serial << “w axis” << 0 << “.controller.enable_current_mode_current_limit = False” << ‘\n’;
odrive_serial << “w axis” << 0 << “.controller.enable_current_mode_vel_limit = False” << ‘\n’;

Any advice is appreciated!

You will have to check the error codes to see what’s happening. axis.error, controller.error, motor.error, encoder.error, etc.

What is the protocol for checking errors when running on Arduino?

You’ll want to use the r command. For example:

        for (int motor = 0; motor < 2; ++motor) {
          odrive_serial << "r axis" << motor << ".encoder.error\n";
          Serial << odrive.readFloat() << '\t';