I have a strange ardurover problem that I cannot seem to solve and I was wondering if anyone fancies giving me their opinion.
I’m having a bit of an issue with a simple ardurover that I’ve built. It’s based on a cheap rc toy (JJRC C8812). It’s a tank tracked vehicle driven by 2 brushed ESCs (actually a 2in1) with one motor driving it forwards and another for steering, arranged through a gearbox. This is a strange setup but the net result is that it isn’t setup as skid steer - ardurover sees it as one output for forwards / backwards and another for steering.
The problem I have is that everything works great in manual mode. The tank moves forwards / backwards and steers as expected. In any of the other modes including ‘acro’ mode the tank moves forwards and backwards fine but will only steer correctly when it’s moving. If I try to steer on the spot half the time it goes the wrong way, jitters, then tries to correct by going the other way.
I’ve calibrated the compass multiple times and it has made no difference to the behaviour. I’ve double checked compass and AHRS orientation. I’ve played with the PIDs. If I move the tank indoors so that it loses all GPS satellites then it starts steering properly in acro mode and the problem goes away until it reestablishes a good satellite connection.
I have no idea what is causing this. Any suggestions greatly appreciated, tanks. https://drive.google.com/file/d/1SjXtHxDra4cUPm7aflJQV9Fh9Fq7pxCw/view?usp=sharing (log file)
I agree its strange that it appears to work 1) in manual, and 2) without GPS in Acro mode, but then fails to work with GPS in Acro mode. I don’t know why it’s like that. (If someone else can explain that, I hope they’ll chime in!)
This is a strange setup but the net result is that it isn’t setup as skid steer
The Rover documentation presents 2 fundamental options for configuration: Separate steering & throttle, and Skid steering. Yours does not seem to be either of these. (But it sounds like you’ve configured it assuming the first one.) My recommendation is to somehow solve the discrepancy between what AP thinks your platform is, and what it actually is.
(We’ve discussed this on discord, but I’m re-posting it here.)
Just for fun, here’s my speculation on what may be happening:
In manual mode, if you move the steering without throttle, the wheels would steer in that direction but the rover would not pivot. Yours happens to actually pivot-in-place. So it does what you wanted, but that’s essentially a lucky accident.
In acro mode, for some reason when the GPS is not healthy, perhaps Rover ‘falls back’ to manual mode. So you get lucky again.
In acro when the GPS is healthy, your “turn the wheels” command leads to physically spinning-in-place. That surprises the controller. So for some reason, it responds by counter-steering, and stuttering, and such. That’s the “does not turn” behavior which is concerning you. But its root cause is that the code with well-defined expectations is being applied to a platform which does not satisfy those expectations.
Another way to get around this could be to use a simple Vtail mixer and connect it to the flight controller set up as a skid steering tank. When the outputs go into the vtail mixer they will get unmixed to forward and steering output.
I think this could also be done with a lua script on the flight controller or Arduino to unmix the outputs.
I had to google your RC tank to see what’s going on with the gearbox. That’s wild! I’m amazed that they went to the trouble of building that gearbox- it’s got to be way more costly than just using differential drive.
That said, there’s something to the idea that the model in Ardupilot is incompatible with the hardware. In normal configs where you have separate throttle and steering, the vehicle doesn’t rotate when you are stopped and turn the steering control. When yours tries to do that under semi-automated mode, the autopilot tries to correct the opposite direction.
I’m going to second the recommendation of setting the frame-type to “skid-steer” (or whatever it’s called). I think you can actually configure the servo outputs to a “mix” in the manual configuration to do what you need- I’ve definitely done the inverse: taken fwd/rev + steering and mixed it to output differential drive… it’s just been a while so I’ll have to look up what I did.
Thank you to everyone for your advice. I’m working on the basis now that having a skid steer vehicle set to regular rc car mode is what’s confusing the autopilot when it’s in the loop (but not in manual mode). To rectify this I have put together a little bit of software (I call it the rc tank demixer) that runs on a pico2w (the only microcontroller I had lying around) which allows me to run the autopilot in skid steer mode and demix the outputs into steering and throttle for the rc tank’s weird gearbox arrangement.
Early testing suggested it works but then it shot off my table in full speed reverse so now I’m reprinting the big grey plastic bit I snapped before I try again.
Trusting AI to write the software for me may have been part of the problem but once I removed the extra LED feedback functionality it decided to add the demixer became a lot more reliable and it seems to have stopped randomly going into 100% reverse now, which is nice.
I’ll report back once I’ve reprinted my base plate and finished testing properly.
Using scripting may be a better approach to the one I have taken (no need for extra hardware) but I am not familiar with scripting on ardupilot so I did it this way instead to save time while troubleshooting.
Never a recommended path. It’s strongly preferable to have ArduPilot control each motor individually using its own mixing. I agree that a script may be the only reasonable path forward if direct output control is impossible.
The best solution would be a variable I could set in ardurover that would allow it to treat an rc car with throttle and steering as a skid steer vehicle. If it expected the vehicle to be capable of turning on the spot despite having separate throttle and steering outputs then I wouldn’t have to work around this issue with my unusual cheap toy grade rc tank. It probably doesn’t affect enough people to be worth the developers spending much time on though.
Are you referring to the tracked vehicle with a gearbox or my attempts to avoid the issue by using a mixer to demix tank track output from the ardupilot flight controller to produce something compatible with said gearbox? Or both?
I have no idea why the Chinese decided to build a tracked vehicle with a gearbox like this. It drives OK though.
I’ve just done a proper test drive with my new rc tank demixer device in the loop and i can confirm that all my problems with direction in life (with the tank at least) have disappeared now.
It just needs a bunch of PID tuning so that it steers better but I’ve already had it running a simple GPS waypoint test mission, badly, that it could not run at all with the previous setup.
Short version = ardurover gets confused if you set it up as an rc car without skid steering if the vehicle can skid steer.
Here’s a picture of the ardutank as it currently stands. With added purple to replace the grey bit I broke. Mavlink connection with the laptop via ExpressLRS and wifi, which now works quite well apparently. I’ll have more fun playing with all that now that the thing drives itself properly. Thanks again for everyone’s help.
I’m referring to your suggestion to support Ackermann-derived outputs for skid steered vehicles. It makes no sense to architect control for such a thing (mix-demix-mix is a very awkward mechanism and THAT is what is fundamentally the wrong approach to control).
The only other time we see this is when folks misconfigure Sabretooth drivers using the driver’s mixed mode. But as soon as they select independent mode, all is well.
I also have a tracked vehicle which operates like a RC car in regard to steering.
Had also various issues at the beginning trying to control it. I ended up assigning non standard channels for throttle and steering control and it suddenly worked.
But have to admit my rover is not mechanically linked, but has an electronic controller ex factory that works in this way. It just needs the pwm signal for both steering and throttle.
Hint: If your FC supports it, I would recommend the LUA quick tune script. Due to the non standard steering setup the PID values are much different then expected. I would never gotten close to it trying to set it up manually.
where it breaks down is the fact that Ackerman will reverse its direction of rotation when it changes it direction of travel. so when going forward in a car and you steer right the car will rotate clockwise, but when you reverse and steer right the vehicle will now rotate anticlockwise, this is different to a tracked vehicle where steering right will always rotate to the right independent of direction of travel.
boats also have this issue with rudders vs thruster steering, it would probably work if you set it up as an omni + vehicle, i think then you could get the outputs to operate it correctly by setting the steering to work as an omni motor as i have done this to get a bow thruster to work properly since it had the same issue of not reversing rotation.
I’ve already run the quicktune script and it did seem to improve things. Then I played with the motor dead zones (reduced them) and things improved even more. So I’ll probably run quick tune again after dialling in a few more settings like that.