Component.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 * @package navigation::ArmarXObjects::navigation_evaluator
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 <atomic>
25#include <mutex>
26#include <optional>
27#include <random>
28#include <string>
29
30#include <Eigen/Core>
31#include <Eigen/Geometry>
32
37
39
40#include <RobotAPI/interface/skills/SkillManagerInterface.h>
44
46#include <armarx/navigation/components/navigation_evaluator/ComponentInterface.h>
48#include <armarx/navigation/skills/aron/NavigateTo.aron.generated.h>
49
51{
52
53 class Component :
54 virtual public armarx::Component,
58 {
59 public:
60 Component();
61
62 std::string getDefaultName() const override;
63 static std::string GetDefaultName();
64
65 protected:
67
68 void onInitComponent() override;
69 void onConnectComponent() override;
70 void onDisconnectComponent() override;
71 void onExitComponent() override;
72
73 void createRemoteGuiTab();
74 void RemoteGui_update() override;
75
76 void run();
77
78 private:
79 static const std::string defaultName;
80
81 struct Properties
82 {
83 std::string roomsProviderName;
84 std::string skillProviderName = "navigation_skill_provider";
85 float failureTimeoutSeconds = 5.0F;
86 };
87
88 Properties properties;
89
90 // Skill manager proxy (SkillMemory component)
91 ::armarx::skills::manager::dti::SkillManagerInterfacePrxPtr manager;
92
93 // Skill proxy for NavigateTo
94 std::unique_ptr<armarx::skills::SpecializedSkillProxy<skills::arondto::NavigateToParams>>
95 navigateToSkillProxy;
96
97 // Room reader plugin
99 roomsReaderPlugin = nullptr;
100
101 // Worker thread
103
104 // Random number generation
105 mutable std::mt19937 randomGenerator;
106
107 // Thread-safe state
108 std::atomic<bool> running{false};
109 std::atomic<bool> stopRequested{false};
110 std::atomic<std::uint64_t> successCount{0};
111 std::atomic<std::uint64_t> totalAttempts{0};
112 std::atomic<std::uint64_t> failureCount{0};
113
114 mutable std::mutex settingsMutex;
115 std::string selectedRoomName;
116 skills::arondto::GlobalPlanningAlgorithm::ImplEnum selectedAlgorithm =
117 skills::arondto::GlobalPlanningAlgorithm::SPFA;
118
119 // GUI
120 struct RemoteGuiTab : armarx::RemoteGui::Client::Tab
121 {
123 armarx::RemoteGui::Client::Button refreshRoomsButton;
124 armarx::RemoteGui::Client::Label availableRoomsLabel;
125 armarx::RemoteGui::Client::ComboBox algorithmSelector;
132 };
133
134 RemoteGuiTab tab;
135
136 // Helpers
137 std::vector<algorithms::Room> queryRooms() const;
138 std::optional<algorithms::Room> findRoom(const std::string& name) const;
139 std::optional<Eigen::Isometry3f> samplePoseInRoom(const algorithms::Room& room) const;
140 skills::arondto::GlobalPlanningAlgorithm::ImplEnum algorithmFromString(
141 const std::string& name) const;
142 std::string algorithmToString(
143 skills::arondto::GlobalPlanningAlgorithm::ImplEnum algorithm) const;
144 bool executeSingleNavigation(
145 const Eigen::Isometry3f& targetPose,
146 skills::arondto::GlobalPlanningAlgorithm::ImplEnum algorithm);
147 bool tolerateFailure(const armarx::Duration& elapsed);
148 void updateGuiCounters();
149 };
150
151} // namespace armarx::navigation::components::navigation_evaluator
Baseclass for all ArmarX ManagedIceObjects requiring properties.
Definition Component.h:94
IceUtil::Handle< RunningTask< T > > pointer_type
Shared pointer type for convenience.
A component plugin offering client-side access to a reader or writer and manages the lifecycle,...
Represents a duration.
Definition Duration.h:17
void onInitComponent() override
Pure virtual hook for the subclass.
Definition Component.cpp:93
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override
Definition Component.cpp:68
void onConnectComponent() override
Pure virtual hook for the subclass.
Definition Component.cpp:99
std::string getDefaultName() const override
Retrieve default name of component.
client::plugins::ListeningPluginUser ListeningClientPluginUser
This file is part of ArmarX.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.