Skip to content

Commit

Permalink
mola_kernel: Add Georeferencing structure and add it to map updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Jan 31, 2025
1 parent 0d928aa commit 5c42d0b
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 31 deletions.
1 change: 1 addition & 0 deletions mola_kernel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ set(LIB_PUBLIC_HDRS
include/mola_kernel/entities/RelPose3KF.h
include/mola_kernel/Entity.h
include/mola_kernel/Factor.h
include/mola_kernel/Georeferencing.h
include/mola_kernel/factors/FactorBase.h
include/mola_kernel/factors/FactorConstVelKinematics.h
include/mola_kernel/factors/FactorRelativePose3.h
Expand Down
41 changes: 41 additions & 0 deletions mola_kernel/include/mola_kernel/Georeferencing.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/* -------------------------------------------------------------------------
* A Modular Optimization framework for Localization and mApping (MOLA)
* Copyright (C) 2018-2024 Jose Luis Blanco, University of Almeria
* See LICENSE for license information.
* ------------------------------------------------------------------------- */
/**
* @file Georeferencing.h
* @brief Defines a common georeferencing data structure, similar to mp2p_icp
* but independent
* @author Jose Luis Blanco Claraco
* @date Jan 31, 2025
*/
#pragma once

#include <mrpt/poses/CPose3DPDFGaussian.h>
#include <mrpt/topography/data_types.h>

namespace mola
{
/** Defines a common georeferencing data structure, similar to mp2p_icp but
* independent of that library.
*
* \ingroup mola_kernel_grp */
struct Georeferencing
{
Georeferencing() = default;

/** The geodetic coordinates (on WGS-84) of the metric map ENU frame of
* reference. */
mrpt::topography::TGeodeticCoords geo_coord;

/** The SE(3) transformation from the ENU (earth-north-up) frame
* to the metric map local frame of reference.
* If this is the identity (default) it means the map is already in
* ENU coordinates (i.e. +X is East, +Y is North, +Z is up) and
* the point (0,0,0) is the one having the geodetic coordinates
* geo_coord
*/
mrpt::poses::CPose3DPDFGaussian T_enu_to_map;
};
} // namespace mola
11 changes: 10 additions & 1 deletion mola_kernel/include/mola_kernel/interfaces/MapSourceBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/
#pragma once

#include <mola_kernel/Georeferencing.h>
#include <mrpt/maps/CMetricMap.h>

#include <functional>
Expand All @@ -21,7 +22,8 @@

namespace mola
{
/** Virtual interface for SLAM/odometry methods publishing a map
/** Virtual interface for SLAM/odometry methods publishing a map and/or
* georeferencing information.
*
* \ingroup mola_kernel_interfaces_grp */
class MapSourceBase
Expand All @@ -47,7 +49,14 @@ class MapSourceBase
/** Map layer/submap name */
std::string map_name = "local_map";

/** Might be null if georeferencing is provided, but both can be also
* populated. */
mrpt::maps::CMetricMap::Ptr map;

/** If the map is georeferenced, its metadata
* \note Added in MOLA 1.7.0
*/
std::optional<Georeferencing> georeferencing;
};

using map_updates_callback_t = std::function<void(const MapUpdate&)>;
Expand Down
30 changes: 0 additions & 30 deletions mola_kernel/include/mola_kernel/interfaces/NavStateFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,36 +121,6 @@ class NavStateFilter : public mola::ExecutableBase
{
return {}; // Default: none
}

/** Must be invoked with the mp2p_icp metric map geo-referencing information
* of the map in order to have GNSS observations correctly fused.
*/
void set_georeferencing_params(
/** The geodetic coordinates (on WGS-84) of the metric map ENU frame of
* reference. */
mrpt::topography::TGeodeticCoords geo_coord,
/** The SE(3) transformation from the ENU (earth-north-up) frame
* to the metric map local frame of reference.
* If this is the identity (default) it means the map is already in
* ENU coordinates (i.e. +X is East, +Y is North, +Z is up) and
* the point (0,0,0) is the one having the geodetic coordinates
* geo_coord
*/
mrpt::poses::CPose3DPDFGaussian T_enu_to_map)
{
auto& g = geoRefParams_.emplace();

g.geo_coord = geo_coord;
g.T_enu_to_map = T_enu_to_map;
}

protected:
struct GeoReferenceParams
{
mrpt::topography::TGeodeticCoords geo_coord;
mrpt::poses::CPose3DPDFGaussian T_enu_to_map;
};
std::optional<GeoReferenceParams> geoRefParams_;
};

} // namespace mola

0 comments on commit 5c42d0b

Please sign in to comment.