NavigateToChargingStation.cpp
Go to the documentation of this file.
2 
3 #include <SimoxUtility/algorithm/string/fuzzy_multi_match.hpp>
4 
6 
7 #include <armarx/navigation/core/aron/Location.aron.generated.h>
11 
13 {
14 
17  {
18  ParamType defaultParameters;
19 
20  defaultParameters.inFrontOfChargingStationLocationName = "charging-station/inFrontOf";
21  defaultParameters.chargingLocationName = "charging-station/charging";
22 
23  std::stringstream description;
24  description << "Go to the charging station and initiate charging.";
25  description << "\n";
26  description << "Optionally the names of the charging-station locations can be changed "
27  "through the skill's parameters.";
28  description << "\n\n";
30  << " - **inFrontOfChargingStationLocationName**: Name of the location the robot will "
31  "first navigate to in order to initiate the movement towards the charging "
32  "station.\n\n";
34  << " - **chargingLocationName**: Name of the location where the robot should charge. "
35  "This is just a theoretical location, since the robot will probably have to find a "
36  "very precise placement where the wireless charging will initiate.\n";
37 
40  .description = description.str(),
41  .rootProfileDefaults = defaultParameters.toAron(),
43  .parametersType = Params::ToAronType(),
44  };
45  }
46 
49  {
50  ;
51  }
52 
54  Base(GetSkillDescription()), properties(properties)
55  {
56  ;
57  }
58 
60  NavigateToChargingStation::main(const Base::SpecializedMainInput& in)
61  {
64 
65  // Navigate to inFrontOf charging station location for approach.
66  {
67  arondto::NavigateToNamedLocationParams namedLocationParams;
68  namedLocationParams.locationName = in.parameters.inFrontOfChargingStationLocationName;
69 
70  auto update =
71  callSubskill(properties.subSkillIDs.navigateToNamedLocation, namedLocationParams);
72  if (not(update.has_value() and update->hasBeenSucceeded()))
73  {
74  return MakeFailedResult();
75  }
76  }
77 
80 
81  // Navigate to charging location to initiate charging.
82  {
83  // TODO: Does not work because the location is not reachable.
84 
85  // arondto::NavigateToNamedLocationParams namedLocationParams;
86  // namedLocationParams.locationName = in.parameters.chargingLocationName;
87 
88  // auto update =
89  // callSubskill(properties.subSkillIDs.navigateToNamedLocation, namedLocationParams);
90  // if (not(update.has_value() and update->hasBeenSucceeded()))
91  // {
92  // return MakeFailedResult();
93  // }
94  }
95 
98 
99  return MakeSucceededResult();
100  }
101 
102 } // namespace armarx::navigation::skills
armarx::skills::SimpleSpecializedSkill< arondto::NavigateToChargingStationParams >::ParamType
arondto::NavigateToChargingStationParams ParamType
Definition: SimpleSpecializedSkill.h:14
armarx::navigation::skills::NavigateToChargingStation::Properties::SubSkillIds::navigateToNamedLocation
armarx::skills::SkillID navigateToNamedLocation
Definition: NavigateToChargingStation.h:38
SpecializedSkillProxy.h
armarx::skills::SkillDescription
Definition: SkillDescription.h:18
armarx::navigation::skills::NavigateToChargingStation::Properties
Definition: NavigateToChargingStation.h:32
NavigateToNamedLocation.h
armarx::navigation::skills::NavigateToChargingStation::GetSkillDescription
::armarx::skills::SkillDescription GetSkillDescription()
Definition: NavigateToChargingStation.cpp:16
armarx::skills::Skill::callSubskill
std::optional< TerminatedSkillStatusUpdate > callSubskill(const skills::SkillProxy &proxy)
Call a subskill with default parameters and block until the subskill terminates.
Definition: Skill.cpp:22
constants.h
armarx::navigation::skills::NavigateToChargingStation::Properties::subSkillIDs
SubSkillIds subSkillIDs
Definition: NavigateToChargingStation.h:41
armarx::skills::Skill::MakeFailedResult
static MainResult MakeFailedResult()
Definition: Skill.cpp:324
ARMARX_TRACE
#define ARMARX_TRACE
Definition: trace.h:69
skill_ids.h
armarx::skills::Skill::description
SkillDescription description
Definition: Skill.h:336
armarx::skills::SkillDescription::skillId
SkillID skillId
Definition: SkillDescription.h:20
armarx::skills::SimpleSpecializedSkill
Definition: SimpleSpecializedSkill.h:10
armarx::core::time::Duration::Minutes
static Duration Minutes(std::int64_t minutes)
Constructs a duration in minutes.
Definition: Duration.cpp:111
armarx::skills::Skill::MakeSucceededResult
static MainResult MakeSucceededResult(aron::data::DictPtr data=nullptr)
Definition: Skill.cpp:315
armarx::skills::Skill::MainResult
A result struct for th main method of a skill.
Definition: Skill.h:48
armarx::armem::server::ltm::util::mongodb::detail::update
bool update(mongocxx::collection &coll, const nlohmann::json &query, const nlohmann::json &update)
Definition: mongodb.cpp:67
armarx::skills::SkillDescription::rootProfileDefaults
aron::data::DictPtr rootProfileDefaults
Definition: SkillDescription.h:22
armarx::skills::SimpleSpecializedSkill< arondto::NavigateToChargingStationParams >::main
Skill::MainResult main() final
Definition: SimpleSpecializedSkill.h:71
armarx::skills::Skill::throwIfSkillShouldTerminate
void throwIfSkillShouldTerminate(const std::string &abortedMessage="")
Definition: Skill.cpp:291
NavigateToChargingStation.h
armarx::navigation::skills::skill_ids::NavigateToChargingStation
const armarx::skills::SkillID NavigateToChargingStation
Definition: skill_ids.cpp:68
armarx::navigation::skills::NavigateToChargingStation::Properties::SubSkillIds::SubSkillIds
SubSkillIds()
Definition: NavigateToChargingStation.cpp:47
armarx::navigation::skills
Definition: constants.cpp:25
armarx::navigation::skills::skill_ids::NavigateToNamedLocation
const armarx::skills::SkillID NavigateToNamedLocation
Definition: skill_ids.cpp:63
armarx::navigation::skills::NavigateToChargingStation::NavigateToChargingStation
NavigateToChargingStation(const Properties &properties)
Definition: NavigateToChargingStation.cpp:53