I was thinking about using hoverboard motors on a rover for quite a while. They offer high torque at an unbeatable price. The ODrive looks like a perfect fit for those motors. It uses closed loop control with the motor’s hall sensors to allow very precise movements even at low speeds.
Finally I found some time to put it all together and the results looks very promising. I use auto mode without any global reference (no GPS or compass). ODrive allows to read out the encoder positions, so it can be used as as wheel encoders for the EKF3 without any extra hardware.
This is a simple mission following a 3m x 2m rectangle. There is a little bit of oscillation after the pivot turns, but I think it looks pretty decent.
The biggest issue at the moment is gyro drift. I believe this is caused by having only one measurement source for rotations (just the gyro no compass), so the EKF can’t really estimate the offset. It might be a good idea to calibrate the gyro offset any time the rover is not moving.
At the moment this is just a quick and dirty hack, but I think ODrive support could be added to the mainline if there is some interest.
@Jeb_Campbell: I was controlling it using the ASCII protocol over USB. Ardupilot runs on a RPi with a modified output driver to directly talk over the virtual serial port. This allows to read the encoders positions from ODrive over the same connection. I needed the wheel encoders as I didn’t have GPS or any other absolut measurement of speed.
It shouldn’t be too hard to do the same using the UART connection on the Pixhawk and Odrive. But requires modifying the firmware.
Are you sure it’s noise on the Pixhawk outputs? I had some trouble with the ODrive itself. There was noise on the encoders and I had to upgrade the ODrive firmware to have a stable system.
Thanks for the info. This is a great setup for a rover with odrive.
I’m willing to send pizza/beer money for a detailed write up and modified serial code as I have been banging my head on this for too long now. Just send me a paypal address…
I re-watched your video and I’m so impressed with how simple it is. I went back to the garage last night and looked at my jumble of wires that isn’t moving…
@Jeb_Campbell, are you able to compile/modify Ardupilot from source code?
Are you trying to get this working on a RPi or the Pixhawk?
Do you need encoder feedback in ardupilot?
Do you need PWM outputs for things other than the ODrive (Servos, etc)?
My current code is quite hacky and might be confusing. It will not work on any off the shelf boards without modifications! But you can find it here if you want to have a look. To merge this in the mainline Ardupilot, I would need some support how to correctly integrate this into the Ardupilot codebase.
What is your progress so far? What are the concrete issues you are facing?
Using PWM is probably the easiest to get this working. If the PWM signal is too noisy to work, you might have trouble with uart as well. So analog filters might help here.
Cheers,
Daniel
PS: I am running ardupilot on a RPi with an IMU directly hooked up to the SPI. That’s all you really need for a rover, but its not supported out of the box.
@Daniel_Widmann Thank you for taking the time to look at this! I’ll detail what I know below.
(Hardware available) Pixhawk 2.1 + GPS, Rpi 3b+ w/ BerryGPS/IMU, and the Odrive.
I didn’t know Ardupilot would run on a bare Rpi… So I’ve been trying to get the Pixhawk running. Encoder input to the EKF would be nice. And I love the simplicity of your build (I just want to build a solar mower/rover to see if I can do it). I have linux experience, some coding, and can at least work an oscilloscope well enough to impress my kids…
What is working:
(Odrive) works with ASCII commands over USB and Serial. I had this going with one of the ESP32 Lora chips to a Blynk app on my phone. PWM not tested, but I followed the docs. But it needed a brain…
(Pixhawk 2.1) Bench config tested with GPS, 900MHz telemetry, and commands from Qgroundcontrol and Mission Planner. 48v -> 5v powersupply tested on bench. Clean and correct PWM output for skid steering verified from oscope.
But it doesn’t work when I hook them together (they are grounded together). One odrive wheel drives in reverse (sometimes) with no command input and no change with Pixhawk output. This made me get the scope out…
My scope wouldn’t even lock on a frequency on the PWM pin when it was turned on. So I powered the Pixhawk from USB (odrive off) and the signal looks good (16kHz). As soon as the odrive is powered on and connected the signal goes crazy. If I disconnect the pins from the pixhawk to odrive, I start getting noise on the pixhawk output pins (rf interference?).
I would like to start down the Rpi route. I’ll look in your code for which ./waf --board xxx you used. Thank you for your time, and I’d still love to send some pizza/beer money… jebc AAATTT c4solutions DDOOTT net.
yes i use the original “hoverboard” hardware. just connected a st-link programer flashed the “hack” firmware. (have a look at the video above).
now you can control the two weels with either ppm or analog voltage.
i went the simple way and used pixhawk (outputs pwm) -> pwm to ppm converter -> hoverboard hardware.
and was ready to go. i use 4wd.
Just looked at it, and as the author said: To merge this in the mainline Ardupilot, I would need some support how to correctly integrate this into the Ardupilot
Additionally the code is 3 years old and it cannot be merged as the Rover structure has radically changed since.