iNavFlight / inav

INAV: Navigation-enabled flight control software
https://inavflight.github.io
GNU General Public License v3.0
3.19k stars 1.49k forks source link

NAV - Fixed wing support #26

Closed digitalentity closed 8 years ago

sppnk commented 9 years ago

Hi, I have seen your last video in youtube with the copter. It is amazing and it seems everything works fine. Good job.

I would like to test RTH with one of my planes (CC3D). I think (not sure) that your code with RTH will work well, except for altitude hold. I will test this with 1.9.0 main this evening and I would like to try ASAP with your branch.

Could you add the altitude from the GPS as a source for barometer reading function (and probably a simple filtering)? And a variable in the CLI just for setup this and try?

I would test this inmediately, as I am already flying airplanes with Cleanflight. Thx.

digitalentity commented 9 years ago

The problem is that fixed wing support in my navigation code is completely absent! If you wish to try it on planes, you'll have to add fixed wing support or wait until somebody else does it. I have fixed wing support planned, but I don't have any timeframe for adding it yet.

digitalentity commented 9 years ago

@sppnk I am soon going to begin coding fixed-wing support and currently have a 1.2m flying wing lying around. Can you assist with setting up Cleanflight for a flying wing (delta mixer)? May be some suggestions of PIDs?

sppnk commented 9 years ago

Sure!! I want assist, but I dont have right now any flying wing. Just three airplanes (ailerons, rudder, elevator & throttle). They are an EasyStar (1400 wingspan) and two miniskywalkers (850 wingspan).

For now, two of them are flying with CF, and the settings are the standard with 1.9.0 version. I haven't touch still this, and they fly well with those settings.

For your info (altought I think you already know it), the main problems with flying wings are the correction in ailerons applied by automated navigation input. This settings should be later in the CLI, so it seems they have to be very diferent between airplanes.

In baseflight RTH airplane implementation, the altitude and heading are taken from GPS readings, and GPS altitude seems be better than real barometer measures in airplanes setups (see baseflight RTH airplane by PatrikE). Thanks to this, simplest boards w/o baro & mag are beeing used for automated navigation & RTH, PH, waypoints, etc. That is the main success for that firmwares, because there are some boards really cheap, like CC3D, that can transform any airplane in much more.

Other thing is the airspeed vs. ground speed, using pitot tube sensor, but I can't help here, so I have never used one.

digitalentity commented 9 years ago

Ok, just to let you know - the work has started on fixed-wing support. First thing to go is ALTHOLD mode. The logic will use BARO if present, otherwise it'll fallback on GPS. Soon I'm going to test GPS as an altitude sensor to see if it gives valid readings.

sppnk commented 9 years ago

Awesome !!! Thx !!

digitalentity commented 9 years ago

@sppnk you can now try the ALTHOLD mode with fixed wing. Grab a latest hex from my dropbox and give it a try. PID to play with in configurator - "VEL". Defaults are probably too high for fixed wing, try zeroing I and D and reducing P by half at first. Please note - this is very experimental. Be ready to switch to manual at all times. This code might behave not the way I ment it to, it might even attempt to crash your plane. Also the code does not control THROTTLE yet, you'll have to manually maintain speed.

digitalentity commented 9 years ago

Also, there is NO manual altitude control yet. The plane should hold altitude, but you won't be able to adjust it yet. Essentially, you will be locked out of pitch control.

marksev1 commented 9 years ago

Digitalentity it might be beneficial for you to look at the algos here https://github.com/EmilsPa?tab=activity (not sure if all the relevant source is there since he distributes in zips also) this thread is relevant also: http://fpvlab.com/forums/showthread.php?27854-NAZE32-for-fixed-wing/page185

marksev1 commented 9 years ago

Since the "patrikE" baseflight for planes branch code is well tested, working and popular.

digitalentity commented 9 years ago

@marksev1 I am already looking at patrickE's code. His algos are pretty straight-forward, but difficult to directly port to nav-rewrite since my implementation is very modular but patrickE's code is a monolyth. Moreover his code is based only on GPS, while my code is designed to use all available sensors. Want more precise heading control? No problem - add a magnetometer. Want better altitude control - simply add a baro, no change to firmware or config. A downside of this is that I can only take a basic idea and implement it from scratch in my framework. This adds bugs.

sppnk commented 9 years ago

@digitalentity , I will try ASAP and report, thx !!

sppnk commented 9 years ago

@digitalentity Should be nice if you announce your FW code and a link to it in the forums, so we could get much more beta-testers than just here in github.

rcgroups and fpvlabs seems to have many users interested in PatrikE code, so they should be also interested in cleanflight FW-NAV. Multiwii forum has also a dedicated cleanflight thread.

marksev1 commented 9 years ago

The accuracy statement is legit, but still nothing can beat the convenience of just using a gps for a plane. So no need to calibrate magnetometer and cover the baro with foam .. Is airspeed sensor support also planned?

marksev1 commented 9 years ago

In any case it is nice that your code covers all the possibilities :)

digitalentity commented 9 years ago

@marksev1 Airspeed sensor is planned, but only as a very distant possibility. Airspeed estimation desribed in http://diydrones.com/forum/topics/wind-estimation-without-an will be done much faster than physical airpseed sensor support.

@sppnk I don't think my code is ready for public beta-testing yet, but this moment is approaching. I'm going to announce public testing on rcgroups when Flyable milestone is reached (https://github.com/digitalentity/cleanflight/milestones/Flyable)

sppnk commented 9 years ago

@digitalentity Thx, Anyway, I hope I could test the new ALTHOLD in my 1400m wingspan plane this week. I will report ASAP.

The expected behaviour should mantain the altitude independently if I use ailerons, throttle and rudder, like a 2D movement, isn't it?

digitalentity commented 9 years ago

Yes, you you won't be able to use elevator yet, I'm working on that part of the code. Also thanks for trying out the FW-code for me! Currently I don't have a plane to test my fixed-wing code - I've crashed my flying wing yesterday due to failed servo. EDIT: GPS is not very precise source of altitude, so expect plane to drift up and down several meters.

sppnk commented 9 years ago

@digitalentity Could you compile a .bin file?. I am having big problems to flash my CC3D through Chrome & USB. May be I have to use FTDI, but not sure if I have also to short some pads inside. That should be annoying if I have to do every time I flash it. No problem if it would be only with FTDI.

To flash Cleanflight I have usually used OpenPilot GCS, which can flash CC3D with .bin files and just USB cable. Sorry.

sppnk commented 9 years ago

Hi, I have been reading about this and it seems that the only way to flash CC3D through USB without shorting the SBL pins inside is if the .bin file is "openpilot bootloader compatible".

The .bin files from CF download pages are like that, so I could flash my CC3D with OpenPilot, but may be I cannot do that with your .hex.

digitalentity commented 9 years ago

A today's build is available here. CC3D BIN is also available. Also, I've implemented manual altitude control - please test and confirm it's working (or not) :smile:

sppnk commented 9 years ago

@digitalentity many thx. I have flashed your .bin with OpenPilot GCS. It shows 1.10.0 Running firmware released on: Sep 2 2015 01:30:33 Board: CC3D, version: 0. Good !

But... I dont see the new "ALTHOLD" mode in the Crhome GUI, so I cannot assign a switch in my transmitter to test this feature !! Can I setup that through the CLI?

digitalentity commented 9 years ago

Oops, sorry, must have missed adding fixed-wing support in flight modes. Will fix asap.

sppnk commented 9 years ago

Please add it also in AIRPLANE config, not only in FLYING WING, because I have only planes to test. Thx.

digitalentity commented 9 years ago

@sppnk grab a Sep03 build. Now flight modes can be configured correctly. You should also now have ability to adjust altitude using pitch stick - in ALTHOLD mode it will control climb rate. Everything related to airplanes is still completely untested.

sppnk commented 9 years ago

@digitalentity Hi, I flashed and now I can see ALTHOLD, POSHOLD and other new modes.

What I have problems now is to configure servo rates. In the Chrome GUI/servos page I have weird numbers, if I change them and save nothing happens. If I choose mixer custom the servos get very hot and noisy (may be the board send high Hz as they woyuld be Escs, not analog servos, I dont know). So I come back to mixer AIRPLANE, and everything go well, except the servo configuration, page. So I cannot invert aileron servos or rates.

Should I use the "servo" command in the CLI to get this working?

I my other planes I have also CC3D, but 1.8.1, because 1.9.0 has the same problem with the configuration of the servos in the GUI. With 1.8.1 I can do this very well.

The problem with CF is there are still few people flying airplanes. This will change with your amazing new code, man !!

digitalentity commented 9 years ago

It is a known problem - https://github.com/cleanflight/cleanflight/issues/991#issuecomment-120187794 , https://github.com/cleanflight/cleanflight-configurator/issues/238 so I guess you'll have to use CLI to configure servos. I don't yet fly airplanes with Cleanflight so I can't help you with this, sorry. Asking on IRC channel or RCGorups will probably help.

sppnk commented 9 years ago

This is what I get:

cleanflight servo

The tab servo in the GUI doesnt work, and I am not able to configure with the CLI. It seems the "servo" command doesnt work and I have to use the new "smix" command, but "smix" only works with CUSTOM mixer. I am really confused now.

Are you branch based in 1.10 or 1.9 ? Should be dificult to compile one based in 1.8.1? As 1.8.1 is the only that works well....

sppnk commented 9 years ago

I am also confused since "servo" command and "smix" command seems to have the same use. I don't know if they are compatible. In your code both of them appear in the CLI...

sppnk commented 9 years ago

Hello @digitalentity , I have opened a issue in main code with number #1288, because all the mapping of the channels don't work well in 1.10 (I think 1.9 neither) and it is impossible to setup an airplane for now. Nor through the configurator, but neither through the CLI.

I have burned two servos making tests....this is annoying. I will look at the code if I can find something to solve the issue, so I dont know where o when they changed the mapping of the channels for CC3D and airplane from 1.8.1, (where everyting is ok) to 1.10 (where it is hell on earth).

digitalentity commented 9 years ago

@sppnk thanks for opening the issue with this. Somebody will look into it soon enough. Might even be me :smile:

digitalentity commented 9 years ago

Blocked until https://github.com/cleanflight/cleanflight/issues/1288 and https://github.com/cleanflight/cleanflight-configurator/issues/238 are resolved

sppnk commented 9 years ago

Hi, added #1290 PR (dirty), and https://github.com/cleanflight/cleanflight-configurator/issues/242#issuecomment-138059790, trying to solve all this thing. Now I can configure some things thanks to your last build, but now I can't connect through Chrome....:-(

digitalentity commented 9 years ago

Good to know that you are working on this. I'll keep an eye on your progress. Thanks!

sppnk commented 9 years ago

Didn't want to open a new issue, so I will explain here my last tests in CC3D.

I have been able to make a complete airplane setup, using digitalentity's last build (06 sept). The steps have been:

Then I send save command and test all the control surfaces work well, and angle mode also, but...

when I switch off and plug again my lipo, the servos respond well to mi transmitter, but when activating angle mode or acro mode the servos dont move when moving the plane. I have checked that the sensors dont send data to the graphic screen in chrome. It seems they are stopped. The box ANGLE goes green.

I could try to test the new NAV_ALTHOLD in passthrough mode, but is too dangerous, haha :-)

sppnk commented 9 years ago

Updated infos on CC3D servomixer issues here: #1076

Something is wrong there, so I am stil not able to test airplane mode.

If anybody has tested 1.10 with CC3D in airplane (digitalentity or master branch) and is flying, please report. Thx !!

digitalentity commented 9 years ago

This issue is still blocked by these: https://github.com/cleanflight/cleanflight/issues/1323, https://github.com/cleanflight/cleanflight/issues/1324, https://github.com/cleanflight/cleanflight-configurator/issues/238

digitalentity commented 9 years ago

@sppnk I think you'd want to know that I'm about to buy a Volantex Ranger 757-4 (http://www.banggood.com/Volantex-Ranger-757-4-FPV-1380mm-Wingspan-EPO-RC-Airplane-KIT-p-985099.html) for purpose of getting airplanes supported by Cleanflight.

sppnk commented 9 years ago

WOW MAN !! Nice bird, congratulations.

Because of the issues with the mapping of CC3D I bought some naze32 and at least I am flying my three birds with baseflight right now (RTH working fine), but in the last days the issue #1323 is active, and hopefully it will be solved soon, so I will be ready to test your code.

And...It seem they want remove openpilot bootloader feature, so it is possible I wont be able to flash my CC3D boards....:-(

MDM63 commented 9 years ago

Here is one tester signing up! I have Bix 3 with flaps, two HK450 helis, CC3D, two STM32F103C8T6 dev boards that support naze32 fw, ST32F4 Discovery dev board and I just got my self made shield PCB's from the manufacturer for it. They where originally meant for TauLabs fw, but since I have developed a interest to make cleanfligh run on it. I also have bunch of sensors (Airspeed with pitot-tube, lots of HC-04's, bunch of different IMU boards, GPS's, etc.) and some FPV gear. My plan is to stuff the poor Bix 3 with the STM32F4 Discovery board and all possible sensors, couple of cameras and make it as autonomous as possible. The goal is to make my own open source HW at some point, because I think currently all the interesting HW is (IMHO) quite over priced. I just can't justify my self spending 100$+ on something I can make my self cheaper, and probably better.

The STM32F103C8T6's are for the helicopters. One of them is going to be a autonomous camera platform and the other I am going to make a nice scale build of Bell 206, with couple of cameras and good flight stabilization and PH.

I am more than willing to help in any way I can. I actually tried to take crack at the servo configuration issue in the configurator, but my (very) limited knowledge of java became too big an obstacle given the amount of time I had to throw at it. I am much more familiar with C.

digitalentity commented 9 years ago

@sppnk I flash my cc3ds through the main port and ftdi adapter. Ranger won't arrive fast, it'll probably be no less than a month before I would have anything to test. I also have to learn to fly airplanes beforehand :)

digitalentity commented 9 years ago

@MDM63, welcome to the club :-) At the moment fixed wing support in my navigation project is almost completely absent. You can have look at navigation-rewrite branch in my repo and give me a hand with developing fixed wing stuff if you like. I'd be happy to receive ideas, insights, bug reports, working code, semi-worki code and even not working code if the idea behind it is good enough :)

digitalentity commented 9 years ago

@sppnk, @MDM63 Waiting for an airplane to arrive soon actually gives a very strong motivation to fix the code as soon as possible :laughing: Wrong servo mapping on CC3D and NAZE is fixed by https://github.com/cleanflight/cleanflight/pull/1425 . Hope @hydra will merge it soon enough.

sppnk commented 9 years ago

Many thanks again @digitalentity . For me, the main need in an airplane is a working RTH. This should be the first thing to work in. A good RTH should have options to take the plane higher and then back to home with a fixed altitude.

After that working well, a position hold (circles) should be nice, because you can use that function to land the plane,in a failsafe for example, just cutting throttle.

Please, try to mantain if possible the Openpilot bootloader files, so I am not able to flash CC3D in other ways (I have tried again and again, but no success). I dont see in your dropbox .bin files anymore.

digitalentity commented 9 years ago

@sppnk In my firmware RTH is dependent on working poshold (its pretty much the same code). RTH will have options to control return altitude.

OBPL is no longer available - it's taking up too much valuable flash memory. I am already dropping features to fit the code in 127kb. Next thing to go is pid controllers. Only pidc 1 and 2 will remain in nearest future.

sppnk commented 9 years ago

Ok, I will try again to flash your .hex. I have ordered two more cc3d just to test.

One question, is poshold already working for fixedwings? (in my lasts attemtps you were working a fixed altitude mode).

digitalentity commented 9 years ago

@sppnk Are you available on RCG or Cleanflight's IRC channel? I might be able to help you out with flashing the hex onto CC3D. Poshold code is committed today, I have no idea if it will work or not :smiley:

sppnk commented 9 years ago

Yes, Im in RCG, but not in IRC. Will post my problems there. Thanks

marksev1 commented 8 years ago

I haven't read through the code, but currently probably flying wing and traditional airplane mixers are supported right? May I suggest adding also a V-tail mixer so that all the widely used configurations of airplanes are supported.

digitalentity commented 8 years ago

All airplane mixers are now supported, but there was a report of a failure on a flying wing. We need to look into it.