LocationNameResolver.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 Niklas Arlt ( niklas dot arlt at kit dot edu )
17 * @date 2026
18 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
19 * GNU General Public License
20 */
21
22#pragma once
23
24#include <optional>
25#include <string>
26
29
31
33{
34
35 /// A location in the navigation memory, identified the way the memory identifies it.
37 {
38 std::string name;
39 std::string provider;
40 };
41
42 /**
43 * @brief Everything needed to turn a spoken place into a location.
44 *
45 * Bundled so that a skill can build it once from its own services and hand it around.
46 */
53
54 /**
55 * @brief Resolve a human-readable place onto a location, the way `NavigateToNamedLocation`
56 * does.
57 *
58 * Two stages, in this order:
59 *
60 * 1. Objects: if `useObjectLocations`, the name is compared (exactly, case-insensitively)
61 * against the recognized names of the classes of the objects currently in the object
62 * pose memory. A match is turned into the location `<ClassID>/inFrontOf`, or its
63 * `:<instance>` variant where one exists.
64 * 2. Locations: otherwise the name is fuzzy-matched against every location's entity name
65 * and its `names.recognized`, accepting the best match at or above `minMatchRatio`.
66 *
67 * This lives on its own so that the skills which have to agree on what a place is --
68 * `NavigateToNamedLocation` and `NavigateWithCart` -- cannot drift apart.
69 *
70 * @return The resolved location, or nullopt if neither stage matched.
71 */
72 std::optional<ResolvedLocation>
73 resolveLocationName(const std::string& locationName,
74 const LocationNameResolverServices& services,
75 double minMatchRatio,
76 bool useObjectLocations);
77
78} // namespace armarx::navigation::skills
Provides access to the armarx::objpose::ObjectPoseStorageInterface (aka the object memory).
std::optional< ResolvedLocation > resolveLocationName(const std::string &locationName, const LocationNameResolverServices &services, const double minMatchRatio, const bool useObjectLocations)
Resolve a human-readable place onto a location, the way NavigateToNamedLocation does.
Everything needed to turn a spoken place into a location.
armarx::armem::obj::clazz::ClassReader * objectClassReader
A location in the navigation memory, identified the way the memory identifies it.