Servers by jDrones

Pivot Turn with Skid Steer enabled

(Daniel Widmann) #1

I have been playing around with a skid steer SITL rover on current master and rover 3.2 . After a bit of reading in the forum I figured out the correct servo configuration and things generally work. But if I try to trigger a pivot turn (e.g. by doing a 90 degree turn), the rover does a turn with a rather large radius instead of turning on the spot as I would expect.

The config parameter PIVOT_TURN_ANGLE, which made this work on older versions, doesn’t seem to have any influence.

Am I missing some other config parameters to make the rover turn more aggressively?


(Sebastian Schürmann) #2

Do you mean pivot_turn in manual mode or in assisted modes (steering, auto, guided etc.)?
It should work in manual mode, but I think there might be a bug in the code preventing skid steer to work in the other modes. I am no expert, but as far as I understand the code, it does auto steering based on lateral acceleration (only?).
This only works while moving forward, which is fine for an ackermann steering vehicle, but forgets about the special case of a skid steering vehicle.

(Daniel Widmann) #3

Thanks for the info. I was using guided mode.

After looking through the code I found the following condition that disables pivot steering in any kind of assisted mode (Steering.cpp, function use_pivot_steering):

// check cases where we clearly cannot use pivot steering
if (control_mode->is_autopilot_mode() || !g2.motors.have_skid_steering() || g.pivot_turn_angle <= 0) {
    pivot_steering_active = false;
    return false;

Removing the condition doesn’t seem work. It might be because throttle control is not aware of pivot turns.

Does anybody know if this is a bug or if pivot turns are not supported in autopilot modes by design?

(Andrés Ábrego) #4

Dev’s are working on it (I think that @khancyr) is expected that next beta will solve that issue.

(Khancyr) #5

It pass on master ! we will reach next beta soon, I hope

(Daniel Widmann) #6

Thanks for the info. I didn’t see the open pull request for skid steering.

Today I tried again with latest master (and the one commit that enables skid steering in auto mode that wasn’t merged).

It works a lot better now, but there still seems to be a few problems:

  • When I do a ~180 degree turn, the motor outputs start jumping (see picture). The reason seems to be that get_forward_speed returns a negative number. As a result the steering signal is inverted and a feedback look is created that moves the rover away from the target.

  • When doing a sharp turn while already moving (e.g. a 90 degree turn in a mission), skid steering is not used. I think the reason is that the throttle is not zero, therefore pivot turns are not used in the motor.

  • There is no slew rate applied to the skid steering motor outputs. As a result it can happen that the motor switches from +100% to -100% between iterations. This might be a problem in some cases.

A solution for the first two points could be to force the throttle to 0 while doing pivot turns. I don’t know the code very so I am not sure if this is the right way to fix the issue.

(Daniel Widmann) #7

I did some more investigation and I think the root cause of the problem is that AR_AttitudeControl uses the measured speed (GPS speed) to detect if the rover is currently reversing. If it is reversing the steering is inverted. But during a pivot turn, the speed is basically zero. Noise in the speed measurements can cause the speed to be a small but negative value, which will invert the steering.

This are the two places where the measured forward speed is used to change the steering:

AR_AttitudeControl::get_steering_out_lat_accel Line 154

    // get speed forward
    float speed;
    if (!get_forward_speed(speed)) {
    // Calculate the desired steering rate given desired_accel and speed
    float desired_rate = desired_accel / speed;

AR_AttitudeControl::get_steering_out_rate Line 212:

    // get speed forward
    float speed;
    if (!get_forward_speed(speed)) {
    // check if reversing
    if (is_negative(speed)) {
        yaw_rate_earth *= -1.0f;

(rmackay9) #8


Thanks for your PRs. I’ve come to the same conclusion as well, that part of the problem at least is that we are relying on the GPS speed (or more accurately the EKF’s speed which comes from GPS+Accels) which is very near zero to decide whether we are reversing or not and instead we should just pass in the “desired reverse” (i.e. are we intending to drive forwards or backwards) from the upper vehicle code.

By the way, there’s also a DO_REVERSE mission command which allows the vehicle to drive backwards around the course (the commands are executed in the regular order but the vehicle drives in reverse). This also doesn’t work well with pivot steering vehicles once we allow skid-steering in AUTO. I think the issue is that the L1 controller is using a GPS based velocity which is inconsistent with the forward-back speed we are using in the higher level rover code.

Anyway, I suspect we shouldn’t worry too much about getting DO_REVERSE to work with skid-steering vehicles but perhaps we should try and keep it working at least for regular steering rovers.

(rmackay9) #9

@Daniel_Widmann, merged your fix for the pivot steering in auto, nicely done!