GuidingWithCollAvoidance.cpp
Go to the documentation of this file.
2
3#include <SimoxUtility/json/json.hpp>
4
8
10{
11
13 ::armarx::skills::SimpleSpecializedSkill<ParamType>(GetSkillDescription()), srv_(srv)
14 {
15 }
16
18 GuidingWithCollAvoidance::exit(const SpecializedExitInput& in)
19 {
20
22 }
23
25 GuidingWithCollAvoidance::main(const SpecializedMainInput& in)
26 {
27 ARMARX_INFO << "in main of execute trajectory";
29
30 // create controller
31 std::string controllerNamePrefix = "Guiding";
33 const std::string controllerClassName = common::ControllerTypeNames.to_name(controllerType);
34 auto builder = srv_.controlComponentPluginUser->createControllerBuilder<controllerType>();
35
36 std::string suffix;
37 if (in.parameters.mode == arondto::GuidingMode::left_arm)
38 {
39 suffix = "_left";
40 }
41 else if (in.parameters.mode == arondto::GuidingMode::right_arm)
42 {
43 suffix = "_right";
44 }
45 else
46 {
47 suffix = "";
48 }
49
50 auto const configFileName = "/default_a7" + suffix + "_zero_torque.json";
51 const armarx::PackagePath configPath(
52 "armarx_control", "controller_config/" + controllerClassName + configFileName);
53 auto ctrl = builder.createGetTSComplianceCtrl(
54 controllerNamePrefix, nullptr, configPath.toSystemPath());
55
58 while (not shouldSkillTerminate())
59 {
61 }
62 ctrl->deactivateAndDeleteController();
63
64 return MakeSucceededResult();
65 }
66
67
68} // namespace armarx::control::skills::skills
static void WaitFor(const Duration &duration)
Wait for a certain duration on the virtual clock.
Definition Clock.cpp:99
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
Definition Duration.cpp:48
static MainResult MakeSucceededResult(aron::data::DictPtr data=nullptr)
Definition Skill.cpp:413
bool shouldSkillTerminate() const override
Returns whether the skill should terminate as soon as possible.
Definition Skill.cpp:469
virtual MainResult main()
Override this method with the actual implementation.
Definition Skill.cpp:542
void throwIfSkillShouldTerminate(const std::string &abortedMessage="") const
Definition Skill.cpp:389
virtual ExitResult exit()
Override this method with the actual implementation.
Definition Skill.cpp:535
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
#define ARMARX_INFO
The normal logging level.
Definition Logging.h:181
const simox::meta::EnumNames< ControllerType > ControllerTypeNames
Definition type.h:170
This file offers overloads of toIce() and fromIce() functions for STL container types.
This file is part of ArmarX.
A result struct for skill exit function.
Definition Skill.h:69
A result struct for th main method of a skill.
Definition Skill.h:62
#define ARMARX_TRACE
Definition trace.h:77