mavros icon indicating copy to clipboard operation
mavros copied to clipboard

WIP: Correct velocity frame for fake_gps.

Open jgoppert opened this issue 2 years ago • 1 comments

Closes Issue #1719

Do not merge yet, awaiting flight test.

jgoppert avatar Mar 08 '22 09:03 jgoppert

Hey, i just noticed that the whole ECEF transformation is obsolete with this change. You could simply use ENU instead of ECEF as function argument in send_fake_gps() and remove the member variable ecef_origin completely. To still have access to the local geodetic variable in send_fake_gps() use this function as described here:

const GeographicLib::Geocentric& earth = GeographicLib::Geocentric::WGS84();
GeographicLib::LocalCartesian proj(map_origin.x(), map_origin.y(), map_origin.z(), earth);
proj.Reverse(pos_enu.x(), pos_enu.y(), pos_enu.z(), geodetic.x(), geodetic.y(), geodetic.z());

Because the ellipsoid height will be returned, it is necessary to convert the height to the geoid height like here or by using the mavros function:

geodetic.z() += m_uas->ellipsoid_to_geoid_height(...);

Don't forget to convert the enu coordinates into ned coordinates with the build in mavros helper function (ftf::transform_frame_enu_ned(pos_enu);).

Alefunk avatar Mar 30 '22 15:03 Alefunk