mavlink / MAVSDK

API and library for MAVLink compatible systems written in C++17
https://mavsdk.mavlink.io
BSD 3-Clause "New" or "Revised" License
637 stars 510 forks source link

Can MAVSdk support set ekf origin? #1531

Open ucas-zihaowang opened 3 years ago

ucas-zihaowang commented 3 years ago

Hello, I have a homework which needs to fly multiple UAVs, So I plan to build a global NED Coordinate. But when a vehicle starts to takeoff, It's current ned postion is ( 0, 0, 0 ).

I want to modify the current NED position by setting ekf_origin.

JonasVautherin commented 3 years ago

Is there a mavlink message that is implemented in PX4 and that does that?

ucas-zihaowang commented 3 years ago

Is there a mavlink message that is implemented in PX4 and that does that?

Arrording to https://github.com/ArduPilot/MissionPlanner/issues/1901,

I guess Mavlink should have this message.

JonasVautherin commented 3 years ago

MAVLink messages are defined here: https://mavlink.io/en/messages/common.html

Next step is to find which one you want (if it exists) :wink:

julianoes commented 3 years ago

Looks like it would be this one: https://mavlink.io/en/messages/common.html#SET_GPS_GLOBAL_ORIGIN

Which even seems to be implemented by PX4: https://github.com/PX4/PX4-Autopilot/blob/5eddf32cd38f25e385a1a171319e4e08a3a4a4dc/src/modules/mavlink/mavlink_receiver.cpp#L1188-L1211

JonasVautherin commented 3 years ago

Oh we already have a getter for that! https://github.com/mavlink/MAVSDK/blob/main/src/plugins/telemetry/telemetry_impl.cpp#L2139

ucas-zihaowang commented 3 years ago

@julianoes @JonasVautherin , thanks for your help. Now I think mavlink message SET_GPS_GLOBAL_ORIGIN or mavsdk api TelemetryImpl::get_gps_global_origin_async may be used to set ekf_origin.

Next, I will test this api( get_gps_global_origin_async ), and write my result.

Thanks your help.

julianoes commented 3 years ago

The setter needs to be implemented.

See here, how a feature can be added: https://mavsdk.mavlink.io/main/en/cpp/contributing/plugins.html#add-api-to-proto

JonasVautherin commented 3 years ago

@julianoes Would that go into the action plugin?

julianoes commented 3 years ago

Yes. I'd say so.

zekemyapp commented 7 months ago

Hello! I'm trying to implement this change request for some personal test. I wonder if this message should be in mocap instead of actions... also, should it be a sync method?

julianoes commented 7 months ago

I think action is ok. I'd do both if both are useful.