Set GPS Origin for Local Positon NED?

I am using PX4 v1.11.3 on my quadcopters.

I have GPS-location but I need to work with local positions for multiple drones and thus I want to set the GPS origin of the EKF2 system. As I understood it, this should be possible because there is even a MAVLink message:

#48 SET_GPS_GLOBAL_POSITION SET_GPS_GLOBAL_ORIGIN ( #48 )

However, I am not able to set such a GPS origin.

From PX4 v1.12.3 upwards, I noticed that there is a function within PX4’s Commander that says: “Set EKF2 Origin” by specifying LAT/LONG/ALT, which is exactly what I need, but this function is not showing up in the Commander of a PX4 < v1.12.3.

I also tried to set MAVLink message #48 with MAVROS by using the mavros/command/cmd service call and setting param1 as SYS_ID and the next 3 params as LAT/LONG/ALT, but I always get the response message that says succeeded: false and code: 3. Only if I set the broadcast field to TRUE, the message gets confirmed with succeeded: true.

So my suspicion is that PX4 < v1.12.3 simply does not support setting a EKF2 / GPS origin?

Does anybody know better?

I really urgently need to set this and upgrading from v1.11.3 to v.1.12.3 is unfortunately not an option, because when I do, it seems to break everything else and my drone is not flying any more.

Please, help!

I did a git blame and it looks like the feature was added in this PR: ekf2 support SET_GPS_GLOBAL_ORIGIN and purge globallocal usage by dagar · Pull Request #16544 · PX4/PX4-Autopilot · GitHub

You can try to apply the changes or part of it to make it work for v1.12.

You can git blame me and @dagar…, and yes, it does not work with code that old… it was a new feature back in 2021! Update to gain the feature.

Thanks @JulianOes!

1 Like

@fizzpin , to elaborate further, your easiest path to entry will be to rebase any commits you have created in your branch(es), isolate them, then re-introduce them to the current stable or main branch. This is just the pain of not staying current with new features while on an old branch of your forked repo. I can at least attest to the fact that the code works well at the present state. If you are having trouble isolating your code changes to function with the current code, please feel free to DM me on Discord.

-Mark

Dear @JulianOes and @mcsauder thank you so much for your kind replies!

I managed it now to upgrade to PX4 v1.12.0 because that seems most feasible for me currently.

However, in this version, the Commander does not offer the option “set_efk_origin” and thus I am thinking of directly sending the MAVLink message #48.

Could someone of you please give me a hint, how I could send #48 to the FCU so that I can set the global efk origin?

Thank you so much in advance!

Bests,
Fizz

… or another question which you as developers could maybe answer:

If I flash PX4 v1.11.3, my copter is arming. Once I have flashed PX4 >= 1.12.0, my copter is not arming any more and QGroundControl is just replying to me with: MAV_CMD_COMPONENT_ARM_DISARM command temporarily rejedted.

Also, QGroundControl tells me that my GPS in disabled, but I am clearly getting GPS data - I see them in the MAVInspector and also with mavros. However, I don’t think that that’s the problem because I set the “arm without GPS”-param to true.

Do you know what might be the problem when upgrading from v1.11.3 to v.1.12.0?

Thank you in advance!