HomePose.cpp
Go to the documentation of this file.
1 #include "HomePose.h"
2 
4 
5 #include <armarx/control/skills/aron/MoveJointsToNamedConfigurationParams.aron.generated.h>
6 #include <armarx/control/skills/aron/ShapeHandParams.aron.generated.h>
7 
8 
11 
13 {
14 
15  HomePose::HomePose() : SimpleSpecializedSkill(GetSkillDescription())
16  {
17  }
18 
21  {
22  ParamType defaultParams;
23 
24  std::stringstream desc;
25  desc << "Move all joints to a natural idle position that also allows "
26  "safe movement and safe bus crashes."
27  << "\n\n"
28  << "The `enable*` parameters can be used to enable/disable movement for different "
29  "body parts of the robot.";
30 
33  .description = desc.str(),
34  .rootProfileDefaults = defaultParams.toAron(),
35  .timeout = ::armarx::Duration::Seconds(30),
36  .parametersType = ParamType::ToAronType(),
37  };
38  }
39 
41  HomePose::main(const SpecializedMainInput& in)
42  {
43  auto moveToConfiguration = armarx::skills::SpecializedSkillProxy<
44  armarx::control::skills::arondto::MoveJointsToNamedConfigurationParams>(
45  this->manager,
49  });
50 
52  this->manager, ::armarx::skills::SkillID{
54  .skillName = constants::SHAPE_HAND_SKILL_NAME,});
55 
56  auto subParams = moveToConfiguration.getRootProfileParameters();
57  subParams.configuration = "Home";
58 
59  subParams.enableHead = true; // should be via gaze controller, but due to dependency chain, this skill would have to be moved
60  subParams.enableLeftHand = false; // via hand unit
61  subParams.enableRightHand = false; // via hand unit
62 
63  copy_params(in.parameters, subParams);
64 
65  auto openHandParams = openHand.getRootProfileParameters();
66  openHandParams.shapeName = "Platform";
67 
68  auto openHandParamsLeft = openHandParams;
69  openHandParamsLeft.hand = armarx::control::skills::arondto::Hand::Left;
70 
71  auto openHandParamsRight = openHandParams;
72  openHandParamsLeft.hand = armarx::control::skills::arondto::Hand::Right;
73 
74  this->callSubskill(openHand, openHandParamsLeft.toAron());
75  this->callSubskill(openHand, openHandParamsRight.toAron());
76  this->callSubskill(moveToConfiguration, subParams.toAron());
77 
78  return MakeSucceededResult();
79  }
80 
81 } // namespace armarx::control::skills::skills::meta
armarx::skills::Skill::manager
manager::dti::SkillManagerInterfacePrx manager
Definition: Skill.h:327
armarx::skills::SimpleSpecializedSkill< arondto::NamedConfigurationParams >::ParamType
arondto::NamedConfigurationParams ParamType
Definition: SimpleSpecializedSkill.h:14
SpecializedSkillProxy.h
armarx::skills::SkillID::skillName
std::string skillName
Definition: SkillID.h:60
param_conversions.h
armarx::skills::SkillDescription
Definition: SkillDescription.h:18
armarx::skills::SkillID::providerId
std::optional< ProviderID > providerId
Definition: SkillID.h:59
armarx::skills::SpecializedSkillProxy::getRootProfileParameters
AronT getRootProfileParameters()
Definition: SpecializedSkillProxy.h:30
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
armarx::control::skills::skills::copy_params
void copy_params(const arondto::MoveJointsParams &from, arondto::MoveJointsToPositionParams &to)
Definition: param_conversions.h:12
constants.h
armarx::core::time::Duration::Seconds
static Duration Seconds(std::int64_t seconds)
Constructs a duration in seconds.
Definition: Duration.cpp:83
armarx::control::skills::constants::HOME_POSE_SKILL_NAME
std::string HOME_POSE_SKILL_NAME
Definition: constants.cpp:16
armarx::control::skills::skills::meta::HomePose::GetSkillDescription
::armarx::skills::SkillDescription GetSkillDescription()
Definition: HomePose.cpp:20
armarx::skills::SpecializedSkillProxy
Definition: SpecializedSkillProxy.h:10
armarx::skills::SkillDescription::skillId
SkillID skillId
Definition: SkillDescription.h:20
HomePose.h
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::control::skills::constants::SHAPE_HAND_SKILL_NAME
std::string SHAPE_HAND_SKILL_NAME
Definition: constants.cpp:12
armarx::skills::SimpleSpecializedSkill< arondto::NamedConfigurationParams >::main
Skill::MainResult main() final
Definition: SimpleSpecializedSkill.h:71
armarx::control::skills::constants::MOVE_JOINTS_TO_NAMED_CONFIGURATION_SKILL_NAME
std::string MOVE_JOINTS_TO_NAMED_CONFIGURATION_SKILL_NAME
Definition: constants.cpp:10
armarx::control::skills::skills::meta
Definition: HomePose.cpp:12
armarx::skills::SkillID
Definition: SkillID.h:17
armarx::control::skills::skills::meta::HomePose::HomePose
HomePose()
Definition: HomePose.cpp:15
Left
bool Left(const point2d &a, const point2d &b, const point2d &c)
Definition: gdiam.cpp:1617
armarx::skills::Skill::getSkillId
SkillID getSkillId() const
Get the id of the skill.
Definition: Skill.h:74