Throttle "nudge" in AUTO mode

Rover includes a throttle “nudge” where you can increase the cruise speed manually using the stick. Looking at the code, in theory it seems like it should also work in reverse - back stick should slow you down (reduce target speed) - mode.cpp line 303 - but when I try it in SITL, it doesn’t slow down.

CH3 IN shows my full back input, but there’s no change in ch3% or CH3 OUT. Pushing forward ramps up to maximum speed.

EDIT: I think I’ve found the problem:

 if (((pilot_throttle <= 50) && (target_speed >= 0.0f)) ||
    ((pilot_throttle >= -50) && (target_speed <= 0.0f))) {
    return target_speed;

The first line ignores ANY throttle <50% for positive speed.

If you change it to this, it will allow you to nudge backwards when you’re driving forwards (to slow down) and forwards while going backwards (to slow down the other way).

	 if ((pilot_throttle <= 50) && (pilot_throttle >= -50)) { // If throttle between +/-50%, ignore
    return target_speed;

The only problem now is with the amount of the nudge. Because it starts at your target speed and nudges by the difference between your target speed and max, the most you can nudge is (max-target). As your target goes up, your nudge amount goes down. you can’t stop (command 0) once you’re above half your max speed.

I don’t know the right answer, but maybe “reverse” nudge should be a % of max + target. e.g. if I’m at 3 m/s and my max is 10m/s, then my nudge is up to 13m/s, so I can command -100%.

Thanks for looking into this. So I think it’s working as designed but it’s only designed to allow the user to increase the vehicle’s speed. So pulling the throttle stick back (i.e. commanding negative throttle) has no effect unless the vehicle is moving in reverse (which is rare). We could change the design so that this causes the vehicle to slow down from whatever it’s target speed is (i.e. value held in WP_SPEED or CRUISE_SPEED).

In general, I’m not a huge fan of the throttle nudge. I think any mixing in of pilot input to the autonomous modes muddies the waters of who is in control. I’d personally prefer if people switched the vehicle into another mode if they want to control it manually. Anyway, this is just one opinion and I know other AP developers like the stick mixing.

Anyway, if you want to raise a PR to change the behaviour I’m happy to review it and will probably pull it in.

I’d be keen to throw it open for comment. Here’s how I would envisage the functionality:

Forward / faster nudge as currently implemented.

For a “reverse” / slowing nudge:

  1. If ATC_BRAKE=0, then nudge scales between 0 and target speed (I see pulling into reverse in AUTO mode as a somewhat dangerous thing)

  2. If ATC_BRAKE=1, then nudge scales from current (target) speed to -maximum speed (nominally -100% on the throttle channel). This would give you maximum braking if you pulled all the way back on the stick, and I don’t see it as a safety issue since you’re running brake rather than reverse).

The reason I like this as a way of slowing down in AUTO versus switching modes is that the vehicle keeps navigating while it’s slowing down, so for the RC race car, you are less likely to run into a wall!!

I think it would be best if we don’t rely on the ATC_BRAKE parameter to control this functionality. ATC_BRAKE is really there to specify whether reversing the motor in order to slow the vehicle is OK. This appears similar to but really, this nudging question is about interpreting driver input so it’s quite separate. The pilot’s input is translated into a desired speed and the attitude controller will reverse the motor if required to attain that goal if ATC_BRAKE=1.

one item we should consider is how is this going to work for users with or without sprung throttle. With a sprung throttle I think pulling back on the throttle to make it slow to zero is fairly natural. For non-sprung throttle the user will need to be careful to lift the throttle to the middle or the vehicle will never start moving in Auto mode… although maybe using a non-sprung throttle with Rover is not a good thing to do at all.

There’s a 50% deadband, so I don’t see a big risk - it’s not that hard to get a non-sprung throttle back within that band.

You’re right that zero may be the safest option. I’ll see how I go coding it up.

1 Like