Understanding the GPS mode

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download

Understanding the GPS mode

Postby Jazon » Sat May 20, 2017 3:58 pm

Hi there, i want someone tell me if the last release of multiwii do the poshold ??
i read the code but i think the quadcopter never do the position hold because in the code
Code: Select all
if (rcOptions[BOXGPSHOLD]) {                             //Position hold has priority over mission execution  //But has less priority than RTH
              if (f.GPS_mode == GPS_MODE_NAV)
                NAV_paused_at = mission_step.number;
              f.GPS_mode = GPS_MODE_HOLD;
              f.GPS_BARO_MODE = false;
              GPS_set_next_wp(&GPS_coord[LAT], &GPS_coord[LON],&GPS_coord[LAT], & GPS_coord[LON]); //hold at the current position
              set_new_altitude(alt.EstAlt);                                //and current altitude
              NAV_state = NAV_STATE_HOLD_INFINIT;


the f.GPS_BARO_MODE = false; is false so when this is false it never enter in this section
Code: Select all
#if BARO
      #if (!defined(SUPPRESS_BARO_ALTHOLD))
        #if GPS
        if (GPS_conf.takeover_baro) rcOptions[BOXBARO] = (rcOptions[BOXBARO] || f.GPS_BARO_MODE);
        #endif
        if (rcOptions[BOXBARO]) {
          if (!f.BARO_MODE) {//si vaut 0
            f.BARO_MODE = 1;
            AltHold = alt.EstAlt;
            #if defined(ALT_HOLD_THROTTLE_MIDPOINT)
              initialThrottleHold = ALT_HOLD_THROTTLE_MIDPOINT;
            #else
              initialThrottleHold = rcCommand[THROTTLE];
            #endif
            errorAltitudeI = 0;
            BaroPID=0;
          }
        } else {
          f.BARO_MODE = 0;
        }
      #endif
      #ifdef VARIOMETER
        if (rcOptions[BOXVARIO]) {
          if (!f.VARIO_MODE) {
            f.VARIO_MODE = 1;
          }
        } else {
          f.VARIO_MODE = 0;
        }
      #endif
    #endif
    if (rcOptions[BOXMAG]) {
      if (!f.MAG_MODE) {
        f.MAG_MODE = 1;
        magHold = att.heading;
      }
    } else {
      f.MAG_MODE = 0;
    }
    #if defined(HEADFREE)
      if (rcOptions[BOXHEADFREE]) {
        if (!f.HEADFREE_MODE) {
          f.HEADFREE_MODE = 1;
        }
        #if defined(ADVANCED_HEADFREE)
          if ((f.GPS_FIX && GPS_numSat >= 5) && (GPS_distanceToHome > ADV_HEADFREE_RANGE) ) {
            if (GPS_directionToHome < 180)  {headFreeModeHold = GPS_directionToHome + 180;} else {headFreeModeHold = GPS_directionToHome - 180;}
          }
        #endif
      } else {
        f.HEADFREE_MODE = 0;
      }
      if (rcOptions[BOXHEADADJ]) {
        headFreeModeHold = att.heading; // acquire new heading
      }
    #endif


i'm wrong ??? and if the last release do the pos hold so how it's works
thanks
Jazon
 
Posts: 10
Joined: Mon Oct 24, 2016 3:21 pm

Re: Understanding the GPS mode

Postby synersignart » Wed May 24, 2017 3:17 am

which version of multiwii you started with ?
Kinda tricky to understand if your using the GPS over Baro because the 2.4 version did well for me , well on a 2560
User avatar
synersignart
 
Posts: 39
Joined: Wed Mar 22, 2017 3:57 am

Re: Understanding the GPS mode

Postby Jazon » Wed May 24, 2017 5:58 pm

Hi i use the 2.4 ca you explaine me GPS over Baro. but if you see the code and if f.GPS_BARO_MODE = false; is false so when this is false it never enter in this section
Code: Select all
#if BARO
      #if (!defined(SUPPRESS_BARO_ALTHOLD))
        #if GPS
        if (GPS_conf.takeover_baro) rcOptions[BOXBARO] = (rcOptions[BOXBARO] || f.GPS_BARO_MODE);
        #endif
        if (rcOptions[BOXBARO]) {
          if (!f.BARO_MODE) {//si vaut 0
            f.BARO_MODE = 1;
            AltHold = alt.EstAlt;
            #if defined(ALT_HOLD_THROTTLE_MIDPOINT)
              initialThrottleHold = ALT_HOLD_THROTTLE_MIDPOINT;
            #else
              initialThrottleHold = rcCommand[THROTTLE];
            #endif
            errorAltitudeI = 0;
            BaroPID=0;
          }
        } else {
          f.BARO_MODE = 0;
        }
      #endif
      #ifdef VARIOMETER
        if (rcOptions[BOXVARIO]) {
          if (!f.VARIO_MODE) {
            f.VARIO_MODE = 1;
          }
        } else {
          f.VARIO_MODE = 0;
        }
      #endif
    #endif
    if (rcOptions[BOXMAG]) {
      if (!f.MAG_MODE) {
        f.MAG_MODE = 1;
        magHold = att.heading;
      }
    } else {
      f.MAG_MODE = 0;
    }
    #if defined(HEADFREE)
      if (rcOptions[BOXHEADFREE]) {
        if (!f.HEADFREE_MODE) {
          f.HEADFREE_MODE = 1;
        }
        #if defined(ADVANCED_HEADFREE)
          if ((f.GPS_FIX && GPS_numSat >= 5) && (GPS_distanceToHome > ADV_HEADFREE_RANGE) ) {
            if (GPS_directionToHome < 180)  {headFreeModeHold = GPS_directionToHome + 180;} else {headFreeModeHold = GPS_directionToHome - 180;}
          }
        #endif
      } else {
        f.HEADFREE_MODE = 0;
      }
      if (rcOptions[BOXHEADADJ]) {
        headFreeModeHold = att.heading; // acquire new heading
      }
    #endif
Jazon
 
Posts: 10
Joined: Mon Oct 24, 2016 3:21 pm


Return to Software development

Who is online

Users browsing this forum: No registered users and 2 guests