Rover servo min/max/trim problem with gamepad

Hi,

Edit TL;DR: I’m using a gamepad to control my rover. When I move the throttle stick to the bottom, the PWM output value of servo 3 is SERVO3_MIN (which is expected). But when I move the throttle stick to the top, the PWM output value of servo 3 is SERVO3_TRIM, and I believe it should go to SERVO3_MAX instead. And when I leave the throttle idle (middle position), then the PWM output value of servo 3 is (SERVO3_MIN + SERVO3_TRIM) / 2. And I’d like it to be SERVO3_TRIM.

Edit I did a 5 minutes video that illustrates the problem: https://youtu.be/Exdzc7yfzqw

I’m new to ardupilot and UAVs/ROVs (4 months now), and I’m not sure how I’m supposed to handle this behavior:

I have managed to make a pseudo-working rover. Here’s my minimal setup:

  • Pixhawk 2.4.8 clone
  • Brushed ESC (but behaves as a brushless ESC, I can’t get it to work with MOT_PWM_TYPE other than “Normal”)
  • I’m connected to qgroundcontrol on windows using an USB cable
  • I’m trying to control the rover using an usb gamepad

My goal is to control the rover using UAVMatrix in 4g, which is why I’m not using a traditional RC transmitter.

My problem is that in manual mode, my gamepad joystick can change the SERVO3 value from SERVO3_MIN (which I set to 1000), and SERVO_3 TRIM (which I set to 2000).

Now using this setup it works. When the gamepad throttle is in the middle I have PWM at 1500 and the vehicle is idle.

The problem is that when it switches to “Hold” mode, then SERVO3 value goes to 2000 (because it’s TRIM, that’s expected), and it goes full throttle.

Also I had to disable the PWM output when disarmed, because if not then disarming the vehicle as the same effect. And that’s a bit annoying because when I arm the vehicle it goes full throttle for half a second (probably because the ESC catches up).

So I’m wondering why the gamepad doesn’t allow the values to go from SERVO3_MIN to SERVO3_MAX?

Here’s my parameters in case that helps: roverpb.txt (26.4 KB)

Let me know if I can provide you any other information.

Thanks for your help!

Set Trim to 1500 and max to 2000.

Thanks for the answer. I’ve tried that, but then servo output only goes from 1000 to 1500 (backwards)

I have only used Mission Planner with a Game pad and Rover. I’ll check out QGC and see how it works.

Edit: OK it works fine in QGC.Did you calibrate the joystick and select “Center stick is zero throttle” and check “allow negitive thrust”? The servo output needs to be Min ~1000, Trim ~1500, max ~2000.

Thanks again. Yes I did all that. Here’s a 5 minutes video that illustrates the problem: https://youtu.be/Exdzc7yfzqw

I don’t know why that Game Pad isn’t calibrating. Throttle should be at 1500 center stick regardless of what mode it’s in. Post a .bin log.

Yeah, it’s strange. Do you think it’s a gamepad issue? It’s a pretty bad one indeed. I’m supposed to get a new one on Monday, I’ll update if that solves the problem. Thanks again for the help!

I don’t know. I have a Logitech controller but I think Game Controllers and Joysticks are a poor way to control an RC vehicle. I only tried it because it was in the junk drawer and thought it would be interesting. I used to use it for the SITL Simulator but I can use my Taranis radio now for that so no point in using the joystick.

I agree game controllers are not ideal, but I’m trying to control the vehicle using 4g, which allows unlimited range, so I need to use the joystick feature.

I just tried using a traditional TX plugged in with USB (Spektrum DX6i) and I get the same problem.

Playing around with the MAVLink Inspector. I’ve noticed:

  • In RC_CHANNELS, chan2_raw ranges from 1106 (min throttle) to 1980 (max throttle)
  • In RC_CHANNELS_SCALED, chan3_scaled ranges from -10,000 (min throttle) to 0 (max throttle)

So I guess the problem is in the scaling…

Ok! I think I nailed it! So I had an RC2_TRIM parameter set a 1980 for some reason (if someone knows what could have caused that). I’ve set it to 1500 and it works!

Thanks again for your time @dkemxr

You can use your standard RC Transmitter if you wanted to. It’s fairly straightforward with a cheap Flight Controller running BetaFlight. I use a $18 Omnibus F4 board. Then your Transmitter looks like a Joystick in Mission Planner or QGC. Or any Windows application really.

F4 joystick

That’s a nice trick! Thanks for the tip.

If you are intersted in trying it Google “Betaflight Game Controller” and you will find some links to the usual RC Blabbermouths :grinning: