26 #include <VirtualRobot/RobotNodeSet.h>
30 #include "../RobotUnit.h"
33 #define DEFAULT_TCP_STRING "default TCP"
38 NJointControllerRegistration<NJointTCPController>
44 return "NJointTCPController";
60 if (mode == VirtualRobot::IKSolver::All)
84 Eigen::MatrixXf jacobiInv = ik->getPseudoInverseJacobianMatrix(tcp, mode);
85 Eigen::VectorXf jointTargetVelocities = jacobiInv * x;
87 for (
size_t i = 0; i < targets.size(); ++i)
89 targets.at(i)->velocity = jointTargetVelocities(i);
93 ::armarx::WidgetDescription::WidgetSeq
97 ::armarx::WidgetDescription::WidgetSeq widgets;
98 auto addSlider = [&](
const std::string& label,
float limit)
100 widgets.emplace_back(
new Label(
false, label));
105 c_x->defaultValue = 0.0f;
107 widgets.emplace_back(c_x);
114 addSlider(
"roll", 0.5);
115 addSlider(
"pitch", 0.5);
116 addSlider(
"yaw", 0.5);
123 const std::map<std::string, ConstControlDevicePtr>& controlDevices,
124 const std::map<std::string, ConstSensorDevicePtr>&)
129 LabelPtr label =
new Label;
130 label->text =
"nodeset name";
131 layout->children.emplace_back(label);
132 StringComboBoxPtr box =
new StringComboBox;
133 box->defaultIndex = 0;
135 box->options = robot->getRobotNodeSetNames();
136 box->name =
"nodeSetName";
137 layout->children.emplace_back(box);
139 LabelPtr labelTCP =
new Label;
140 labelTCP->text =
"tcp name";
141 layout->children.emplace_back(labelTCP);
142 StringComboBoxPtr boxTCP =
new StringComboBox;
143 boxTCP->defaultIndex = 0;
145 boxTCP->options = robot->getRobotNodeNames();
147 boxTCP->name =
"tcpName";
148 layout->children.emplace_back(boxTCP);
150 LabelPtr labelMode =
new Label;
151 labelMode->text =
"mode";
152 layout->children.emplace_back(labelMode);
153 StringComboBoxPtr boxMode =
new StringComboBox;
154 boxMode->defaultIndex = 0;
156 boxMode->options = {
"Position",
"Orientation",
"Both"};
157 boxMode->name =
"mode";
158 layout->children.emplace_back(boxMode);
165 layout->children.emplace_back(
new HSpacer);
169 NJointTCPControllerConfigPtr
173 values.at(
"tcpName")->getString()};
177 const NJointTCPControllerConfigPtr& config,
183 auto nodeset =
rtGetRobot()->getRobotNodeSet(config->nodeSetName);
185 for (
size_t i = 0; i < nodeset->getSize(); ++i)
187 auto jointName = nodeset->getNode(i)->getName();
190 targets.push_back(ct->
asA<ControlTarget1DoFActuatorVelocity>());
191 sensors.push_back(sv->
asA<SensorValue1DoFActuatorPosition>());
193 ik.reset(
new VirtualRobot::DifferentialIK(
194 nodeset,
rtGetRobot()->getRootNode(), VirtualRobot::JacobiProvider::eSVDDamped));
197 :
rtGetRobot()->getRobotNode(config->tcpName);
200 nodeSetName = config->nodeSetName;
240 layout->children.insert(layout->children.end(), sliders.begin(), sliders.end());
241 return {{
"ControllerTarget", layout}};
249 if (name ==
"ControllerTarget")