Okay, so I think someone needs to explain me the idea of ODrive, back to the basics. I just can’t get my head around how to control it properly.
We are developing a 4-axis robotic arm, with 4x 150kV standard motor and 2 ODrives 3.6. The plan is to control it from an external PC, running inverse kinematics (well maybe in the future).
What’s the proper way to control something like that? The PC would do the inverse kinematics and calculate the desired position for each axis at every point in time and would stream it to the odrive, while the odrive picks up the desired position and moves each axis to it, say with a frequency of 1000Hz.
Our current plan is to have an Arduino in the middle. It is connected to the PC via UDP/Ethernet, receives the desired positions, and passes it on to the 2 odrives via the UART native interface. It seemed like the single best way to stream a lot of data into the odrives in real time from an arduino. However, it seems that this approach is not fast enough, I may have to rework the code but it seems like the Arduino with the current code can’t go higher than 125Hz and that with only one ODrive and without UDP yet. This results in a lot of noise and vibrations, so this can’t be the way to go.
But what else? The ASCII protocoll wasn’t even considered. SPI or I2C aren’t really implemented as far as i know. We looked at the CAN interface, but it probably wouldn’t have been any faster than UART. What else? USB? This also can’t be the way to go. You can’t run realtime control over usb. I think i never had a time where usb worked for over an hour, already the usb driver itself makes it unusable for real time control in my opinion, be it windows or linux. And then there’s only the step direction interface. But wouldn’t you need 4 or 6 pins for each odrive? We also need at least 2 end stops per odrive.
So what i don’t understand is how everyone does it. We are using the UART native protocol, but it seems like only 3 or 4 other people in the world use it besides us. I have seen so many projects online, all of which work perfectly, but i never brought to knowledge how the odrive is controlled. What about all those CNC mills? Those 3D printers? What about Mach3? I know ODrive can be used with Mach3, but how? Additional hardware and step/dir interface?
I’m thinking about @Dev255 and his solar powered CNC mill, i looked into his projects for quite a bit, but i couldn’t find out how it works, i only know that it used odrive, Arduino and Mach3, but it seems like the Arduino is an addition to Mach3, so not inbetween.
I’ve also seen a lot of odrive 3d printers, how are all of those controlled?
We also can’t use the built-in trap traj because all 4 axis need to be synchronized globally and we need inverse kinematics, so even the acceleration may be different and non-constant for every axis. There’s no way around a single computer doing the kinematics and the odrives getting the position.
Another way to do it is to only do speed control. I’ve seen this done that way quite a lot in industry. The control pc would to PID control itself, control the speed or torque of the odrive and control the encoder estimate. This would however completely eliminate the odrive as a controller and would only use the odrive as a conventional ESC for low speeds.
But the thing is that odrive IS apparently being used in industry and many many hobby projects, many of which require a single controller for multiple odrives, such as CNCs, because a cnc can’t really use trap traj, it needs to to all calculations in one place.
Can anyone explain to me how odrive is supposed to be used properly and what would be the best way for us?
Thanks