NavigateToChargingStation.cpp
Go to the documentation of this file.
2
3#include <sstream>
4
7
12
13#include <armarx/navigation/skills/aron/NavigateToNamedLocation.aron.generated.h>
15
17{
18
19 armarx::skills::SkillDescription
21 {
22 ParamType defaultParameters;
23
24 const armarx::ObjectID chargingStationObjectID{"Building/charging-station"};
25
26 // The locations are defined linked to the charging station object.
27 defaultParameters.inFrontOfChargingStationLocationName =
28 chargingStationObjectID.getClassID().str() + "/inFrontOf";
29 defaultParameters.chargingLocationName =
30 chargingStationObjectID.getClassID().str() + "/charging";
31
32 std::stringstream description;
33 description << "Go to the charging station and initiate charging.";
34 description << "\n";
35 description << "Optionally the names of the charging-station locations can be changed "
36 "through the skill's parameters.";
37 description << "\n\n";
39 << " - **inFrontOfChargingStationLocationName**: Name of the location the robot will "
40 "first navigate to in order to initiate the movement towards the charging "
41 "station.\n\n";
43 << " - **chargingLocationName**: Name of the location where the robot should charge. "
44 "This is just a theoretical location, since the robot will probably have to find a "
45 "very precise placement where the wireless charging will initiate.\n";
46
49 .description = description.str(),
50 .rootProfileDefaults = defaultParameters.toAron(),
52 .parametersType = Params::ToAronType(),
53 };
54 }
55
61
63 Base(GetSkillDescription()), properties(properties)
64 {
65 ;
66 }
67
69 NavigateToChargingStation::main(const Base::SpecializedMainInput& in)
70 {
73
74 // Navigate to inFrontOf charging station location for approach.
75 {
76 using ParamsT = arondto::NavigateToNamedLocationParams;
77
78 auto update =
80 [&in](ParamsT& namedLocationParams) noexcept
81 {
82 namedLocationParams.locationName =
83 in.parameters.inFrontOfChargingStationLocationName;
84 });
85
87 {
88 return MakeFailedResult();
89 }
90 }
91
94
95 // Navigate to charging location to initiate charging.
96 {
97 // TODO: Does not work because the location is not reachable.
98
99 // arondto::NavigateToNamedLocationParams namedLocationParams;
100 // namedLocationParams.locationName = in.parameters.chargingLocationName;
101
102 // auto update =
103 // callSubskill(properties.subSkillIDs.navigateToNamedLocation, namedLocationParams);
104 // if (not(update.has_value() and update->hasBeenSucceeded()))
105 // {
106 // return MakeFailedResult();
107 // }
108 }
109
112
113 return MakeSucceededResult();
114 }
115
116} // namespace armarx::navigation::skills
A known object ID of the form "Dataset/ClassName" or "Dataset/ClassName/InstanceName".
Definition ObjectID.h:11
ObjectID getClassID() const
Return just the class ID without an intance name.
Definition ObjectID.cpp:71
std::string str() const
Return "dataset/className" or "dataset/className/instanceName".
Definition ObjectID.cpp:60
static Duration Minutes(std::int64_t minutes)
Constructs a duration in minutes.
Definition Duration.cpp:96
::armarx::skills::SimpleSpecializedSkill< Params > Base
Resolve a named location and navigate to it.
std::optional< TerminatedSkillStatusUpdate > callSubskill(const SkillID &skillId)
Call a subskill with the given ID and its default parameters.
Definition Skill.cpp:119
static MainResult MakeSucceededResult(aron::data::DictPtr data=nullptr)
Definition Skill.cpp:413
SkillDescription description
Definition Skill.h:372
void throwIfSkillShouldTerminate(const std::string &abortedMessage="") const
Definition Skill.cpp:389
static MainResult MakeFailedResult(aron::data::DictPtr data=nullptr)
Definition Skill.cpp:422
const armarx::skills::SkillID NavigateToChargingStation
Definition skill_ids.cpp:71
bool skillExecutionFailed(const std::optional< armarx::skills::TerminatedSkillStatusUpdate > &update)
This file offers overloads of toIce() and fromIce() functions for STL container types.
This file is part of ArmarX.
This file is part of ArmarX.
A result struct for th main method of a skill.
Definition Skill.h:62
#define ARMARX_TRACE
Definition trace.h:77