cartographer_utils.h
Go to the documentation of this file.
1
/*
2
* This file is part of ArmarX.
3
*
4
* ArmarX is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation.
7
*
8
* ArmarX is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15
*
16
* @author Fabian Reister ( fabian dot reister at kit dot edu )
17
* @date 2021
18
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
19
* GNU General Public License
20
*/
21
22
#pragma once
23
24
#include <filesystem>
25
#include <memory>
26
27
#include <cartographer/common/lua_parameter_dictionary.h>
28
#include <cartographer/common/time.h>
29
#include <cartographer/mapping/map_builder_interface.h>
30
31
namespace
armarx::localization_and_mapping::cartographer_adapter::util
32
{
33
/**
34
* @brief Helper function to create Lua parameter object from string.
35
*
36
* Example:
37
*
38
* const std::string mapBuilderLuaCode = R"text(
39
* include "map_builder.lua"
40
* return MAP_BUILDER)text";
41
*
42
* auto paramsDict = resolveLuaParameters(mapBuilderLuaCode, ...);
43
*
44
*
45
* @param luaCode The lua code that will be evaluated.
46
* @param configPath The path where the lua config files reside.
47
* @return std::unique_ptr<::cartographer::common::LuaParameterDictionary>
48
*/
49
std::unique_ptr<::cartographer::common::LuaParameterDictionary>
50
resolveLuaParameters
(
const
std::string& luaCode,
const
std::filesystem::path& configPath);
51
52
/**
53
* @brief Convert cartographer time to unix time in [µs]
54
*
55
* @param time cartographer time
56
* @return int64_t time in [µs]
57
*/
58
int64_t
fromCarto
(::
cartographer::common::Time
time);
59
60
61
/**
62
* @brief Convert unix time in [µs] to cartographer time
63
*
64
* @param time in [µs]
65
* @return ::cartographer::common::Time
66
*/
67
::cartographer::common::Time
toCarto
(
const
int64_t& time);
68
69
/**
70
* @brief Creates a map builder object from a stored map.
71
*
72
* @param mapPath The path to the map (e.g. /path/to/map.carto)
73
* @param configPath The path where the lua config files reside.
74
* @return std::unique_ptr<cartographer::mapping::MapBuilderInterface>
75
*/
76
std::unique_ptr<::cartographer::mapping::MapBuilderInterface>
77
loadMap
(
const
std::filesystem::path& mapPath,
const
std::filesystem::path& configPath);
78
79
80
}
// namespace armarx::localization_and_mapping::cartographer_adapter::util
armarx::localization_and_mapping::cartographer_adapter::util::fromCarto
int64_t fromCarto(::cartographer::common::Time time)
Convert cartographer time to unix time in [µs].
Definition:
cartographer_utils.cpp:22
armarx::localization_and_mapping::cartographer_adapter::util::loadMap
std::unique_ptr<::cartographer::mapping::MapBuilderInterface > loadMap(const std::filesystem::path &mapPath, const std::filesystem::path &configPath)
Creates a map builder object from a stored map.
Definition:
cartographer_utils.cpp:45
armarx::localization_and_mapping::cartographer_adapter::util::resolveLuaParameters
std::unique_ptr<::cartographer::common::LuaParameterDictionary > resolveLuaParameters(const std::string &luaCode, const std::filesystem::path &configPath)
Helper function to create Lua parameter object from string.
Definition:
cartographer_utils.cpp:11
armarx::armem::Time
armarx::core::time::DateTime Time
Definition:
forward_declarations.h:13
armarx::localization_and_mapping::cartographer_adapter::util
Definition:
cartographer_utils.cpp:7
armarx::localization_and_mapping::cartographer_adapter::util::toCarto
::cartographer::common::Time toCarto(const int64_t &time)
Convert unix time in [µs] to cartographer time.
Definition:
cartographer_utils.cpp:35
armarx
localization_and_mapping
cartographer_adapter
util
cartographer_utils.h
Generated by
1.8.17