From 29262db5d63f0e5d65c2f00d4929991fb2e0d848 Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Wed, 10 Jun 2020 11:35:45 -0700 Subject: [PATCH] add getter for LocalCoord transformation matrices --- common/transformations/coordinates.hpp | 3 +-- common/transformations/transformations.pxd | 3 +++ common/transformations/transformations.pyx | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/common/transformations/coordinates.hpp b/common/transformations/coordinates.hpp index be6fe2e7..d8beb59e 100644 --- a/common/transformations/coordinates.hpp +++ b/common/transformations/coordinates.hpp @@ -20,11 +20,10 @@ ECEF geodetic2ecef(Geodetic g); Geodetic ecef2geodetic(ECEF e); class LocalCoord { -private: +public: Eigen::Matrix3d ned2ecef_matrix; Eigen::Matrix3d ecef2ned_matrix; Eigen::Vector3d init_ecef; -public: LocalCoord(Geodetic g, ECEF e); LocalCoord(Geodetic g) : LocalCoord(g, ::geodetic2ecef(g)) {} LocalCoord(ECEF e) : LocalCoord(::ecef2geodetic(e), e) {} diff --git a/common/transformations/transformations.pxd b/common/transformations/transformations.pxd index b0666d5e..cb3ee53b 100644 --- a/common/transformations/transformations.pxd +++ b/common/transformations/transformations.pxd @@ -55,6 +55,9 @@ cdef extern from "coordinates.cc": Geodetic ecef2geodetic(ECEF) cdef cppclass LocalCoord_c "LocalCoord": + Matrix3 ned2ecef_matrix + Matrix3 ecef2ned_matrix + LocalCoord_c(Geodetic, ECEF) LocalCoord_c(Geodetic) LocalCoord_c(ECEF) diff --git a/common/transformations/transformations.pyx b/common/transformations/transformations.pyx index 2a4e8e67..194257e0 100644 --- a/common/transformations/transformations.pyx +++ b/common/transformations/transformations.pyx @@ -120,6 +120,22 @@ cdef class LocalCoord: elif ecef is not None: self.lc = new LocalCoord_c(list2ecef(ecef)) + @property + def ned2ecef_matrix(self): + return matrix2numpy(self.lc.ned2ecef_matrix) + + @property + def ecef2ned_matrix(self): + return matrix2numpy(self.lc.ecef2ned_matrix) + + @property + def ned_from_ecef_matrix(self): + return self.ecef2ned_matrix + + @property + def ecef_from_ned_matrix(self): + return self.ned2ecef_matrix + @classmethod def from_geodetic(cls, geodetic): return cls(geodetic=geodetic)