ControllerInterface.ice
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package RobotAPI::NJointControllerInterface
17 * @author Mirko Waechter ( mirko dot waechter at kit dot edu )
18 * @date 2017
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22
23#pragma once
24
25#include <ArmarXCore/interface/serialization/Eigen.ice>
26
27#include <RobotAPI/interface/core/Trajectory.ice>
28#include <RobotAPI/interface/units/RobotUnit/NJointController.ice>
29
30module armarx
31{
41
42 class NJointTaskSpaceDMPControllerConfig extends NJointControllerConfig
43 {
44
45 // dmp configuration
46 float DMPKd = 20;
47 int kernelSize = 100;
48 double tau = 1;
49 string dmpMode = "MinimumJerk";
50 string dmpStyle = "Discrete";
51 double dmpAmplitude = 1;
52
53 double phaseL = 10;
54 double phaseK = 10;
55 double phaseDist0 = 50;
56 double phaseDist1 = 10;
57 double phaseKpPos = 1;
58 double phaseKpOri = 0.1;
59 double timeDuration = 10;
60 double posToOriRatio = 100;
61
62 // velocity controller configuration
63 string nodeSetName = "";
64 string tcpName = "";
65 string frameName = "";
68
72 string debugName;
73
78
81 };
82
83 interface NJointTaskSpaceDMPControllerInterface extends NJointControllerInterface
84 {
85 void learnDMPFromFiles(Ice::StringSeq trajfiles);
86 bool isFinished();
87 void runDMP(Ice::DoubleSeq goals, double tau);
88 void runDMPWithTime(Ice::DoubleSeq goals, double time);
89
90 void setSpeed(double times);
91 void setViaPoints(double canVal, Ice::DoubleSeq point);
93 void setGoals(Ice::DoubleSeq goals);
94
95 double getCanVal();
96 void resetDMP();
97 void stopDMP();
98 void pauseDMP();
99 void resumeDMP();
100
101 void setControllerTarget(float avoidJointLimitsKp,
103 void setTorqueKp(StringFloatDictionary torqueKp);
104 void setNullspaceJointVelocities(StringFloatDictionary nullspaceJointVelocities);
106 Ice::DoubleSeq createDMPFromString(string dmpString);
107
108 void setMPWeights(DoubleSeqSeq weights);
109 DoubleSeqSeq getMPWeights();
110
111 void setLinearVelocityKd(float kd);
112 void setLinearVelocityKp(float kp);
113 void setAngularVelocityKd(float kd);
114 void setAngularVelocityKp(float kp);
115 };
116
117 class NJointCCDMPControllerConfig extends NJointControllerConfig
118 {
119
120 // dmp configuration
121 float DMPKd = 20;
122 int kernelSize = 100;
123 double tau = 1;
124 int dmpMode = 1;
125 int dmpNum = 2;
126
127 // phaseStop technique
128 double phaseL = 10;
129 double phaseK = 10;
130 double phaseDist0 = 50;
131 double phaseDist1 = 10;
132 double phaseKpPos = 1;
133 double phaseKpOri = 0.1;
134
135
136 // misc
137 Ice::DoubleSeq timeDurations;
138 Ice::StringSeq dmpTypes;
139 Ice::DoubleSeq amplitudes;
140
141
142 double posToOriRatio = 100;
143
144 // velocity controller configuration
145 string nodeSetName = "";
146 string tcpName = "";
149 };
150
151 interface NJointCCDMPControllerInterface extends NJointControllerInterface
152 {
153 void learnDMPFromFiles(int dmpId, Ice::StringSeq trajfiles);
155 void runDMP();
156
157 void setTemporalFactor(int dmpId, double tau);
158 void setViaPoints(int dmpId, double canVal, Ice::DoubleSeq point);
159 void setGoals(int dmpId, Ice::DoubleSeq goals);
160
161 void setControllerTarget(float avoidJointLimitsKp,
163 void setTorqueKp(StringFloatDictionary torqueKp);
164 void setNullspaceJointVelocities(StringFloatDictionary nullspaceJointVelocities);
165 };
166
167 class NJointPeriodicTSDMPControllerConfig extends NJointControllerConfig
168 {
169
170 // dmp configuration
171 int kernelSize = 100;
172 double dmpAmplitude = 1;
173 double timeDuration = 10;
174
175 double phaseL = 10;
176 double phaseK = 10;
177 double phaseDist0 = 50;
178 double phaseDist1 = 10;
179 double phaseKpPos = 1;
180 double phaseKpOri = 0.1;
181 double posToOriRatio = 100;
182
183
184 // velocity controller configuration
185 string nodeSetName = "";
186
191
192 float Kpos;
193 float Kori;
194
195 string forceSensorName = "FT R";
196 string forceFrameName = "ArmR8_Wri2";
197 float forceFilter = 0.8;
199 float Kpf;
200
202 };
203
204 interface NJointPeriodicTSDMPControllerInterface extends NJointControllerInterface
205 {
206 void learnDMPFromFiles(Ice::StringSeq trajfiles);
207
209 void runDMP(Ice::DoubleSeq goals, double tau);
210
211 void setSpeed(double times);
212 void setGoals(Ice::DoubleSeq goals);
213 void setAmplitude(double amplitude);
214
215 double getCanVal();
216 };
217
218 class NJointPeriodicTSDMPCompliantControllerConfig extends NJointControllerConfig
219 {
220
221 // dmp configuration
222 int kernelSize = 100;
223 double dmpAmplitude = 1;
224 double timeDuration = 10;
225
226 double phaseL = 10;
227 double phaseK = 10;
228 float phaseDist0 = 50;
229 float phaseDist1 = 10;
230 double phaseKpPos = 1;
231 double phaseKpOri = 0.1;
232 double posToOriRatio = 100;
233
234
235 // velocity controller configuration
236 string nodeSetName = "";
237
239 Ice::FloatSeq Kpos;
240 Ice::FloatSeq Dpos;
241 Ice::FloatSeq Kori;
242 Ice::FloatSeq Dori;
243
245 float Knull;
246 float Dnull;
247
248 string forceSensorName = "FT R";
249 string forceFrameName = "ArmR8_Wri2";
250 float forceFilter = 0.8;
252 float Kpf;
253
255
258
261
262 Ice::FloatSeq ws_x;
263 Ice::FloatSeq ws_y;
264 Ice::FloatSeq ws_z;
265
267
274
275 bool isManipulability = false;
276 Ice::DoubleSeq kmani;
278 Ice::DoubleSeq maniWeight;
279 };
280
281 interface NJointPeriodicTSDMPCompliantControllerInterface extends NJointControllerInterface
282 {
283 void learnDMPFromFiles(Ice::StringSeq trajfiles);
284 void learnDMPFromTrajectory(TrajectoryBase trajectory);
285
287 void runDMP(Ice::DoubleSeq goals, double tau);
288
289 void setSpeed(double times);
290 void setGoals(Ice::DoubleSeq goals);
291 void setAmplitude(double amplitude);
292 void setTargetForceInRootFrame(float force);
293
294 double getCanVal();
295 };
296
297 class DeprecatedNJointTaskSpaceDMPControllerConfig extends NJointControllerConfig
298 {
299
300 // dmp configuration
301 float DMPKd = 20;
302 int kernelSize = 100;
303 double tau = 1;
304 string dmpMode = "MinimumJerk";
305 string dmpStyle = "Discrete";
306 double dmpAmplitude = 1;
307
308 double phaseL = 10;
309 double phaseK = 10;
310 double phaseDist0 = 50;
311 double phaseDist1 = 10;
312 double phaseKpPos = 1;
313 double phaseKpOri = 0.1;
314 double timeDuration = 10;
315 double posToOriRatio = 100;
316
317 // velocity controller configuration
318 string nodeSetName = "";
319 string tcpName = "";
320 string frameName = "";
323
327 string debugName;
328
333
336
341 Eigen::Vector3f forceThreshold;
342 string forceFrameName = "ArmR8_Wri2";
343 };
344
345 interface DeprecatedNJointTaskSpaceDMPControllerInterface extends NJointControllerInterface
346 {
347 void learnDMPFromFiles(Ice::StringSeq trajfiles);
349 void runDMP(Ice::DoubleSeq goals, double tau);
350 void runDMPWithTime(Ice::DoubleSeq goals, double time);
351
352 void setSpeed(double times);
353 void setViaPoints(double canVal, Ice::DoubleSeq point);
355 void setGoals(Ice::DoubleSeq goals);
356
357 double getCanVal();
358 void resetDMP();
359 void stopDMP();
360 void pauseDMP();
361 void resumeDMP();
363
364 void setControllerTarget(float avoidJointLimitsKp,
366 void setTorqueKp(StringFloatDictionary torqueKp);
367 void setNullspaceJointVelocities(StringFloatDictionary nullspaceJointVelocities);
369 Ice::DoubleSeq createDMPFromString(string dmpString);
370
371 void setMPWeights(DoubleSeqSeq weights);
372 DoubleSeqSeq getMPWeights();
373
374 void setLinearVelocityKd(float kd);
375 void setLinearVelocityKp(float kp);
376 void setAngularVelocityKd(float kd);
377 void setAngularVelocityKp(float kp);
378
381 void setForceThreshold(Eigen::Vector3f forceThreshold);
382 };
383
384 class DeprecatedNJointTaskSpaceImpedanceDMPControllerConfig extends NJointControllerConfig
385 {
386
387 // dmp configuration
388 int kernelSize = 100;
389 string dmpMode = "MinimumJerk";
390 string dmpType = "Discrete";
393
394 // phaseStop technique
395 double phaseL = 10;
396 double phaseK = 10;
397 double phaseDist0 = 50;
398 double phaseDist1 = 10;
399 double posToOriRatio = 100;
400
401
402 Ice::FloatSeq Kpos;
403 Ice::FloatSeq Dpos;
404 Ice::FloatSeq Kori;
405 Ice::FloatSeq Dori;
406
407 Ice::FloatSeq Knull;
408 Ice::FloatSeq Dnull;
409
412
414
415
420 Eigen::Vector3f forceThreshold;
421 string forceFrameName = "ArmR8_Wri2";
422 };
423
425 NJointControllerInterface
426 {
427 void learnDMPFromFiles(Ice::StringSeq trajfiles);
428 void learnJointDMPFromFiles(string jointTrajFile, Ice::FloatSeq currentJVS);
429 void setUseNullSpaceJointDMP(bool enable);
430
433 void runDMP(Ice::DoubleSeq goals);
434 void runDMPWithTime(Ice::DoubleSeq goals, double timeDuration);
435
436 void setViaPoints(double canVal, Ice::DoubleSeq point);
437 void setGoals(Ice::DoubleSeq goals);
438 void setDefaultNullSpaceJointValues(Eigen::VectorXf jointValues);
439
441
442 void resetDMP();
443 void stopDMP();
444 void resumeDMP();
446
447 void setMPWeights(DoubleSeqSeq weights);
448 DoubleSeqSeq getMPWeights();
449
450 void setLinearVelocityKd(Eigen::Vector3f kd);
451 void setLinearVelocityKp(Eigen::Vector3f kp);
452 void setAngularVelocityKd(Eigen::Vector3f kd);
453 void setAngularVelocityKp(Eigen::Vector3f kp);
454 void setNullspaceVelocityKd(Eigen::VectorXf jointValues);
455 void setNullspaceVelocityKp(Eigen::VectorXf jointValues);
456
459 void setForceThreshold(Eigen::Vector3f forceThreshold);
460
462 Ice::DoubleSeq createDMPFromString(string dmpString);
463
464 double getCanVal();
465 };
466
468 {
469 // dmp configuration
470 int kernelSize = 100;
471 string dmpMode = "MinimumJerk";
472 string dmpType = "Discrete";
475
476 // phaseStop technique
477 double phaseL = 10;
478 double phaseK = 10;
479 double phaseDist0 = 50;
480 double phaseDist1 = 10;
481 double posToOriRatio = 100;
482
483 // control parameter ts
489
490 // nullspace config
491 Eigen::VectorXf Knull;
492 Eigen::VectorXf Dnull;
495
498
499 /// force torque sensor
501 string forceFrameName = "ArmR8_Wri2";
506
508 float tcpMass = 0.0f;
510 // Eigen::Vector3f forceOffsetExternal;
511 // Eigen::Vector3f torqueOffsetExternal;
512 };
513
515 NJointControllerInterface
516 {
517 void setTargetNullSpaceJointValues(Eigen::VectorXf jointValues);
518
519 // MP related
520 void learnDMPFromFiles(Ice::StringSeq trajfiles);
521 void learnJointDMPFromFiles(string jointTrajFile, Ice::FloatSeq currentJVS);
522 void setUseNullSpaceJointDMP(bool enable);
523
524 void setViaPoints(double canVal, Ice::DoubleSeq point);
525 void setGoals(Ice::DoubleSeq goals);
526 void setStartAndGoals(Ice::DoubleSeq starts, Ice::DoubleSeq goals);
528 void runDMP(Ice::DoubleSeq goals);
529 void runDMPWithTime(Ice::DoubleSeq goals, double timeDuration);
531 void resetDMP();
532 void stopDMP();
533 void resumeDMP();
534 void pauseDMP();
536 void setMPWeights(DoubleSeqSeq weights);
537 DoubleSeqSeq getMPWeights();
539 Ice::DoubleSeq createDMPFromString(string dmpString);
540 double getCanVal();
541
544
548
549 void setTCPMass(float mass);
550 void setTCPCoMInFTFrame(Eigen::Vector3f com);
551
552 void setNullspaceVelocityKd(Eigen::VectorXf jointValues);
553 void setNullspaceVelocityKp(Eigen::VectorXf jointValues);
554
555 // RTController::ControllerInfo getControllerInfo();
557
558 // Eigen::Vector6f getFilteredForceTorque();
559 void setPotentialForceBaseline(Eigen::Vector3f force, Eigen::Vector3f torque);
560 };
561
563 {
564 // dmp configuration
565 int kernelSize = 100;
566 double dmpAmplitude = 1;
567 double timeDuration = 10;
568 string nodeSetName = "";
569
570 double phaseL = 10;
571 double phaseK = 10;
572 float phaseDist0 = 50;
573 float phaseDist1 = 10;
574 double phaseKpPos = 1;
575 double phaseKpOri = 0.1;
576 double posToOriRatio = 100;
577
578 // controller gains
581 Eigen::Vector4f pidForce;
582
583 Eigen::VectorXf Knull;
584 Eigen::VectorXf Dnull;
586
589
590 // float minimumReactForce = 0;
591 // float maxLinearVel;
592 // float maxAngularVel;
593
594 /// adaptive settings
595 Ice::FloatSeq ws_x;
596 Ice::FloatSeq ws_y;
597 Ice::FloatSeq ws_z;
601
602 /// force torque sensor
603 string forceSensorName = "FT R";
604 string forceFrameName = "ArmR8_Wri2";
605 float forceFilter = 0.8;
609
611 float tcpMass = 0.0f;
613
614 /// tool setup (Effective frame in root)
615 Eigen::Matrix4f toolFrameInRoot;
616 };
617
619 NJointControllerInterface
620 {
621 void learnDMPFromFiles(Ice::StringSeq trajfiles);
622 void learnDMPFromTrajectory(TrajectoryBase trajectory);
623
625 void runDMP(Ice::DoubleSeq goals, double tau);
626
627 void resetDMP();
628 void stopDMP();
629 void resumeDMP();
630 void pauseDMP();
631
632 void setSpeed(double times);
633 void setGoals(Ice::DoubleSeq goals);
634 void setAmplitude(double amplitude);
635 void setTargetForceInRootFrame(float force);
636
639
640 double getCanVal();
641
643 };
644};
Eigen::Matrix4f toolFrameInRoot
tool setup (Effective frame in root)
NJointTaskSpaceDMPControllerMode::CartesianSelection mode
NJointTaskSpaceDMPControllerMode::CartesianSelection mode
NJointTaskSpaceDMPControllerMode::CartesianSelection mode
void setStartAndGoals(Ice::DoubleSeq starts, Ice::DoubleSeq goals)
void runDMPWithTime(Ice::DoubleSeq goals, double timeDuration)
void learnJointDMPFromFiles(string jointTrajFile, Ice::FloatSeq currentJVS)
void setPotentialForceBaseline(Eigen::Vector3f force, Eigen::Vector3f torque)
void setViaPoints(double canVal, Ice::DoubleSeq point)
void setControllerTarget(float avoidJointLimitsKp, NJointTaskSpaceDMPControllerMode::CartesianSelection mode)
void runDMPWithTime(Ice::DoubleSeq goals, double time)
Ice::DoubleSeq createDMPFromString(string dmpString)
void setTorqueKp(StringFloatDictionary torqueKp)
void setNullspaceJointVelocities(StringFloatDictionary nullspaceJointVelocities)
void setForceThreshold(Eigen::Vector3f forceThreshold)
void runDMP(Ice::DoubleSeq goals, double tau)
void setViaPoints(double canVal, Ice::DoubleSeq point)
void setDefaultNullSpaceJointValues(Eigen::VectorXf jointValues)
void runDMPWithTime(Ice::DoubleSeq goals, double timeDuration)
void learnJointDMPFromFiles(string jointTrajFile, Ice::FloatSeq currentJVS)
void setViaPoints(double canVal, Ice::DoubleSeq point)
void setViaPoints(int dmpId, double canVal, Ice::DoubleSeq point)
void setControllerTarget(float avoidJointLimitsKp, NJointTaskSpaceDMPControllerMode::CartesianSelection mode)
void learnDMPFromFiles(int dmpId, Ice::StringSeq trajfiles)
void setGoals(int dmpId, Ice::DoubleSeq goals)
void setTorqueKp(StringFloatDictionary torqueKp)
void setNullspaceJointVelocities(StringFloatDictionary nullspaceJointVelocities)
void setTemporalFactor(int dmpId, double tau)
void learnDMPFromTrajectory(TrajectoryBase trajectory)
void runDMP(Ice::DoubleSeq goals, double tau)
void learnDMPFromFiles(Ice::StringSeq trajfiles)
void runDMP(Ice::DoubleSeq goals, double tau)
void setControllerTarget(float avoidJointLimitsKp, NJointTaskSpaceDMPControllerMode::CartesianSelection mode)
void runDMPWithTime(Ice::DoubleSeq goals, double time)
Ice::DoubleSeq createDMPFromString(string dmpString)
void setTorqueKp(StringFloatDictionary torqueKp)
void learnDMPFromFiles(Ice::StringSeq trajfiles)
void setNullspaceJointVelocities(StringFloatDictionary nullspaceJointVelocities)
void runDMP(Ice::DoubleSeq goals, double tau)
void setViaPoints(double canVal, Ice::DoubleSeq point)
Matrix< float, 6, 1 > Vector6f
This file offers overloads of toIce() and fromIce() functions for STL container types.