RetrieveHand.cpp
Go to the documentation of this file.
1#include "RetrieveHand.h"
2
4
6
7#include <armarx/control/deprecated_njoint_mp_controller/task_space/ControllerInterface.h>
9
11{
12
15 {
16 ParamType defaults;
17 defaults.targetPose.header.agent = "Armar7";
18 defaults.targetPose.header.frame = "root";
19 defaults.targetPose.position = Eigen::Matrix<float, 3, 1>{-234.0f, 284.06f, 1103.0f};
20 defaults.targetPose.orientation =
21 Eigen::Quaternion<float>{0.7640368, -0.63349, 0.06744281, -0.10187};
22
23 armarx::arondto::PackagePath& packagePath = defaults.fileNames.emplace_back();
24 packagePath.package = "armar7_motions";
25 packagePath.path = "tcp_trajectories/dmp/default_left.csv";
26
27 // ARMARX_INFO << VAROUT(defaultParams.targetPose);
28 // ARMARX_INFO << VAROUT(defaultParams.targetPose.position) << VAROUT(defaultParams.targetPose.orientation);
29 // ARMARX_INFO << VAROUT(defaultParams.targetPose.header.frame) << VAROUT(defaultParams.targetPose.header.agent);
30
31 // defaultParams.exampleStringParam = "exampleDefaultValue";
32
33 auto skillId = armarx::skills::SkillID{
35
36 return ::armarx::skills::SkillDescription{.skillId = skillId,
37 .description =
38 "TODO: Description of skill RetrieveHand.",
39 .rootProfileDefaults = defaults.toAron(),
40 .timeout = ::armarx::Duration::MilliSeconds(1000),
41 .parametersType = ParamType::ToAronType()};
42 }
43
45
46 {
47 }
48
49 /*
50 ::armarx::skills::Skill::InitResult
51 RetrieveHand::init(const SpecializedInitInput&)
52 {
53 return InitResult{.status = ::armarx::skills::TerminatedSkillStatus::Succeeded};
54 }
55 */
56
57
59 RetrieveHand::main(const SpecializedMainInput& in)
60 {
61 // Enter main code of the skill here.
62 core::RetrieveHand::Remote rem{.memoryNameSystem = remote.memoryNameSystem,
63 .robotUnit = remote.robotUnit};
64
65 armarx::FramedPose targetPose{in.parameters.targetPose.position,
66 in.parameters.targetPose.orientation,
67 in.parameters.targetPose.header.frame,
68 in.parameters.targetPose.header.agent};
69
70 std::vector<std::string> fileNames;
71 for (const auto& aronPackagePath : in.parameters.fileNames)
72 {
73 armarx::PackagePath packagePath = fromAron<armarx::PackagePath>(aronPackagePath);
74 fileNames.push_back(packagePath.toSystemPath().string());
75 }
76
78 .robotName = in.parameters.robotName,
79 .robotNodeSet = in.parameters.robotNodeSet,
80 .timeDurationInSec = in.parameters.timeDurationInSec,
81 .targetPose = targetPose,
82 .kpLinear = in.parameters.kpLinear,
83 .kpAngular = in.parameters.kpAngular,
84 .kdLinear = in.parameters.kdLinear,
85 .kdAngular = in.parameters.kdAngular,
86 .fileNames = fileNames,
87 };
88
89
90 impl = std::make_unique<core::RetrieveHand>(rem, props);
91
92 auto res = impl->execute();
93 if (res)
94 {
95 return MakeSucceededResult();
96 }
97 return MakeFailedResult();
98 }
99
100 void
102 {
103 ARMARX_INFO << "requesting to stop TSVMP controller ";
104 if (impl)
105 {
106 impl->stop();
107 }
108 }
109
110 /*
111 ::armarx::skills::Skill::ExitResult
112 RetrieveHand::exit(const SpecializedExitInput&)
113 {
114 return ExitResult{.status = ::armarx::skills::TerminatedSkillStatus::Succeeded};
115 }
116 */
117
118} // namespace armarx::control::retrieve_hand::skills
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
Definition Duration.cpp:48
The FramedPose class.
Definition FramedPose.h:281
static std::filesystem::path toSystemPath(const data::PackagePath &pp)
Skill::MainResult main() final
Override this method with the actual implementation.
::armarx::skills::SkillDescription GetSkillDescription()
::armarx::skills::SimpleSpecializedSkill< RetrieveHandParams > Base
static MainResult MakeSucceededResult(aron::data::DictPtr data=nullptr)
Definition Skill.cpp:413
static MainResult MakeFailedResult(aron::data::DictPtr data=nullptr)
Definition Skill.cpp:422
#define ARMARX_INFO
The normal logging level.
Definition Logging.h:181
void fromAron(const arondto::PackagePath &dto, PackageFileLocation &bo)
A result struct for th main method of a skill.
Definition Skill.h:62