4 #include <Eigen/Geometry>
6 #include <SimoxUtility/math/convert.h>
7 #include <VirtualRobot/Robot.h>
8 #include <VirtualRobot/RobotNodeSet.h>
9 #include <VirtualRobot/VirtualRobot.h>
13 #include <RobotAPI/interface/units/RobotUnit/TaskSpaceActiveImpedanceControl.h>
20 #include <armarx/control/skills/skills/platform_follower_controller/aron/FollowerParams.aron.generated.h>
29 defaultParams.platformControlConfig.nodeSetNameLeft =
"LeftArm";
30 defaultParams.platformControlConfig.nodeSetNameRight =
"RightArm";
31 defaultParams.platformControlConfig.kPos = 12;
32 defaultParams.platformControlConfig.kAngle = 8;
33 defaultParams.platformControlConfig.dPos = 0;
34 defaultParams.platformControlConfig.dAngle = 0;
36 return ::armarx::skills::SkillDescription{.
skillId = {.
skillName =
"Follower"},
38 "TODO: Description of skill Follower.",
39 .rootProfileDefaults = defaultParams.toAron(),
41 .parametersType = ParamType::ToAronType()};
48 parameters_(parameters)
83 VirtualRobot::RobotNodeSetPtr rnsRight = robot->getRobotNodeSet(
"RightArm");
84 VirtualRobot::RobotNodeSetPtr rnsLeft = robot->getRobotNodeSet(
"LeftArm");
90 for (
const auto& rns : {rnsRight, rnsLeft})
95 builder.withNodeSet(rns->getName()).withNamePrefix(rns->getName());
99 if (in.parameters.jointConfigFileName.empty())
101 const std::string controllerClassName =
106 "controller_config/NJointTaskspaceImpedanceController/"
107 "bimanual_transport_default.json");
109 ARMARX_CHECK(std::filesystem::exists(configPath.toSystemPath()))
110 << configPath.toSystemPath();
112 builder.withConfig(configPath.toSystemPath());
116 builder.withConfig(in.parameters.jointConfigFileName);
119 ARMARX_CHECK(builder.config().limbs.count(
"LeftArm") > 0);
120 ARMARX_CHECK(builder.config().limbs.count(
"RightArm") > 0);
141 ARMARX_INFO <<
"Setting desired pose for controller with nodeset " << rns->getName() <<
".";
142 auto& armConfig = builder.config().limbs.at(rns->getName());
146 armConfig.desiredPose = rns->getTCP()->getPoseInRootFrame();
152 auto ctrlWrapper = builder.create();
153 const std::string controllerName = builder.getControllerName();
157 ctrlWrapper->daemonize(
false);
162 controllers.emplace(rns->getName(), std::move(ctrlWrapper));
168 for (
auto&
c : controllers)
170 c.second->updateConfig();
176 c.second->activate();
186 const auto platformControlConfig = in.parameters.platformControlConfig;
190 constexpr
auto ControllerType = ::armarx::control::njoint_controller::platform::
191 ControllerType::PlatformFollowerController;
193 auto platformControllerBuilder =
195 platformControllerBuilder.withNodeSet(
"Platform").withNamePrefix(
"Andre");
199 const std::string controllerClassName =
203 "armarx_control",
"controller_config/PlatformFollowerController/default.json");
205 ARMARX_CHECK(std::filesystem::exists(configPath.toSystemPath()));
207 platformControllerBuilder.withConfig(configPath.toSystemPath());
221 auto platformCtrlWrapper = platformControllerBuilder.create();
224 platformCtrlWrapper->activate();
231 ARMARX_INFO <<
"Stop requested. Deactivating controllers.";
232 for (
auto&
c : controllers)
234 c.second->deactivate();
236 platformCtrlWrapper->deactivate();
240 .status = ::armarx::skills::TerminatedSkillStatus::Succeeded,