Airplane mode

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Newby550
Posts: 2
Joined: Fri Aug 08, 2014 7:57 pm

Re: Airplane mode

Post by Newby550 »

I too have a Multiiwii pro project with using several flight frames with the intent of using the MWFC in "airplane" mode to map out farming ground as a multispectographic mosaic to look for "skips" and other ferteliser application results, as well as crop damage from wild life. This project as we were all told is duanting as there are already other F/C's that have this capability but at a staggering 50 times as exspensive as this flightboard! It took me close to year and a half to get comfortable and build and fly multies from 250mm quad to a 650mm HEX. Total of four complaetly atonomus multirotors and then our "Governor" Butch Otter banned all multirotors in the state of Idaho.
So since I cut my teeth on fixed wing and there is no leagal issue, my tiny little company that has been building multies for farmers has taken a different direction. "Fixed Wing aireal Mapping and inspection drones". This thread is a god send to us, as there are only two of us "Engineers" here at "Prarrie Drones" and as we thought this board could deliver on what we wanted to accomplish,,,,finding this thread and all that has been done in reguards to this endevor will be our companies new home page for all documented success and failiers to follow. I too have looked high and low for "Eos Bandy's" original intent when he wrote this open ended software, only to find it was incoperated into the basic premiss for the software. So it looks like we will be guinee pigs for what is to come. We have purchased three "Bixler3's" to use as our test beds, and the challenge is to fly to "Craigmont" and back,, using the plane to map all in between in the 20 mile trip.
So thanks for starting this thread, and look forward to add to this and pull what we can use from it as well.

rubadub
Posts: 154
Joined: Mon Apr 28, 2014 2:36 am

Re: Airplane mode

Post by rubadub »

@PatrikE
It seems that GPS HOLD always seems to cause the plane to bank/turn right. Is this by design or pure coincidence? If this is intentional, is there a way to bias GPS HOLD to turn left instead of right?

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Airplane mode

Post by PatrikE »

Yes it probably is.
If i remember correct...

Code: Select all

if(diff > ABS(170))  diff =180;

It's there to make a deadspan around +/-180 degrees diff.
Otherwise the plane can have some left/right decisions before the turn.
Like if you meet someone on the pavement.. (left or right side?)

The plane can fly away several hundred meters if its a fast plane before it navigate properly.

Just test to comment the line and it will turn randomly.

rubadub
Posts: 154
Joined: Mon Apr 28, 2014 2:36 am

Re: Airplane mode

Post by rubadub »

PatrikE wrote:Yes it probably is.
If i remember correct...

Code: Select all

if(diff > ABS(170))  diff =180;

It's there to make a deadspan around +/-180 degrees diff.
Otherwise the plane can have some left/right decisions before the turn.
Like if you meet someone on the pavement.. (left or right side?)

The plane can fly away several hundred meters if its a fast plane before it navigate properly.

Just test to comment the line and it will turn randomly.


Thanks Patrik.
I found this

Code: Select all

// Wrap Heading 180
      if (navDiff <= - 180) navDiff += 360;
      if (navDiff >= + 180) navDiff -= 360;
      if (abs(navDiff) > 170) navDiff  = 175;          // Force a left turn.


so it appears that it should force a left turn within the deadspan range. Funny, because, in my experience, I've always seemed to have my plane bank right on GPS HOLD and/or RTH. I will test again, but, if, in fact, the plane is definitely turning right, does that mean that there's possibly something reversed in my configuration? some sensor or servo orientation, or possibly something else???

My LRS antenna is on my left wing tip & my 1.2 FPV transmitter is on the right, so I'd like to force it to always turn left (even when the angle favors a right turn) so that my LRS always has a clear LOS back to my position. How should I go about doing this? Should your code automatically bias the turns left if the heading angle is in the range of 170-360 degrees (including 0=>-180 deg range)?

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Airplane mode

Post by PatrikE »

I guess the comment is wrong!... :?
Change to -175 to get a left turn.

Code: Select all

if (abs(navDiff) > 170) navDiff  = 175;          // Force a left turn.

The diff is +/-180 in range.
You can lower the value in the if to get a wider span when it's forced.

Code: Select all

if (abs(navDiff) > 120) navDiff  = -175;

Image
Attachments
ForcedTurn.png
(6.29 KiB) Not downloaded yet

rubadub
Posts: 154
Joined: Mon Apr 28, 2014 2:36 am

Re: Airplane mode

Post by rubadub »

Thanks for all the help Patrik!
I have another question:

What would you think about having the cruising speed for RTH based on the GPS ground speed instead of having it depend on a hard-set, fixed throttle value? Do you see any advantages & disadvantages to such a setup?

I was thinking that it might be easier to just set my cruising speed to a speed value that's comfortably above my stall speed, such as "55km/h", instead of having to make a guess/estimate of what PWM throttle value I'll need. Also, it seems like it would help take wind into consideration (head wind => use more throttle, tail wind => use less throttle). I'm not sure if this could cause some unwanted problems though. I'm also assuming that it would require a new 'speed PID' factor, correct? feedback would be appreciated.

EDIT:
I just looked at the code and saw that there's a 'SpeedBoost' factor that increases(and decreases?) the throttle value if the GPS speed is below a minimum value (defaults to 18km/h).

Code: Select all

//***********************************************//     
// Throttle compensation depending on behaviour. //
//***********************************************//    
  // Compensate throttle with pitch Angle
   NAV_Thro -= constrain(att.angle[PITCH]* PITCH_COMP ,0 ,450 );
   NAV_Thro  = constrain(NAV_Thro,IDLE_THROTTLE ,CLIMBTHROTTLE );

  // Force the Plane move forward in headwind with SpeedBoost
  #define GPS_MINSPEED  1390  // 500= ~18km/h
  #define I_TERM        0.1f
  int16_t groundSpeed = GPS_speed;

  int spDiff=(GPS_MINSPEED - groundSpeed)*I_TERM;
  if(GPS_speed < GPS_MINSPEED-50 || GPS_speed > GPS_MINSPEED+50)SpeedBoost += spDiff;
  SpeedBoost = constrain(SpeedBoost,0,500);
  NAV_Thro += SpeedBoost;
 

(I increased the GPS_MINSPEED value to 1390, 50km/h)

Could this be expanded so that it completely handles all of the throttle control? i.e., instead of just using GPS speed for setting a minimum speed, have it also set for min, max, and cruising speed, vs. relying on PWM values for min, max, & cruising throttle. How would this sound?

Also, just an FYI...
I noticed that this line:

Code: Select all

   NAV_Thro  = constrain(NAV_Thro,IDLE_THROTTLE ,CLIMBTHROTTLE );

comes *before* the SpeedBoost code, so, in theory, the NAV_Thro value could possibly go over the IDLE_THROTTLE and CLIMBTHROTTLE endpoints.

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Airplane mode

Post by PatrikE »

To base Cruise speed on GPS can be adventurous.
Theoretical you can fly 30 km/h in gps speed.
If windspeed also is 30km/h You can get a True Airspeed Between zero and 60km/h depending on wind direction.
To use a PWM value gives a more constant Airspeed in theory.
But Yes you can do the modification on your own risk.

Also, just an FYI...
I noticed that this line:

Code: Select all

   NAV_Thro  = constrain(NAV_Thro,IDLE_THROTTLE ,CLIMBTHROTTLE );

comes *before* the SpeedBoost code, so, in theory, the NAV_Thro value could possibly go over the IDLE_THROTTLE and CLIMBTHROTTLE endpoints.

The constrain limits The input from Altitude error.
SpeedBoost is added after to ensure that the plane should increase speed.

You want to go for a airspeed sensor instead.
It's included in the latest Fixedwing Nav code based on PRE 2,4 code.
viewtopic.php?f=7&t=2456&p=61472#p61459

rubadub
Posts: 154
Joined: Mon Apr 28, 2014 2:36 am

Re: Airplane mode

Post by rubadub »

ok, thanks for the info Patrik.
I didn't fully understand your explanation of the wind affecting the GPS speed, it somewhat confuses me, but I'll take your word for it :) I just assumed you'd want to use the GPS speed as an indication about whether or not the plane is actually moving forward, vs. possibly stalling, but I guess that it doesn't work this way.

Unfortunately, I don't have an airspeed sensor, so I'll have to settle for the more basic way of doing it.

btw, It seems I was on the wrong thread, so I'm switching over to the 'Airplane RTH' thread for future posts.

Also, I just wanted to say the following: Before working with your code, I didn't have much experience with planes or FPV'ing planes (only with multi-rotors). I was ok with flying a plane LOS in either manual mode or with basic stabilization, but I never had a setup that provided GPS/RTH failsafe capabilities that I'd need for FPV and going further out.

I initially tried to build a plane with the APM flight controller with the idea of having it simply provide RTH, but it ended up being far from simple. I experienced nothing but problems and multiple costly crashes. It discouraged me to the point where I ended putting my FPV plane project(s) completely on hold for fear of having any more complications and crashes.

However, out of desperation, I decided to give your fixed-wing code a shot, and I have nothing but great things to say about it. It was simple to setup and has been solid as a rock. In the short time that I've been using it, It has saved my plane MULTIPLE times from very precarious situations (losing RC signal, losing video, ground station problems, bugs attacking/biting me while flying, etc.,etc.,etc....). So, I just wanted to say THANK YOU for all of the great work that you've done in putting FW_NAV functionality together; your efforts are greatly appreciated by myself & hopefully by many others as well. :D

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Airplane mode

Post by PatrikE »

Really nice to hear...
The RTH code have saved my plane too when i knocked the groundstation over..

A simple math examples about GPSspeed vs Airspeed..

If the plane travels 50km/h in groundspeed = GPS speed.
With headwind of 10 m/s ~36km/h (Quite moderate wind)
True Airspeed adds up to 50 + 36 = 86 km/h.
A slowflyer can break because of overspeed in similar conditions.

Same condition but flying with wind from behind.
True Airspeed will be 50 -36 = 14 km/h..
Most planes have stalled for a long time ago!...

So relaying on GPS for speed is ok with NO wind.
Using PWM will ensure the motor drive the plane in same speed against Airflow.
In my imagination it should result in a more stable Airspeed.

And the speedboost is just there to prevent the plane to hover like a kite in the wind and force it forward.
My Testplane can handle 10m/s with speedboost and still manage to penetrate the wind.
Without the speedboost it was flying backwards against the ground.
Then the plane will never return to home!..

Ok that was a quite long answer but hopefully it clears up thoughts

marcdornan
Posts: 5
Joined: Thu Mar 05, 2015 11:43 pm

Re: Airplane mode

Post by marcdornan »

Newby550 wrote:I too have a Multiiwii pro project with using several flight frames with the intent of using the MWFC in "airplane" mode to map out farming ground as a multispectographic mosaic to look for "skips" and other ferteliser application results, as well as crop damage from wild life. This project as we were all told is duanting as there are already other F/C's that have this capability but at a staggering 50 times as exspensive as this flightboard! It took me close to year and a half to get comfortable and build and fly multies from 250mm quad to a 650mm HEX. Total of four complaetly atonomus multirotors and then our "Governor" Butch Otter banned all multirotors in the state of Idaho.
So since I cut my teeth on fixed wing and there is no leagal issue, my tiny little company that has been building multies for farmers has taken a different direction. "Fixed Wing aireal Mapping and inspection drones". This thread is a god send to us, as there are only two of us "Engineers" here at "Prarrie Drones" and as we thought this board could deliver on what we wanted to accomplish,,,,finding this thread and all that has been done in reguards to this endevor will be our companies new home page for all documented success and failiers to follow. I too have looked high and low for "Eos Bandy's" original intent when he wrote this open ended software, only to find it was incoperated into the basic premiss for the software. So it looks like we will be guinee pigs for what is to come. We have purchased three "Bixler3's" to use as our test beds, and the challenge is to fly to "Craigmont" and back,, using the plane to map all in between in the 20 mile trip.
So thanks for starting this thread, and look forward to add to this and pull what we can use from it as well.


Listen, this is probably heresy on this board. If you are commercially doing fixed wings applications pick up some APM 2.6 (clones cost $50) and use Arduplane. Open source. Mature. Fully autonomous. Very reliable and the obvious choice for what you are doing. While you are at it get some RFD 900 modems for long range telemetry to Mission Planner. What you are trying to do is has been extensively done for APM, right down to camera triggering! It just seems batty to use MW for this.

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Airplane mode

Post by PatrikE »

Actually it works on MWii too.
I Have added the Fixedwing dev to the Pre V2.4.
It can run on a Dirt-cheep 328 FC with limited number of Waypoints.
There's downloadlinks on the Howtoo.
http://fotoflygarn.blogspot.com/2014/04 ... plane.html

But i Agree APM is a good platform but i prefer to play around with MWii.

There's a thread with much info in on the forum.
viewtopic.php?f=7&t=2456

marcdornan
Posts: 5
Joined: Thu Mar 05, 2015 11:43 pm

Re: Airplane mode

Post by marcdornan »

PatrikE. Not sure if you were replying to me. Did not in any way mean to disparage the project here. I will certainly try it out. Just thought the person doing semi-commercial work should check out APM.

rojowe
Posts: 9
Joined: Wed Dec 02, 2015 11:00 pm

Re: Airplane mode

Post by rojowe »

Can anyone help explain how to set up a V-Tail in Multiwii 2.4?

Or is it possible to only use aileron and elevator, but use the rudder servo as the 2nd elevator servo?


Thanks for any help, hopefully someone is still active and able to help.

Post Reply