Setting of Global origin during flight

Hello Everyone,
I have this query while performing drone mission:

Initially, my drone is in like a box kind of structure. It does get GPS positions there but the global origin doesn’t get set. The box is raised up and drone flies out of the box in guided no GPS mode.

During this time, or during the flight, I do good good GPS fixes but global origin is not being able to set during flight time. Is there any way to set the global origin in a box or while the box is moving. This is causing me issues to shift from guided no GPS mode to GPS mode. Is there a good way to set the global origin so that I can transition between modes and perform missions.

Hi @prarthana_sigedar,

I’ve created a branch here with a single commit that removes the restrictions on setting the origin while using GPS as the main position source.

This restriction was originally put in place to stop users from accidentally setting an origin very far from the vehicle’s actual position which would lead to bad position control behaviour. This is no longer the case though now that we use doubles (instead of 4byte floats) within the EKF.

Do you think you could try this commit and see if it works for you? If you’re happy with it then I think we could include it in 4.5 (after peer review of course).

Thank you so much replying. I will definitely try this out and get back to you on how this works.

1 Like

Hello, I had one more doubt, using this commit or removing the restrictions on setting the origin will help me to set the origin on moving vehicle or set the origin in a box like structure ?
Sorry, for such doubts but I am very new to this and have to begin everything from scratch.

Hi @prarthana_sigedar,

I think this commit removes the restriction of setting the origin if the main position source is GPS. This is the only restriction that I’m aware of so I don’t think there was a specific restriction against setting the origin while in flight.

Thanks for this.

The reason I asked this was because, I am also facing issues for the origin to be set while my vehicle is moving. The drone is not able to set its GPS origin when it is in the air. Only when the drone is landed, the GPS_origin gets set. Any solutions or any suggestions on how to set GPS origin during flight/drone in the air?

Hi @rmackay9,

I find your proposed solution very useful for multi-robot scenarios with a global coordinate system, i.e., common origin among all robots.

Do you think it would be possible to include this change into the firmware? If so, I would be happy to create a pull request with your changes. Though, I noticed there were some tests that failed. Do you have any idea about that?