Naze32 in Airplane mode, How do i setup FLAPS?

Post Reply
Michael van der hoek
Posts: 39
Joined: Fri Nov 29, 2013 1:33 pm

Naze32 in Airplane mode, How do i setup FLAPS?

Post by Michael van der hoek »

I bought myself another naze32 for my bixler airplane. Love the naze board on my quad so i thought, why not on my bixler.

So i fitted the board in the plane, pur baseflight on the board, set everything up as it should and then it was time for Flapperons. Not that u need them on a bixler but just for fun.
But, i can't figure out how to set them, it seems like, flapperons isnt a mixer, feature or set function.

I tried the search a dozen of times but i can't get the answer clear. The one answer i found looks a bit to heavy for me.
I think they talked about changing the baseflight code, and i dont have a clue how i should do that.

I'm flying the bixler on my futaba 6exap with an 6ch. receiver. channels left are 5 and 6, i would love the flaps on ch, 5.

Has anyone a tip for me?

gr Michael

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by timecop »

Yeah, flaperons aren't available in airplane mixer yet. You can do regular 3-servo plane mixer, but slowflaps and flaperons are fail. The current code for that in multwii is so fucking nasty I didn't wanna deal with copying it over.

If you feel like trying to add it, its in mixer.c airplaneMixer() or so. But there's extra set/etc variables that would need to be exposed to properly implement it.

Michael van der hoek
Posts: 39
Joined: Fri Nov 29, 2013 1:33 pm

Naze32 in Airplane mode, How do i setup FLAPS?

Post by Michael van der hoek »

Hey timecop, tnx for answering. To bad flaps arent working yet. But ill have to fly without them then.

Like i said, im not that handy with programming. In some other topic they were talking about:
'Define flapperons aux2' and that kind of stuff, but that is what you mean with looking in the airplanemixer right?

I can program flapperons in my futaba 6exap but when i use the flap switch 1 servo must be reversed. And it is not on ch. 5 like i would.

EDIT: Also, is there any way to mount the board reversed, so the front of the board is the backside of the plane? That would make it much easier for me to acces the USB port and connect my servo's.

Gr Michael

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by timecop »

mounting at any direction = yes.
just rotate it and set align_board_yaw=180 or whatever angle. Also works for mounting it sideways / upside down / etc, with align_board_pitch/roll. Anyway, just to turn it around it works fine.

No, the flaperons/slowflaps code is commented out because its fucking UGLY. I'm super busy these days with real work but I know this stuff needs to happen sooner or later.

Michael van der hoek
Posts: 39
Joined: Fri Nov 29, 2013 1:33 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by Michael van der hoek »

So for mounting it upside down, calibrating the acc and mag isnt enough? In baseflight GUI the art. horizon is already how it should be while the board is upside down.

I just have to set align board yaw 180 and roll 180, because is you set pitch at 180 its back to normal right? I mean, when u set yaw at 180 the front is back, and when u set pitch at 180 the front is front again.

I'll first fly without flaps, dont need them for flying but it should be fun. To bad i cant help you, i dont even know where to begin :D So i just stay far away of the code :D

gr

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by timecop »

board_align_* stuff is for rotating the board. Why are you touching roll + yaw? Are you going to mount it vertically?

Michael van der hoek
Posts: 39
Joined: Fri Nov 29, 2013 1:33 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by Michael van der hoek »

no, upside down and reversed.

frog32
Posts: 55
Joined: Sun Nov 20, 2011 9:39 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by frog32 »

Does baseflight support mavlink? i am not talking about being able to alter every parameter using mavlink like this crazy thing https://github.com/slashphotos/harakiri ... nk_param.c i am only interested in getting flight data out of the controller during flight

currently i am looking through the diff between harakiri and baseflight, i will post my results once i am done. the diff is about 17000 lines long but a lot of stuff it is just reformating or moving code around.

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by timecop »

Michael van der hoek wrote:no, upside down and reversed.


It might work, just give it a try.
I wouldn't use this rotation for anything other than gyro+acc tho.

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by timecop »

frog32 wrote:Does baseflight support mavlink? i am not talking about being able to alter every parameter using mavlink like this crazy thing https://github.com/slashphotos/harakiri ... nk_param.c i am only interested in getting flight data out of the controller during flight

currently i am looking through the diff between harakiri and baseflight, i will post my results once i am done. the diff is about 17000 lines long but a lot of stuff it is just reformating or moving code around.


No mavdink. And probably won't happen unless there's a damn good reason.
All the mavlink ground stations are fucking horrible looking.

Michael van der hoek
Posts: 39
Joined: Fri Nov 29, 2013 1:33 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by Michael van der hoek »

i mounted it upside down and backwards, did the set aligns and all looks fine.

Why do you think it cant be used for baro and horizon?

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by timecop »

oh baro and horizon is fine.
i'm not sure what effect it will have on mag calibration.
the "proper" way would be to rotate the attitude vector, and not just result of sensor outputs. I think we're sorta doing this with align_board stuff tho, but still unsure if mag data is relevant.

But yeah gyro/acc/baro/wahtever should be OK.

Michael van der hoek
Posts: 39
Joined: Fri Nov 29, 2013 1:33 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by Michael van der hoek »

i'll see when its flying time :D Looks to me when u calibrate the mag and correct the mag decl. then it should be good. North is north, doesnt matter if you're hanging upside down or inside out.

Just calibrate it when the board is in the right pos.

frog32
Posts: 55
Joined: Sun Nov 20, 2011 9:39 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by frog32 »

timecop wrote:No mavdink. And probably won't happen unless there's a damn good reason.
All the mavlink ground stations are fucking horrible looking.


I only want to have mavlink because it's well documented and open. But if you show me a good documentation for frsky i'll write my antenna tracker to talk frsky. But i thought it is a good idea to use an open protocol.

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by timecop »

well, we could start an 'advantages of mavlink' thread, but maybe this one should be about the ugly flaps code in 8bit multiwii.
anyone wanna take a stab at trying to port it over?
and.. frsky protocol is open.. ? http://www.frsky-rc.com/download/down.php?id=114

msev
Posts: 186
Joined: Thu Apr 14, 2011 11:49 am

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by msev »

Frog32, theres already an antenna tracker (a rather nice one) coded, thats supports MSP and frsky, by Kipkool. Search the forum and you'll find it... so mavlink is really not needed.

So back to flaps, I could see two modes being useful, one normal mode where it would just jump to a certain position and another one where the movement of the flaps wouid be gradual, slow. There could also be some mixing with elevator. And lets not forget spoilerons.

Michael van der hoek
Posts: 39
Joined: Fri Nov 29, 2013 1:33 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by Michael van der hoek »

on my bixler i can only use flapperons, i've got no additional flaps on it.

So it would be great if there would be a flapperon mode where u can set an flap angle and the speed of the flapperons.
I think when it jumps to a certain pos. it would cause the plane to dive?

Michael van der hoek
Posts: 39
Joined: Fri Nov 29, 2013 1:33 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by Michael van der hoek »

Any idea when u got the time to take a look at the flaps TC? Still havent got the time and good weather to make her maiden flight with the rev5 board in it. So maybe i can wait the flapperons out and update the firmware first :D

Michael van der hoek
Posts: 39
Joined: Fri Nov 29, 2013 1:33 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by Michael van der hoek »

quick question, i had my maiden flight yesterday with the bixxler and the naze for stab. everything works just fine, having horizon on flies heavenly.
Baro is working also, but baro is also adjusting my motor rpm. If it is losing some hight it will throttle up and if its gaining some hight it will almost stop the engine. This gives a bit of an weird flight pattern.

Can i somehow let the naze know it doesn't need to control the motor rpm? when i want to fly fast or slow, the baro only needs to correct the hight.
The naze is powered trough the esc, so i can't just unplug the motor from the naze and connect it straight to the receiver.

any ideas?

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by timecop »

hmm. this is going to have to be something that would need to be done custom in plane mixer.
Right now altitude control is ONLY done by motor rpm - but I guess on airplane it would need to be moving control surfaces instead.

does "advanced tl;dr by NHA" achieve this in 8bit version?

Michael van der hoek
Posts: 39
Joined: Fri Nov 29, 2013 1:33 pm

Naze32 in Airplane mode, How do i setup FLAPS?

Post by Michael van der hoek »

Hey Timecop, i dont really get your answer, advanced what?

Maybe ill have to try to make a custom mixer for my plane? Or is that not an option?

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by timecop »

There's a couple threads by this "nha" fellow in 8bit section
viewtopic.php?f=8&t=2965
and
viewtopic.php?f=8&t=364
That are dealing with airplane mode somehow, I think.
So I'm wondering if they're handling althold for planes differently.
No, custom mixer wouldn't help especially since it only supports motors anyway.

Michael van der hoek
Posts: 39
Joined: Fri Nov 29, 2013 1:33 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by Michael van der hoek »

hey TC, happy new year!

This was the reply in the 8-bit section. Can this be changed in baseflight for my airplane?
Re: Airplane mode

Postby PatrikE » Mon Dec 30, 2013 11:38 am

Hi You can find this row in MultiWii.cpp in the 8-bit version.
Code: Select all
rcCommand[THROTTLE] = initialThrottleHold + BaroPID;

Comment out to disable the input on throttle.
Replace with
Code: Select all
rcCommand[PITCH] += BaroPID;

You might have to change between += or -=.
Please report back.

Patrik

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by timecop »

Try this - but I don't think it's going to work as easy as PatrickE implies.
Because multirotor althold does resetting of BaroI and other shit when throttle channel "changes" something similar would need to happen for Pitch channel as well...
Attachments
baseflight.zip
(64.78 KiB) Downloaded 161 times

Michael van der hoek
Posts: 39
Joined: Fri Nov 29, 2013 1:33 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by Michael van der hoek »

BIG thanks TC, i'm gonna flash the board with that .hex!

Could take a while because my plane is under reconstruction for FPV gear and OSD.
When i have the first flight i will post how it went.

gr

Michael van der hoek
Posts: 39
Joined: Fri Nov 29, 2013 1:33 pm

Naze32 in Airplane mode, How do i setup FLAPS?

Post by Michael van der hoek »

Hey TC, small questions....Well the question is small but i dont know if the excecution is small also. I tried the baseflight u modded and yes, it doesnt use motor rpm anomore for altitude changes, neither does it use its elevator. Can that be changed?
Also, i can now use 2 motors and 2 ailerons. The motors and ailerons are fed via 1 channel, can that be 2 channels? In that case i can use my ailerons as flapperons i think.
And last, it seems rth doesnt work on airplane, when i hit rth the plane starts a small dive and thats it.. Can that be changed?


Oh one last thing, i asked before if the board could be mounted upside down, and that can be done if i set align board at a diff angle, but is it possible that the mag isnt working properly when mounted upside down? I cant get it to work right, did the mag calib dance 5 times already.. Any suggestions?

Thanks in advance!

Michael

bmallory
Posts: 6
Joined: Tue Oct 08, 2013 6:19 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by bmallory »

Hey,

I'm kinda hijacking the thread (tell me if i need to make a new one). I too have a bixler with a naze32 that I have yet to maiden (probably this weekend). I only have 2 modes, horizon and "normal" and I couldn't figure out what is the output channel for the motor. For now the motor channel is plugged directly on the receiver. I read the entire thread and may be it's the best solution for now but for the record I'd like to know what the default output channel for motor in airplane mode and if there's some documentation in general for using a naze32 in airplane mode...

@Michael : I don't know what OSD you're going to use, I have a KVOSD installed and there's some weird things : when throttle is down and yaw is full left, the OSD seems to reset. I don't know if it's the OSD firmware, the airplane mode or just me ( my solder on one of the telemetry pin is kind of ugly).

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by timecop »

In airplane mode, motor is on PWM1 (i.e. Motor#1 in quad mode).
Motor2 is on PWM2, and then 4 servos servo 1..4 below that.

Michael van der hoek
Posts: 39
Joined: Fri Nov 29, 2013 1:33 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by Michael van der hoek »

hey bmallory,

Think i know whats up with your OSD, i have the KV osd as well and i had to use an axtra BEC to power the osd. If you connected all to the naze there isnt enough juice to power all servo's, naze and kv osd. So just seperate that!
The motor channel is already answered bij TC.


@TC, did you read my previouse post? Can you answer it for me? if it is possible or not, if you have the time, and so on?

bmallory
Posts: 6
Joined: Tue Oct 08, 2013 6:19 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by bmallory »

@TC : thanks !
@Michael : you're right the OSD power comes from the board, you've just saved me quite some time researching the issue !

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by timecop »

I don't know if mag works upside down.
Airplane mixer can do 2 motors, all the stuff you're asking for is "doable" but none of it is "configurable".
So you'll have to understand and edit code and rebuild.

Michael van der hoek
Posts: 39
Joined: Fri Nov 29, 2013 1:33 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by Michael van der hoek »

Thanks for answering,

I guess i have to pass on editing the code. I dont even know where to start, what is what and what affects what.
Would be nice to use the naze as an flight stab. with rth capabilities.

EDIT: is there any way to learn how the code works? or is it just trail and error?

bmallory
Posts: 6
Joined: Tue Oct 08, 2013 6:19 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by bmallory »

Well I just cloned the git repo. I don't have a compiling environment and I don't think I'm good enough to contribute to this project but from what I'm seeing, you should have some kind of althold using pitch if you have a baro enabled. there's a line of code specific to a fixed wing.

there's also a lot of "rcCommand[THROTTLE]" all over the place so maybe it's a good thing to plug the motor channel directly to the receiver when testing this. My board is an accro board so I won't be able to test this as I don't have a baro.

Code: Select all

#ifdef BARO
        if (sensors(SENSOR_BARO)) {
            if (f.BARO_MODE) {
                static uint8_t isAltHoldChanged = 0;
                static int16_t AltHoldCorr = 0;
                if (!f.FIXED_WING) {
                    // multirotor alt hold
                    if (cfg.alt_hold_fast_change) {
                        // rapid alt changes
                        if (abs(rcCommand[THROTTLE] - initialThrottleHold) > cfg.alt_hold_throttle_neutral) {
                            errorAltitudeI = 0;
                            isAltHoldChanged = 1;
                            rcCommand[THROTTLE] += (rcCommand[THROTTLE] > initialThrottleHold) ? -cfg.alt_hold_throttle_neutral : cfg.alt_hold_throttle_neutral;
                        } else {
                            if (isAltHoldChanged) {
                                AltHold = EstAlt;
                                isAltHoldChanged = 0;
                            }
                            rcCommand[THROTTLE] = initialThrottleHold + BaroPID;
                        }
                    } else {
                        // slow alt changes for apfags
                        if (abs(rcCommand[THROTTLE] - initialThrottleHold) > cfg.alt_hold_throttle_neutral) {
                            // Slowly increase/decrease AltHold proportional to stick movement ( +100 throttle gives ~ +50 cm in 1 second with cycle time about 3-4ms)
                            AltHoldCorr += rcCommand[THROTTLE] - initialThrottleHold;
                            AltHold += AltHoldCorr / 2000;
                            AltHoldCorr %= 2000;
                            isAltHoldChanged = 1;
                        } else if (isAltHoldChanged) {
                            AltHold = EstAlt;
                            AltHoldCorr = 0;
                            isAltHoldChanged = 0;
                        }
                        rcCommand[THROTTLE] = initialThrottleHold + BaroPID;
                        rcCommand[THROTTLE] = constrain(rcCommand[THROTTLE], mcfg.minthrottle + 150, mcfg.maxthrottle);
                    }
                } else {
                    // handle fixedwing-related althold. UNTESTED! and probably wrong
                    // most likely need to check changes on pitch channel and 'reset' althold similar to
                    // how throttle does it on multirotor
                    rcCommand[PITCH] += BaroPID * mcfg.fixedwing_althold_dir;
                }
            }
        }
#endif

        if (cfg.throttle_angle_correction && (f.ANGLE_MODE || f.HORIZON_MODE)) {
            rcCommand[THROTTLE] += throttleAngleCorrection;
        }

        if (sensors(SENSOR_GPS)) {
            if ((f.GPS_HOME_MODE || f.GPS_HOLD_MODE) && f.GPS_FIX_HOME) {
                float sin_yaw_y = sinf(heading * 0.0174532925f);
                float cos_yaw_x = cosf(heading * 0.0174532925f);
                if (cfg.nav_slew_rate) {
                    nav_rated[LON] += constrain(wrap_18000(nav[LON] - nav_rated[LON]), -cfg.nav_slew_rate, cfg.nav_slew_rate); // TODO check this on uint8
                    nav_rated[LAT] += constrain(wrap_18000(nav[LAT] - nav_rated[LAT]), -cfg.nav_slew_rate, cfg.nav_slew_rate);
                    GPS_angle[ROLL] = (nav_rated[LON] * cos_yaw_x - nav_rated[LAT] * sin_yaw_y) / 10;
                    GPS_angle[PITCH] = (nav_rated[LON] * sin_yaw_y + nav_rated[LAT] * cos_yaw_x) / 10;
                } else {
                    GPS_angle[ROLL] = (nav[LON] * cos_yaw_x - nav[LAT] * sin_yaw_y) / 10;
                    GPS_angle[PITCH] = (nav[LON] * sin_yaw_y + nav[LAT] * cos_yaw_x) / 10;
                }
            }
        }

        // PID - note this is function pointer set by setPIDController()
        pid_controller();

        mixTable();
        writeServos();
        writeMotors();
    }
}

Michael van der hoek
Posts: 39
Joined: Fri Nov 29, 2013 1:33 pm

Re: Naze32 in Airplane mode, How do i setup FLAPS?

Post by Michael van der hoek »

Hey Bmallory,

thanks for the code! But, the althold thing was already changed by TC a while ago. Even so, many many thanks.
I dont know how to change the Original code, or, like i said in previouse post, what triggers what.
So i dont know what to do with your textline..

I like to see an naze with althold, stab flight and rth. Would love to make it myself but i just dont know how :)

Post Reply