Skip to content

Get GPS Global origin in telemte #750

Open

Description

@alireza787b

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!

Activity

  1. alireza787b commented on Feb 16, 2025

    @alireza787b
    ContributorAuthor

    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

  2. julianoes commented on Feb 16, 2025

    @julianoes
    Collaborator

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

  3. alireza787b commented on Feb 17, 2025

    @alireza787b
    ContributorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions