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})
97 builder.withNodeSet(rns->getName()).withNamePrefix(rns->getName());
101 if (in.parameters.jointConfigFileName.empty())
103 const std::string controllerClassName =
108 "controller_config/NJointTaskspaceImpedanceController/"
109 "bimanual_transport_default.json");
111 ARMARX_CHECK(std::filesystem::exists(configPath.toSystemPath()))
112 << configPath.toSystemPath();
114 builder.withConfig(configPath.toSystemPath());
118 builder.withConfig(in.parameters.jointConfigFileName);
121 ARMARX_CHECK(builder.config().limbs.count(
"LeftArm") > 0);
122 ARMARX_CHECK(builder.config().limbs.count(
"RightArm") > 0);
143 ARMARX_INFO <<
"Setting desired pose for controller with nodeset " << rns->getName()
145 auto& armConfig = builder.config().limbs.at(rns->getName());
149 armConfig.desiredPose = rns->getTCP()->getPoseInRootFrame();
155 auto ctrlWrapper = builder.create();
156 const std::string controllerName = builder.getControllerName();
160 ctrlWrapper->daemonize(
false);
165 controllers.emplace(rns->getName(), std::move(ctrlWrapper));
171 for (
auto&
c : controllers)
173 c.second->updateConfig();
179 c.second->activate();
189 const auto platformControlConfig = in.parameters.platformControlConfig;
193 constexpr
auto ControllerType = ::armarx::control::njoint_controller::platform::
194 ControllerType::PlatformFollowerController;
196 auto platformControllerBuilder =
198 platformControllerBuilder.withNodeSet(
"Platform").withNamePrefix(
"Andre");
202 const std::string controllerClassName =
206 "armarx_control",
"controller_config/PlatformFollowerController/default.json");
208 ARMARX_CHECK(std::filesystem::exists(configPath.toSystemPath()));
210 platformControllerBuilder.withConfig(configPath.toSystemPath());
224 auto platformCtrlWrapper = platformControllerBuilder.create();
227 platformCtrlWrapper->activate();
234 ARMARX_INFO <<
"Stop requested. Deactivating controllers.";
235 for (
auto&
c : controllers)
237 c.second->deactivate();
239 platformCtrlWrapper->deactivate();
243 .status = ::armarx::skills::TerminatedSkillStatus::Succeeded,