Alternative HEADFREE

Post Reply
jpeti29
Posts: 22
Joined: Wed Mar 07, 2012 9:19 am
Location: Hungary

Alternative HEADFREE

Post by jpeti29 »

Hi!

What if there will be an alternative HEADFREE mode? In this version the reference direction vector would be the vector of home position and copter position. So combined with ANGLE mode if the pitch is pulled the copter would fly closer to the home pos, pushing it would make cthe copter fly further, pushing the roll left and right would make the copter fly around the home pos.

Any Opinion?

User avatar
EOSBandi
Posts: 802
Joined: Sun Jun 19, 2011 11:32 am
Location: Budapest, Hungary
Contact:

Re: Alternative HEADFREE

Post by EOSBandi »

jpeti29 wrote:Hi!

What if there will be an alternative HEADFREE mode? In this version the reference direction vector would be the vector of home position and copter position. So combined with ANGLE mode if the pitch is pulled the copter would fly closer to the home pos, pushing it would make cthe copter fly further, pushing the roll left and right would make the copter fly around the home pos.

Any Opinion?

Yeah, this is exactly how arducopter's carefree mode works... you have to check the distance to home and enable it only after 10-15 meters otherwise the direction will too noisy. Actually this is about 3-4 lines of code...

jpeti29
Posts: 22
Joined: Wed Mar 07, 2012 9:19 am
Location: Hungary

Re: Alternative HEADFREE

Post by jpeti29 »

Yes, you are right. the problem is the home near behavior. I think there is no good solution. Maybe when the copter is step into the 15m range, the direction vector shouldn't change anymore. I think the NAZA is working same way too.

nhadrian
Posts: 421
Joined: Tue Oct 25, 2011 9:25 am

Re: Alternative HEADFREE

Post by nhadrian »

Hi,

here you are:

1) in multiwii.ino, modify this:

Code: Select all

     ...
      if (rcOptions[BOXHEADFREE]) {
        if (!f.HEADFREE_MODE) {
          f.HEADFREE_MODE = 1;
        }
      } else {
        f.HEADFREE_MODE = 0;
      }
      if (rcOptions[BOXHEADADJ]) {
        headFreeModeHold = heading; // acquire new heading
      }
    #endif


to this:

Code: Select all

     ...
      if (rcOptions[BOXHEADFREE]) {
        if (!f.HEADFREE_MODE) {
          f.HEADFREE_MODE = 1;
        }
        #if defined(ADV_HEADFREE)
          if ((f.GPS_FIX && GPS_numSat >= 5) && (GPS_distanceToHome > 15)
            #if defined(ADV_HEADFREE_RANGE)
              && (GPS_distanceToHome > (ADV_HEADFREE_RANGE))
            #endif
          ) {
            if (GPS_directionToHome < 180)  {headFreeModeHold = GPS_directionToHome + 180;} else {headFreeModeHold = GPS_directionToHome - 180;}
          }
        #endif             
      } else {
        f.HEADFREE_MODE = 0;
      }
      if (rcOptions[BOXHEADADJ]
        #if defined(ADV_HEADFREE)
           && ((GPS_distanceToHome < 15)
           #if defined(ADV_HEADFREE_RANGE)
             || (GPS_distanceToHome < (ADV_HEADFREE_RANGE))
           #endif
           || (!f.GPS_FIX || GPS_numSat < 5))
        #endif
      ) {
        headFreeModeHold = heading; // acquire new heading
      }
   #endif


2) in config.h, add this:

Code: Select all

  /**************************************************************************************/
  /***********************            Advanced HEADFREE        **************************/
  /**************************************************************************************/

    /* Advanced Headfree mode.
       When the copter is out of defined range, the headfree orinetation will be always towards from home position.
       Generally that means, when pull the pitch stick, copter will come closer. Once copter is inside defined range again,
         it will maintain the last headfreeorientation. This orientation can be still reset using HEADADJ function (only inside defined range).
       Please note that the default orientation before getting out of range is the armed position (just like before). 
       If HEADFREE_RANGE is commented, 15 m will be the default range. Please note that for safety reasons minimum range is 15 m, even is less is defined!!!  */

    #define ADV_HEADFREE
    #define ADV_HEADFREE_RANGE 15          // in m - activation range around home point


Now, if copter is out of defined range (or 15m by default is no range is defined), headfree will be positioned regarding to home direction (if pull the pitch, copter will come closer).
Please note that HEADADJ is working inside defined range only.

I just tested in the air, worked great.

BR
Adrian
Last edited by nhadrian on Thu Jan 17, 2013 5:15 pm, edited 1 time in total.

jpeti29
Posts: 22
Joined: Wed Mar 07, 2012 9:19 am
Location: Hungary

Re: Alternative HEADFREE

Post by jpeti29 »

Gooood, very goood :-)

Great Thx!

sismeiro
Posts: 173
Joined: Tue Feb 21, 2012 12:33 pm

Re: Alternative HEADFREE

Post by sismeiro »

Hi to all,

Just one question, is this new mode independent of GPS or do we need one? I am asking this because of the 15 m range necessary for the mode to work.

Regards,
Luis Sismeiro

jpeti29
Posts: 22
Joined: Wed Mar 07, 2012 9:19 am
Location: Hungary

Re: Alternative HEADFREE

Post by jpeti29 »

FV needs for the GPS not only for range calculation, but the direction vector calculation too. The direction vector is coming from the copter GPS position and the Home Position. It NEEDS an active GPS.

subaru4wd
Posts: 316
Joined: Sat Dec 08, 2012 2:16 am

Re: Alternative HEADFREE

Post by subaru4wd »

I say we name this version HOMEFREE

I still really like the original HEADFREE for LOS filming. But I could see the benefits of this advanced Headsfree for FPV flight.

Post Reply