Mix for smoother steering

Please post all questions and answers in here. This way people can easily see if someone else has the same problem.

Moderators: BeligerAnt, petec, administrator

Post Reply
MySolderIsOlder
Posts: 190
Joined: Mon Jul 30, 2018 1:22 pm
Location: Kent

Mix for smoother steering

Post by MySolderIsOlder »

Morning all,
Another DX6i question I'm afraid. Should have worked this out by now but still got me foxed. If I'm using Tx mixing on the Spectrum, is there a way to make the steering less sensitive/twitchy without reducing straight line speed? I'm finding a lot of the time that small sideways stick movements cause the robot to steer really hard left or right. As a naturally bad driver (I know - I should practice driving my ants more but too busy making them) I'd prefer a more controlled and exponential steering experience.

With those robots using ready-made ESCs with on-board mixing, I' was able to make the steering less twitchy by using the exponential settings on the Aileron channel (so at the lower end, you have to move the stick further to get the same deflection but the upper limits remain the same). However, where I'm using my DIY servo-board based controllers with Tx mixing, that all got a bit confusing (tried lots of settings but typically ended up steering faster one way than t'other, or losing straight line speed).

My current mix on the DX6i is as follows:
Mix 1: Aile -> Elev Rate D -100% U -100%
Mix 2: Elev -> Aile Rate L +100% R +100%

Have to admit I still find the whole mixing business a little hard to get my head around properly. Seen various explanations on Youtube but they're all aimed at model airplane users - and knowing nothing about that end of things, I'm struggling to make the concepts transfer over to our world.
Anyone got any tips for improving controlability - or links for good robot-oriented explanations of mixing?

Cheers,
Stuart
Stuart (Tony's dad)
User avatar
MarkR
Posts: 375
Joined: Mon Dec 18, 2017 12:46 pm
Location: Reading Hackspace
Contact:

Re: Mix for smoother steering

Post by MarkR »

I'm not sure if this helps....

I've scaled the steering on my mixing logic to 50%, so it will only drive a maximum of 50% per channel, it is added to the drive on one side and subtracted on the other, the code I use is:

Code: Select all

    
    // Scale steering further, to stop steering too fast.
    steering = steering / 2;
    
    int left = throttle + steering;   
    int right = throttle - steering;   
This is, of course, clamped to the maximum drive for a channel (can't have more than 100%)

I've also got the "squaring" algorithm which makes steering and drive proportional to stick position squared, like:

Code: Select all

static void squaring(int *channel, int maxval)
{
    int32_t c32 = *channel;

    c32 *= abs(c32);
    
    c32 /= maxval;
    *channel = (int) c32;
}
I have these utility functions:

Code: Select all

static int deadzone(int n, int deadzone)
{
    if ((n < deadzone) && (n > (-deadzone))) {
        return 0;
    }
    return n;
}
static int signedclamp(int n, int maxval)
{
    if (n > maxval) return maxval;
    if (n < -maxval) return -maxval;
    return n;
}
So the full mixing code looks like:

Code: Select all

    // inputs should be approx -100..100
    // Clamp them in case out of range
    throttle = signedclamp(throttle, 100);  
    steering = signedclamp(steering, 100);  
    
    throttle = deadzone(throttle, 10);    
    steering = deadzone(steering, 10);    
    // Apply "squaring"
    squaring(&throttle,100);
    squaring(&steering,100);
    // Scale steering further, to stop steering too fast.
    steering = steering / 2;
    
    int left = throttle + steering;   
    int right = throttle - steering;   
   
    // left / right should now have range -150 ... 150
    // Clamp them again at 100
    left = signedclamp(left, 100); 
    right = signedclamp(right, 100); 
... This is what I've found works for me and allows precise but reasonably agile steering, and I can drive at low speed reliably. I'm not a particularly good driver, so I try to compensate with code :)

NB: This runs inside the microcontroller, in the robot, the transmitter does not do mixing in my setup.
Robots: Betsie - RaspberryPi controlled flipper bot with gyro stablisation - too clever for her own good?
Stacie - tidy flipper; 4wd driven by hair bands
User avatar
MarkR
Posts: 375
Joined: Mon Dec 18, 2017 12:46 pm
Location: Reading Hackspace
Contact:

Re: Mix for smoother steering

Post by MarkR »

If it help to see what "squaring" does, check:

https://www.google.com/search?source=hp ... CAc&uact=5
Robots: Betsie - RaspberryPi controlled flipper bot with gyro stablisation - too clever for her own good?
Stacie - tidy flipper; 4wd driven by hair bands
User avatar
Kyro
Posts: 412
Joined: Fri Jan 18, 2019 12:36 am

Re: Mix for smoother steering

Post by Kyro »

no idea on a dx6i...

on my flysky fs-i6 i switch off any onboard mixing and use the elevon mix... i set channel 1 to 100% for drive speed and then i set channel 2 to whichever percentage i feel is a good turning speed...

each of these go from 100% to negative 100% which essentially reverses the direction...

so 100% throttle setting gives full power forward but 50% steering is turning the wrong direction... i just lower it to negative 50% and steering is now the right way...


hopefully you can find something here that will help you with your setup... maybe lowering one of your mixing values will achieve the same results

Mix 2: Elev -> Aile Rate L +50% R +50% maybe
Team Rocket
Trappist 1(4wd grab 'n' lift)
Ton 618 (4wd expanding bot)
Io(4wd flipper)
User avatar
Team RobotMad
Posts: 36
Joined: Sat Sep 15, 2018 11:20 am
Location: Milton Keynes
Contact:

Re: Mix for smoother steering

Post by Team RobotMad »

MySolderIsOlder wrote: Tue Mar 10, 2020 9:31 am If I'm using Tx mixing on the Spectrum, is there a way to make the steering less sensitive/twitchy without reducing straight line speed?
not sure if its the case for the dx6i, but in the dx7s the 'Travel' for each channel can be changed. so when i find a robot has very sensitive steering i turn down the maximum travel of the steering channel.
Lincoln Barnes
Maker of "SmartAnts", and other autonomous projects.
Electronic enginering student at Nottingham Trent University.
PM to order the RM NanoESC
MySolderIsOlder
Posts: 190
Joined: Mon Jul 30, 2018 1:22 pm
Location: Kent

Re: Mix for smoother steering

Post by MySolderIsOlder »

Thanks guys - as always I've left it too late to get any driving practice (pah - that's what events are for!) but I will try a few more Mix options.

I dare say eventually I'll want to go down the route of making my own ESCs too - just need to get over my phobia of soldering surface mounted components first :?
Stuart (Tony's dad)
Post Reply