Pivot Turn with Skid Steer enabled

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?

Cheers,
Daniel

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.

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?

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

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

1 Like

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.

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;
    }
1 Like

Daniel,

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.
https://github.com/ArduPilot/ardupilot/blob/master/libraries/AP_L1_Control/AP_L1_Control.cpp#L224

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.

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

What is the latest of skid steering with pivot and reverse command? I’m currently using 3.2.2. Without reverse, skid steering and pivoting works fine. But when I add reverse, the rover will pivot 180 then start to pivot back and forth… like a wet dog shaking itself dry.

Thanks

RoboBill

RoboBill,

I just tested Rover-3.2 and master with a simple back-and-forth mission with a do-reverse in it and it seemed to work OK. Maybe post a dataflash log?

Here is the log file: https://1drv.ms/u/s!AsZN_h-c802JinYqFwfjzCY5VFHT

It seems I can make reverse work if the rover makes a good approach to the waypoint. Reverse fails if the rover does a last second course correction (like a 90 degree turn) during the final approach to the waypoint.

That means I don’t know how to tune my robot… a given.

Thanks

RoboBill

RoboBill,

I think this is perhaps the wrong log? it doesn’t show the vehicle moving around. In any case:

  • WP_RADIUS is pretty small (0.2m) which explains the tight turns at the end, probably best to increase this to 1m.
  • increasing PIVOT_TURN_ANG to 60 may help resolve the problem.
  • ATC_SPEED_FF is 0.5 but should probably be reduced to zero. Cruise-speed and cruise-throttle act as a feed-forward so this addition feed-forward isn’t required. This is unrelated though.

We may still have a bug of course in the pivot turn logic when reversing so I’ll look into this…

Oops, Sorry. I think this is the right one. https://1drv.ms/u/s!AsZN_h-c802Ji0NbZmjccfLOaA5t

And thanks for the tuning advice, especially the FF tip!!!

Hi @rmackay9,

How do you view the someone parameters in a log file (*.BIN)?

e.g. things like WP_RADIUS , ATC_SPEED_FF etc

Still learning the ropes here with logs.

Hi Esa,

There are two ways that I regularly look at parmeters from a .bin file. The awkward way is to use the MP’s dataflash log viewer and filter by the PARM message. It’s awkward because the parameter list is sorted by their position in eeprom instead of alphabetically.

The second way is to convert the log to a .log file (csv) and open it in Excel. This is what I normally do. If using MP go to Flight Data, DataFlash Logs tab (see bottom left), then “Convert Bin to .Log”

2 Likes

Here is another log file that should have some successful reverses and a few not-so-succesful ones. I did think I could get a successful reverse if the approach was direct without any last minute course correction. NOPE, not so.

Thanks

RoboBill

After some research in these forums regarding skid steering and reverse, I’ve discovered this bug report. It was first discussed in this thread. Is there any hope of this issue being resolved in the not-too-distant future?

Thanks

RoboBill

RoboBill,

I had a look at the log and I don’t see a DO_REVERSE command in the mission list so I suspect the issue you are seeing and the issue in that bug report are different. The bug report is about missions with a DO_REVERSE in them, the vehicle could (and perhaps still can) get stuck.

Maybe what you’re seeing is during a simple back-and-forth waypoint mission. i.e. just two waypoints and you’d expect the rover to drive to one waypoint, stop, do a 180 deg turn and go to the other waypoint.

If this is the problem, then the issue is partially because our pivot turn controller which is not good. I think I have a much improved version that I’m testing now. Until that is ready this may help:

  • increase PIVOT_TURN_ANGLE to 60 so overshoots when pivot turning are less likely to lead to another attempt at a pivot turn
  • reduce TURN_MAX_G to 0.2

By the way, the steering controller is not well tuned. Here is some advice that may help:

  • reduce ATC_STR_RAT_FF to 0.4 (in the logs it looks like it’s been set to “10” or “5” which is far far too high). I actually don’t know what the right value is but it’s lower than 5. The best way to find it is to set ATC_STR_RAT_P to 0 temporarily and then do the live graphing of the desired and achieved turn rate as described at the bottom of this wiki page. If the achieved is not reaching the desired, increase ATC_STR_RAT_FF, if achieved is larger than desired, then reduce ATC_STR_RAT_FF.
  • reduce ATC_STR_RAT_P to 0.2
  • reduce ATC_STR_RAT_FILT to 10
1 Like

Those parameter suggestions really helped. Reverse worked much better but did, on occasion, BURP and go into the wet dog shake.:grinning:

And yes I have been trying the do reverse command and not close 2 wp’s. The real problem is uploading the right bin file. I hope this is the right one.

Thanks

RoboBill