I’m curently controlling my motor via an Arduino using other sensors. Hence, I would like to know how to set the internal settings of the controler (PI) gains to P=1 and I=0. So that only the PID inside my Arduino is driving the show. I’m asking because from what I read, those settings are automatically adjusted when changing current_bandwidth ?! How can I make sure P=1 and I=0 ?
I have a motor connected to a pendulum. I want to control it in torque mode using sensors that the Arduino will read and send a certain command to the controller. The reason I want the P=1 and I=0 on the Odrive is to set the values of the gains only on my Arduino program.
Another option would be to set the P gain =1 on the Arduino and adjust the gains on the controller. But if I shouldn’t be changing that, how am I supposed to tune my system?
I’m using MPU6050, I just want to get the angle difference and then send a command (already processed with a PID controller in the Arduino) to the Odrive.
The command sent by the Arduino to the Odrive will be to commande the torque applied by the motor, yes.
By controlling in torque mode, it implies that position controller and velocity controller aren’t used as you said before and that’s perfect for me. However, the current controller is still active. It is the current controller gains that I would like to set manually. (Kp = 1 and Ki = 0 and there’s no Kd apparently)
You can modify the v3 firmware to do this, but your motor will likely become uncontrollable. You need the current controller to be active and well tuned if you want the commanded torque to equal the output torque.
If you change the current controller tuning to Kp = 1 and Ki = 0, this is no longer true - you will command 1N-m of torque, but get something else out (actually since it’s an FOC current controller in the dq frame, it’ll probably just lose control immediately and either not move or spin up to maximum speed).
Set control_mode to torque mode, and use input_torque. That’s it, all you gotta do
Of course, that assumes your inverted pendulum code is right… feel free to share that if you want us to review it. Better yet, draw up a little control block diagram of it
Note that if you want to do this with torque control, your control loop frequency should be quite high (100Hz or so). The Stanford Doggo guys did something similar, and they had to hack the firmware communication protocol to make it fast enough.
I’d recommend to use velocity control for a single pendulum. It’ll be much easier.