Adventures with a "mixed mode" motor controller

This weekend I was working on a fairly large, tracked skid steer Rover on loan to me. It arrived as an RC-only controlled bot, and I quickly retrofitted a Cube Orange.

It took longer than I care to admit to figure out that the motor controller (of unknown origin and missing documentation) expects throttle and steering on its input channels rather than left/right throttle - what some motor drivers call “mixed mode” as opposed to “independent mode.”

While that’s surely a convenient RC mixer for those with an RC setup suited to an Ackerman steering configuration, it does not suit my needs on a skid steered ArduPilot Rover. I can’t find DIP switches, jumpers, or any other obvious means to reconfigure the motor driver (it’s probably done via the plethora of unlabeled pins, some of which may be RS232 or RS485).

The owner suggested perhaps an Arduino could be used as an intermediary controller - I hesitated for a bit but then accepted the challenge!

I’m afraid I can’t share the source code in its entirety because portions of it are not open source, but I can share the basic algorithm and provide a path toward success for anyone with a similar conundrum.

Anyway, on to the details:

Getting the mixed mode throttle input is simply a matter of averaging ArduPilot’s left and right throttle outputs. If the left/right trim/neutral values differ from one another, you must account for that as well (was not the case for me).

The mixed mode steering input can be calculated using the difference between ArduPilot’s left/right throttle outputs. Divide the difference by 2 to scale it correctly and then add/subtract that difference from the steering neutral/trim value.

To avoid floating point oddities, I used all integer math in my solution, multiplying intermediate values by a factor of 1000 and then dividing again at the end.

For a very rudimentary solution, pulseIn() can be used to measure the input pulsewidth from the autopilot. However, it’s probably more accurate, efficient, and effective to attach a couple of interrupts and measure the pulsewidth more directly.

The Servo library makes easy work of managing the output pins.

In the end, you’ll likely need less than 100 lines of code to arrive at a working solution. A word of caution, though - because you are providing a PWM source directly to the motor driver that is separate from your RC transmitter and autopilot output, give some thought to failsafe behavior.

This is interesting as I have some modified hoverboards that use the forward back left right servo inputs I was going to build a rover with.

This might be perfect for that sort of thing. I don’t think I can recommend this method for production level hardware, but it can be a saving grace when prototyping or attempting a one-off retrofit of an autopilot to an existing chassis.