Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Collapse
Brand Logo

ModalAI Forum

  1. ModalAI Support Forum
  2. Software Development
  3. GPS-denied Navigation (VIO)
  4. Switching between Mag+GPS and VIO indoors

Switching between Mag+GPS and VIO indoors

Scheduled Pinned Locked Moved GPS-denied Navigation (VIO)
8 Posts 4 Posters 3.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Rowan DempsterR Offline
    Rowan DempsterR Offline
    Rowan Dempster
    Regular
    wrote on last edited by Rowan Dempster
    #1

    Hi Modal,

    Cleo is looking into using Magnetometer+GPS combo for outdoor heading and positioning. We're wondering how Modal handles the switch between indoor and outdoor flight, specifically how does the EKF2 know when to stop fusing the magnetometer (definitely don't want to try to keep heading via mag inside)?

    Thanks!
    Rowan

    1 Reply Last reply
    0
    • Cliff WongC Offline
      Cliff WongC Offline
      Cliff Wong
      ModalAI Team
      wrote on last edited by
      #2

      Hi there, if you're using GPS+mag+vio then you'll need the following PX4 params changes in addition to our vio_gps_baro.params helper file:

      EKF2_MAG_TYPE = automatic (voxl default)
      EKF2_MAG_CHECK = 1 [or 2/3 for more sensitivity] (voxl default is 0)

      Having mag_check = 1 will activate EKF2's field strength checker such that as you proceed indoors should stop mag fusion completely when the field strength goes outside thresholds (hardcoded within PX4 ~ .4gauss variance). It's similar to GPS's DOP threshold where we expect both (gps and mag) to exceed the thresholds where PX4 will stop fusion of those modalities and eventually use vio solely.

      PX4's logic tries to maintain "smooth flight", so expect some delay/drift as it starts turning on/off the above (i.e. it will not be instant). Hence, adjust performance in those transitions, you'll need to modify ekf2's baro, gps, and mag *_GATE params accordingly.

      Note PX4 will adopt whatever heading is being derived from the activated sensors (GPS/Mag/vio) to construction its "global frame", so proceeding indoors you will still be operating under a global frame coordinate system (will still have a north reference based on last good mag/gps check).

      Rowan DempsterR 1 Reply Last reply
      0
      • Cliff WongC Cliff Wong

        Hi there, if you're using GPS+mag+vio then you'll need the following PX4 params changes in addition to our vio_gps_baro.params helper file:

        EKF2_MAG_TYPE = automatic (voxl default)
        EKF2_MAG_CHECK = 1 [or 2/3 for more sensitivity] (voxl default is 0)

        Having mag_check = 1 will activate EKF2's field strength checker such that as you proceed indoors should stop mag fusion completely when the field strength goes outside thresholds (hardcoded within PX4 ~ .4gauss variance). It's similar to GPS's DOP threshold where we expect both (gps and mag) to exceed the thresholds where PX4 will stop fusion of those modalities and eventually use vio solely.

        PX4's logic tries to maintain "smooth flight", so expect some delay/drift as it starts turning on/off the above (i.e. it will not be instant). Hence, adjust performance in those transitions, you'll need to modify ekf2's baro, gps, and mag *_GATE params accordingly.

        Note PX4 will adopt whatever heading is being derived from the activated sensors (GPS/Mag/vio) to construction its "global frame", so proceeding indoors you will still be operating under a global frame coordinate system (will still have a north reference based on last good mag/gps check).

        Rowan DempsterR Offline
        Rowan DempsterR Offline
        Rowan Dempster
        Regular
        wrote on last edited by Rowan Dempster
        #3

        Hi @Cliff-Wong thank you for the response!

        In the version of PX4 that Modal is using (commit: https://github.com/modalai/px4-firmware/blob/b5c45bb232afc6a936b8349f4fa0be1efeb17707/src/modules/ekf2/ekf2_params.c) I see MAG_CHECK as:

        /**
         * Magnetic field strength test selection
         *
         * When set, the EKF checks the strength of the magnetic field
         * to decide whether the magnetometer data is valid.
         * If GPS data is received, the magnetic field is compared to a World
         * Magnetic Model (WMM), otherwise an average value is used.
         * This check is useful to reject occasional hard iron disturbance.
         *
         * @group EKF2
         * @boolean
         */
        PARAM_DEFINE_INT32(EKF2_MAG_CHECK, 1);
        

        Do you suggest updating the EKF2 code to the more recent version that supports more advanced mag health checks:

        EKF2_MAG_CHECK:
              description:
                short: Magnetic field strength test selection
                long: 'Bitmask to set which check is used to decide whether the magnetometer
                  data is valid. If GNSS data is received, the magnetic field is compared
                  to a World Magnetic Model (WMM), otherwise an average value is used. This
                  check is useful to reject occasional hard iron disturbance. Set bits to
                  1 to enable checks. Checks enabled by the following bit positions 0 : Magnetic
                  field strength. Set tolerance using EKF2_MAG_CHK_STR 1 : Magnetic field
                  inclination. Set tolerance using EKF2_MAG_CHK_INC 2 : Wait for GNSS to find
                  the theoretical strength and inclination using the WMM'
              type: bitmask
              bit:
                0: Strength (EKF2_MAG_CHK_STR)
                1: Inclination (EKF2_MAG_CHK_INC)
                2: Wait for WMM
              default: 1
              min: 0
              max: 7
            EKF2_MAG_CHK_STR:
              description:
                short: Magnetic field strength check tolerance
                long: Maximum allowed deviation from the expected magnetic field strength
                  to pass the check.
              type: float
              default: 0.2
              min: 0.0
              max: 1.0
              unit: gauss
              decimal: 2
            EKF2_MAG_CHK_INC:
              description:
                short: Magnetic field inclination check tolerance
                long: Maximum allowed deviation from the expected magnetic field inclination
                  to pass the check.
              type: float
              default: 20.0
              min: 0.0
              max: 90.0
              unit: deg
              decimal: 1
        

        What we are worried about is the mag being used when the measurements are unhealthy.

        Eric KatzfeyE 1 Reply Last reply
        0
        • Rowan DempsterR Rowan Dempster

          Hi @Cliff-Wong thank you for the response!

          In the version of PX4 that Modal is using (commit: https://github.com/modalai/px4-firmware/blob/b5c45bb232afc6a936b8349f4fa0be1efeb17707/src/modules/ekf2/ekf2_params.c) I see MAG_CHECK as:

          /**
           * Magnetic field strength test selection
           *
           * When set, the EKF checks the strength of the magnetic field
           * to decide whether the magnetometer data is valid.
           * If GPS data is received, the magnetic field is compared to a World
           * Magnetic Model (WMM), otherwise an average value is used.
           * This check is useful to reject occasional hard iron disturbance.
           *
           * @group EKF2
           * @boolean
           */
          PARAM_DEFINE_INT32(EKF2_MAG_CHECK, 1);
          

          Do you suggest updating the EKF2 code to the more recent version that supports more advanced mag health checks:

          EKF2_MAG_CHECK:
                description:
                  short: Magnetic field strength test selection
                  long: 'Bitmask to set which check is used to decide whether the magnetometer
                    data is valid. If GNSS data is received, the magnetic field is compared
                    to a World Magnetic Model (WMM), otherwise an average value is used. This
                    check is useful to reject occasional hard iron disturbance. Set bits to
                    1 to enable checks. Checks enabled by the following bit positions 0 : Magnetic
                    field strength. Set tolerance using EKF2_MAG_CHK_STR 1 : Magnetic field
                    inclination. Set tolerance using EKF2_MAG_CHK_INC 2 : Wait for GNSS to find
                    the theoretical strength and inclination using the WMM'
                type: bitmask
                bit:
                  0: Strength (EKF2_MAG_CHK_STR)
                  1: Inclination (EKF2_MAG_CHK_INC)
                  2: Wait for WMM
                default: 1
                min: 0
                max: 7
              EKF2_MAG_CHK_STR:
                description:
                  short: Magnetic field strength check tolerance
                  long: Maximum allowed deviation from the expected magnetic field strength
                    to pass the check.
                type: float
                default: 0.2
                min: 0.0
                max: 1.0
                unit: gauss
                decimal: 2
              EKF2_MAG_CHK_INC:
                description:
                  short: Magnetic field inclination check tolerance
                  long: Maximum allowed deviation from the expected magnetic field inclination
                    to pass the check.
                type: float
                default: 20.0
                min: 0.0
                max: 90.0
                unit: deg
                decimal: 1
          

          What we are worried about is the mag being used when the measurements are unhealthy.

          Eric KatzfeyE Offline
          Eric KatzfeyE Offline
          Eric Katzfey
          ModalAI Team
          wrote on last edited by
          #4

          @Rowan-Dempster Mainline PX4 now works on VOXL 2. It hasn't received that much testing yet but you are welcome to try it out.

          S 1 Reply Last reply
          0
          • Eric KatzfeyE Eric Katzfey

            @Rowan-Dempster Mainline PX4 now works on VOXL 2. It hasn't received that much testing yet but you are welcome to try it out.

            S Offline
            S Offline
            Sarika Sharma
            Contributor
            wrote on last edited by
            #5

            Hii @Eric-Katzfey we wanted to confirm whether ModalAI has a recommended parameter set or procedure to achieve a smooth transition between outdoor and indoor flight on VOXL 2 mini ??

            Eric KatzfeyE 1 Reply Last reply
            0
            • S Sarika Sharma

              Hii @Eric-Katzfey we wanted to confirm whether ModalAI has a recommended parameter set or procedure to achieve a smooth transition between outdoor and indoor flight on VOXL 2 mini ??

              Eric KatzfeyE Offline
              Eric KatzfeyE Offline
              Eric Katzfey
              ModalAI Team
              wrote on last edited by
              #6

              @Sarika-Sharma We have a variety of parameters sets available in the voxl-px4-params repo https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-px4-params/ However, they are mostly for either indoor or outdoor use. Older versions of PX4, like what our fork is based off of, had a hard time with external vision based navigation coexisting with GPS based navigation. Newer versions of PX4, supposedly, are much better at this but we have not spent the time to prepare a parameter set for that yet. You are free to experiment with our mainline PX4 build here: http://voxl-packages.modalai.com/dists/qrb5165/dev/binary-arm64/voxl-mainline-px4_1.17.0-1.0.2-202602240859_arm64.deb. However, if you decide to use the mainline build, be aware that it is considered "experimental" at this point and has very little testing on voxl2 so use extreme caution.

              S 1 Reply Last reply
              0
              • Eric KatzfeyE Eric Katzfey

                @Sarika-Sharma We have a variety of parameters sets available in the voxl-px4-params repo https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-px4-params/ However, they are mostly for either indoor or outdoor use. Older versions of PX4, like what our fork is based off of, had a hard time with external vision based navigation coexisting with GPS based navigation. Newer versions of PX4, supposedly, are much better at this but we have not spent the time to prepare a parameter set for that yet. You are free to experiment with our mainline PX4 build here: http://voxl-packages.modalai.com/dists/qrb5165/dev/binary-arm64/voxl-mainline-px4_1.17.0-1.0.2-202602240859_arm64.deb. However, if you decide to use the mainline build, be aware that it is considered "experimental" at this point and has very little testing on voxl2 so use extreme caution.

                S Offline
                S Offline
                Sarika Sharma
                Contributor
                wrote on last edited by
                #7

                Hii @Eric-Katzfey ,
                I am trying to install the voxl-mainline-px4 package on a VOXL2 Mini (M0104) running VOXL SDK 1.6.3.

                The installation fails due to a dependency on a newer version of libfc-sensor.

                System information

                • Hardware: VOXL2 Mini (M0104)
                • SDK: 1.6.3
                • Installed library:
                libfc-sensor 1.0.9
                

                Command used

                sudo dpkg -i voxl-mainline-px4_1.17.0-1.0.2-202602240859_arm64.deb
                

                Error

                voxl-mainline-px4 depends on libfc-sensor (>= 1.0.10); however:
                Version of libfc-sensor on system is 1.0.9.
                

                Package metadata

                Running dpkg -s voxl-mainline-px4 shows:

                Depends:
                libfc-sensor (>= 1.0.10),
                voxl-px4-params (>= 0.3.10),
                voxl2-system-image (>= 1.5.4),
                modalai-slpi (>= 1.1.16)
                

                Repository check

                The SDK repository only provides:

                libfc-sensor 1.0.9
                
                apt-cache policy libfc-sensor
                Installed: 1.0.9
                Candidate: 1.0.9
                

                Question

                How to solve this issue???

                Thanks.

                Eric KatzfeyE 1 Reply Last reply
                0
                • S Sarika Sharma

                  Hii @Eric-Katzfey ,
                  I am trying to install the voxl-mainline-px4 package on a VOXL2 Mini (M0104) running VOXL SDK 1.6.3.

                  The installation fails due to a dependency on a newer version of libfc-sensor.

                  System information

                  • Hardware: VOXL2 Mini (M0104)
                  • SDK: 1.6.3
                  • Installed library:
                  libfc-sensor 1.0.9
                  

                  Command used

                  sudo dpkg -i voxl-mainline-px4_1.17.0-1.0.2-202602240859_arm64.deb
                  

                  Error

                  voxl-mainline-px4 depends on libfc-sensor (>= 1.0.10); however:
                  Version of libfc-sensor on system is 1.0.9.
                  

                  Package metadata

                  Running dpkg -s voxl-mainline-px4 shows:

                  Depends:
                  libfc-sensor (>= 1.0.10),
                  voxl-px4-params (>= 0.3.10),
                  voxl2-system-image (>= 1.5.4),
                  modalai-slpi (>= 1.1.16)
                  

                  Repository check

                  The SDK repository only provides:

                  libfc-sensor 1.0.9
                  
                  apt-cache policy libfc-sensor
                  Installed: 1.0.9
                  Candidate: 1.0.9
                  

                  Question

                  How to solve this issue???

                  Thanks.

                  Eric KatzfeyE Offline
                  Eric KatzfeyE Offline
                  Eric Katzfey
                  ModalAI Team
                  wrote on last edited by
                  #8

                  @Sarika-Sharma You can get v1.0.10 here: http://voxl-packages.modalai.com/dists/qrb5165/dev/binary-arm64/libfc-sensor_1.0.10-202602041609_arm64.deb

                  1 Reply Last reply
                  0

                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                  With your input, this post could be even better 💗

                  Register Login
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  ModalAI
                  Categories Recent Tags ModalAI.com Docs
                  © 2026 ModalAI® · Accelerating autonomy for smaller, smarter, safer drones · Powered by NodeBB
                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups