Testing GPS denied navigation

We are trying to fly drone without GPS by following non GPS transition guide. My algorithm running on Raspberry pi is sending position updates to the drone through the vision_position_estimation message. As a backup, we have attached GPS to the drone. We have a lua script that is switiching the GPS source on RC input if the drone drifts off. We want to test a GPS denied scenerio with no GPS used by ardupilot to navigate.

We want to know if the drone is internally fusing GPS for position estimation along with VISO updates or is it completly relying on VISO?

Also what are the EKF lanes? How will we understand if ardupilot switches the lanes and starts using GPS instead of VISO?

Here are my changed parameters -

AHRS_GPS_USE = 0 - Disable GPS for AHRS calculations
GPS_TYPE2 = 1 - Enable second (non primary ) GPS for measuring true location
GPS_TYPE = 0 - Disable primary GPS
VISO_TYPE = 1 - Set visual odometry type as MAVLINK
EK3_GPS_CHECK = 0 - Disable GPS checks
GPS_AUTO_SWITCH = 0 - Disable auto switch from primary to secondary GPS
GPS_PRIMARY = 1 - Set second (enabled) GPS as primary
EK3_SRC1_VELZ = 0 - Dont use any vertical velocity source
EK3_SRC1_POSXY = 6 - Use External Navigation (vision position estimates) for x and y position
EK3_SRC1_VELXY = 0 - Dont use any horizontal vertical velocity source
ARMING_CHECK = 126454 - Disable GPS arming checks & Visual odometry arming checks
VISO_DELAY = 250 - Delay parameter for Visual odometry


EK3_SRC2_POSXY = 3 - use GPS in second source position
EK3_SRC2_POSZ = 1 - use baro in second source vertical position
EK3_SRC2_VELXY = 3 - use GPS in second source horizontal velocity
EK3_SRC2_VELZ = 3 - use GPS in second source vertical velocity 
EK3_SRC2_YAW = 1 - use gyrometer in second source yaw

SCR_ENABLE = 1 - enable scripting


FS_EKF_ACTION = 2 

Here is our lua script to change GPS source. We turning on GPS through this on takeoff and then turning it off:

local previous_rc_value = -1  -- Variable to store the previous RC value

function update()
    -- gcs:send_text(6, 'Hello world')
    local rc_channel = 9  
    local rc_value = rc:get_pwm(rc_channel)

    -- Check if the RC value has changed
    if rc_value ~= previous_rc_value then
        if rc_value > 1500 then
            gcs:send_text(0, "Switch is ON")
            ahrs:set_posvelyaw_source_set(1)
            if ahrs:get_posvelyaw_source_set() == 1 then
                notify:play_tune("L8C") -- One long lower tone (GPS) 
                gcs:send_text(0, "Transition to gps source successful")
            else
                gcs:send_text(0, "Failed to transition to gps source")
            end
        else
            gcs:send_text(0, "Switch is OFF")
            ahrs:set_posvelyaw_source_set(0)
            if ahrs:get_posvelyaw_source_set() == 0 then
                notify:play_tune("L12DD")  -- Two medium-fast tones (External Navigation)            
                gcs:send_text(0, "Transition to external source successful")
            else
                gcs:send_text(0, "Failed to transition to external source")
            end
        end
        -- Update the previous RC value
        previous_rc_value = rc_value
    end

    return update, 1000  -- Re-run the update every 1000ms (1 second)
end

return update()

PS -
We have already refered these links -

  1. EKF3 Affinity and Lane Switching — Dev documentation
  2. GPS / Non-GPS Transitions — Copter documentation
  3. Non-GPS Navigation — Copter documentation

Likely posted in the wrong category: Copter 3.6 ?

Changed to Copter 4.0 thanks