GPS Denied Navigation Home Position

Hi,
I am trying to fly GPS denied, with SITL and MAVROS.
I have the model parameters set as per below:

AHRS_EKF_TYPE 0
AHRS_GPS_USE 0
SIM_GPS_DISABLE 1
EK2_ENABLE 1
EK2_GPS_TYPE 3
SIM_FLOW_ENABLE 1

However, when I try to run the MAVROS node, it prompts with the following :
[ INFO] [1720100062.545421418, 153.670000000]: HP: requesting home position
[ WARN] [1720100100.352328823, 163.197000000]: CMD: Unexpected command 410, result 4

I need to understand why a home position needs to be explicity set here, if I am relying on my Optical Flow sensor device for navigation.
Also, I tried setting the hoemposition on the map in QGC, but it was displaying the error message :
MAV_CMD_DO_SET_HOME command failed.

I am a little clueless as to what is going on underneath. Could someone show me where to look ?

Thanks a lot !

I might be completely wrong and there might be a more straightforward solution, but you might have to right-click on the map (in Mission Planner, or maybe in the MAVproxy map) and set a home manually.

Otherwise, there are probably MAVLINK commands that can be sent via MAVROS to create a home point.

You are right, that is doable. While doing that is when I get the MAV_CMD_DO_SET_HOME command failed message displaying.
I understand that home position is not necessary for internal reference, which is the EKF origin. Looking to do that now. Any help or explanations would be appreciated again :slight_smile: @bobzwik

Hi @Iqua ! For GPS denied navigation, you require to have a reference to your starting point to calculate local position information without GPS. You generally need to set a global origin and a home position to use local position estimates without GPS.

1 Like

There is a Set Origin Lua in the example scripts:
AHRS Set Origin

1 Like

Thanks Sanket. How do you set this home position ? Cant do that via QGC. Is there a workaround ?

@dkemxr , I shall check that out. Can you do that via QGC ?

@dkemxr , I am using Ardupilot V4.6.0-dev. I dont think this has a lua script support by default. Is it better to switch to a stable version which has ? What d o you suggest ?

Sure it does. What flight controller?

And you will need to know about Lua Scripts
Lua Scripts

Ah, there ! I am on SITL, Copter, Dave. Did you just say that Ardupilot V4.6.0-dev has Lua scripting enabled by default ? Why is it that I am still getting a bad GPS fix then ? I tried the SCR_ENABLE flag, and adding the above mentioned script. On a side note, why Lua of all languages?

Dave, could you please help me fix this ? I am new to this whole affair, matter of fact.

I can’t help you with MAVROS.
Enable scripts
Write the script to the Scripts directory
Set EK3_SRCx_POSXY to none (so a GPS position it not set before the script runs)

That’s it.

1 Like

Appreciate that ! Thanks a lot !