Horizon mode enhancement? = Disable levelling when near vert

Post Reply
ctzsnooze3
Posts: 11
Joined: Thu Aug 07, 2014 7:23 am

Horizon mode enhancement? = Disable levelling when near vert

Post by ctzsnooze3 »

Hi

I fly a lot in Horizon mode and I really enjoy it. I do quick flips, rolls etc and have a great time. To whoever made it - thank you! I've noticed, however, that when near-vertical (i.e. nose pointing to sky), the quad is very twitchy - with hardly any throttle at all, it very strongly wants to level out. And of course it's impossible to overcome the levelling while inverted (can't fly straight down for example) in Horizon mode.

So.. I had an idea...

What if, in Horizon mode, there could be a code change to reduce the levelling tendency the further away the quad is from actually being level? Kind of like applying Horizon mode not only based on stick position but also on the actual angle of the quad away from horizontal?

In other words, as the angle away from horizontal increases, levelling is proportionally reduced, until when vertical or inverted, the quad enters acro mode and will not self-level?

This would allow the inverted phase of a slow loop to proceed smoothly, just like a slow loop in acro mode, without having to fight the levelling during the inverted period.

The downside would be that the quad would not try to self-level while inverted, but all the user would have to do is to get it vaguely level and centre sticks and Horizon mode would do it's magic.

I reckon this could be a very fun modification to Horizon mode for advanced Horizon mode pilots - Horizon mode would be active only around the Horizontal plane... allowing much greater Acrobatic possibilities?

Hope this tweaks some interest in people who know how to do these things...

Cheers - Chris

ctzsnooze3
Posts: 11
Joined: Thu Aug 07, 2014 7:23 am

Re: Horizon mode enhancement? = Disable levelling when near

Post by ctzsnooze3 »

If anyone is interested, I think that I may have arrived at a possible solution, thanks to the assistance of several people here:

in multiwii.cpp, at

#if PID_CONTROLLER == 1 // evolved old school


comment out the default so it's like this:

//if ( f.HORIZON_MODE ) prop = min(max(abs(rcCommand[PITCH]),abs(rcCommand[ROLL])),512);


then put this in its place:
// this uses equal angle and horizon mode corrections - limited to 425 empirically
// when vertical is half acro even with centred sticks
// needs better inverted code doesn't know its inverted
if ( f.HORIZON_MODE ) {
prop = min(max(abs(att.angle[PITCH]),abs(att.angle[ROLL])),900); // prop is 0 when level 900 when vertical if 10 per degree
prop = prop + (min(max(abs(rcCommand[PITCH]),abs(rcCommand[ROLL])),500)<<1); // prop plus 2x borizon ie up to 1900
prop = min(prop>>2,425); // divide by 4 so max practically 475 limit to 425 bc it works best like this I think
}


Here's a video of what it does in hand testing:

https://www.youtube.com/watch?v=-eKqtMAei4Y

I've found this code to give much better control with acro-type qualities in Horizon mode - even when the quad is vertical to slightly inverted, it's smooth all the way. Additionally, it will self-level in nearly all orientations if you want it to.

Please give it a try and compare it to the default Horizon code at near-vertical quad orientations.

Cheers

C

Post Reply