System Identification using ODrive

Hello,

The system I am operating uses ODrives and I want to do some system identifications using the drives. I was wondering whether this is something anyone has tried before, and if there are any tools available on the ODrive towards this purpose. One of the specific problems I am dealing with is the fact that we are using the UART communication protocol but this can’t keep up with the ODrives refresh rate. I thought of dealing with this by creating some sort of buffer and reading it out after the test finishes. Anyways any help towards this or links to other related or interesting forum posts would be much appreciated.

Thanks

Hi ODieb,

I’ve successfully used all of UART, USB, and CAN for system identification testing. You’ll likely need to increase your UART baudrate to the maximum possible (921600 baud is a good starting point) to increase communications speed. With that, you should be able to achieve at least 500Hz read/writes, which will be enough for many system ID tasks (Nyquist frequency of 250Hz).

Note that CAN is a generally more efficient protocol - I’d recommend that over UART for this purpose. You should be able to get multi-kHz read/writes that way.

Maybe you can elaborate more on the specific task and frequency range you’re looking to poll?

One thing to note is the ODrive’s tuning mode (note - it’s called autotuning, but this is just a legacy holdover - no autotuning involved). If you put ODrive into InputMode.TUNING, then the ODrive will automatically self-command torque/vel/pos sine waves (parameters defined here) dependent on the current control mode (torque/vel/pos). This is extremely useful for creating bode plots and other frequency response information, as the burden of sending setpoints is removed from the host controller.

Hi solomondg

Thanks for the response, it is good to know that someone else has tried this before. I will start by elaborating a bit on my system. I am controlling an exo-skeleton for use by a human. We have 8 joints/actuators total in the exo-skeleton, four rotational and four linear. All these joints have hard end-stops(so no open loop ID). We drive these joints with four ODrives which are connected through the UART connection to a communication board which translates to an EtherCAT connection to our higher level control. There is an incremental encoder colocated with the motor and an absolute encoder on the output to orient the joint in space. We also have a “test setup” that only has one rotational and linear joint to try in a save environment(otherwise exactly the same).

The task we want to perform is walking. For this we mostly need to know the low frequency dynamics as we don’t need to be super fast, but the higher the better of course. The CAN protocol pins are not used in the current setup and could be connected but I am unsure whether this is possible alongside reading from the UART(which is needed for the sensors).

We want to start our identification on our test setup but move on to identifying the whole system. As you can imagine the dynamics are quite non-linear and position dependent.

The tuning mode does seem interesting but it might send our joint into its endstop which we would like to avoid. Do you know if the position controller will still respect all the limits while in this mode? It seems, from the parameters, that we should be able to keep it in bounds but I don’t know how the velocity and torque play into that.

While looking thought the code I also found an oscilloscope functionality. It is supposed to save the data from a certain test and later dump it into a .csv file. Have you ever encoutered/used this before?
Also where can I increase my baudrate?

Thanks for the help.

Hey ODieb,

Cool project!

You can increase UART baudrate here. Make sure to use CRCs if you increase the baudrate, to guard against transmission/reception errors.

The v3.6 oscilloscope only can capture a single variable afaik, maybe not the best move here. It’s much more fleshed out on S1/Pro (though you’d have to contact us for a debug build, which should be fine).

In tuning, if you have your input mode as pos control, then you can set pos_amplitude to zero, set an input_pos (which will be used as the dc offset of the pos sine wave), and then additionally set torque_amplitude to nonzero - this’ll essentially put the ODrive in closed loop position mode around where input_pos is, while also sending a torque sine command superimposed on this, which you can use to send sines while having a “spring” force around the input_pos position to prevent position creep due to asymmetrical friction.

Generally if you can move from UART to CAN that would be extremely ideal. Shouldn’t be an issue with the ODrive communicating over both at the same time. Note that on v3.6 you can only access the properties enumerated in the CAN protocol - on S1/Pro you have full parameter access to the entire device tree (same as over USB/UART).

A better overall question may be: what’s your desired sampling frequency, how many variables will you be sampling per period, and how many variables will you be writing to per period?

All that being said, it sounds like it’s maybe more worth pulling out the lagrangian mechanics than doing position-dependent characterization on a nonlinear system :slight_smile:

Hey solomondg

Thanks for the response. I am going to try to increase the baudrate. I would be interested to have a look at the oscilloscope from the S1/Pro, I already noticed that the oscilloscope was rather limited on my version(<3.5), it would provide a wider frequency range though. We are also trying to switch to a different protocol but that project is still in the works right now.

As for your question, we are mostly interested in the position output of the system under some white noise or tuning frequency. So that comes to two variables per period per drive. We also need two encoders through the uart so two writing per period.

I did get started on a model and we do have a full inverse kinematics model, however we have a motor with very high friction and the load force is not taken into account in the model(it is used to convert gait patterns). We decided that it is at least interesting to try this way of ID and see if the results are of any of use.
Who should I contact to get access to the S1/Pro software?