Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get GPS Global origin in telemte #750

Open
alireza787b opened this issue Feb 12, 2025 · 4 comments
Open

Get GPS Global origin in telemte #750

alireza787b opened this issue Feb 12, 2025 · 4 comments

Comments

@alireza787b
Copy link
Contributor

Hi,
I'm trying to retrieve the GPS coordinates of the local NED origin that PX4 uses. I'd like to access the latitude, longitude, and altitude (AMSL) of this origin point.
According to the cpp documentation, the Telemetry object should have a gps_global_origin() method to achieve this. However, when I try to use it, I encounter an AttributeError: 'Telemetry' object has no attribute 'gps_global_origin'.
Here's a snippet of the code I'm using:
from mavsdk import System

async def get_gps_global_origin(drone: System):
async for origin in drone.telemetry.gps_global_origin():
print(origin)
break
And here's the traceback I receive:
text
Traceback (most recent call last):
File "/root/mavsdk_drone_show/drone_show.py", line 801, in pre_flight_checks
async for position in drone.telemetry.gps_global_origin():
AttributeError: 'Telemetry' object has no attribute 'gps_global_origin'
I'm wondering if I'm misunderstanding how to access this information or if there might be an issue with the current MAVSDK implementation or this method is not implemnted in python. Could you please provide some guidance on the correct way to obtain the GPS Global Origin using MAVSDK Python?
Any help or insights would be greatly appreciated!

@alireza787b
Copy link
Contributor Author

I saw this in docs but I got an error that it was not defined! maybe a mavsdk version problem. I will check that agian. thanks

@julianoes
Copy link
Collaborator

You're trying to use gps_global_origin() but it's get_gps_global_origin().

@alireza787b
Copy link
Contributor Author

here is where I tested that
home_position = drone.telemetry.get_gps_global_origin()

on line 802
alireza787b/mavsdk_drone_show@2bb57c9#diff-d24a66ceef6c112f00ea91b75ab3bcb363f854ae63d636fe72114ef6c49274fdR802

but honestly, I didn't try hard with that. I did a walkaround and used mavlink2rest and pymavlink in another part of my code base and shared its value to fix this problem. That's why I think maybe sth was wrong with my syntax or the mavsdk version was onboard that drone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants