@@ -51,6 +51,17 @@ bool DualArmControlSim::initObjectParam(YAML::Node config) {
51
51
return true ;
52
52
}
53
53
54
+ bool DualArmControlSim::initTargetParam () {
55
+ // Savitzky-Golay Filter params // TODO IN PARAMS?
56
+ int sgfPos[3 ];
57
+ sgfPos[0 ] = 3 ; // dim
58
+ sgfPos[1 ] = 3 ; // order
59
+ sgfPos[2 ] = 10 ;// window length
60
+ target_.init (sgfPos, periodT_);
61
+
62
+ return true ;
63
+ }
64
+
54
65
bool DualArmControlSim::initRobotParam (YAML::Node config) {
55
66
56
67
// Param vector
@@ -97,12 +108,12 @@ bool DualArmControlSim::initRobotParam(YAML::Node config) {
97
108
Eigen::Map<Eigen::VectorXf, Eigen::Unaligned>(qrbStandbyVect[RIGHT].data (), qrbStandbyVect[RIGHT].size ());
98
109
99
110
// Savitzky-Golay Filter params // TODO IN PARAMS?
100
- int sgf_dq [3 ];
101
- sgf_dq [0 ] = 7 ;// dim
102
- sgf_dq [1 ] = 3 ;// order
103
- sgf_dq [2 ] = 6 ;// window length
111
+ int sgfDq [3 ];
112
+ sgfDq [0 ] = 7 ;// dim
113
+ sgfDq [1 ] = 3 ;// order
114
+ sgfDq [2 ] = 6 ;// window length
104
115
105
- robot_.init (sgf_dq , periodT_, gravity_);
116
+ robot_.init (sgfDq , periodT_, gravity_);
106
117
107
118
robot_.setInitParameters (paramToolMass, toolOffsetFromEE, toolComPositionFromSensor, xrbStandby, qrbStandby);
108
119
@@ -185,14 +196,14 @@ bool DualArmControlSim::initDesTasksPosAndLimits(YAML::Node config) {
185
196
}
186
197
187
198
bool DualArmControlSim::initTossParamEstimator (const std::string pathLearnedModelfolder) {
188
- std::string file_gmm [3 ];
199
+ std::string fileGMM [3 ];
189
200
std::string dataType = " /throwingParam" ;
190
201
191
- file_gmm [0 ] = pathLearnedModelfolder + dataType + " _prio.txt" ;
192
- file_gmm [1 ] = pathLearnedModelfolder + dataType + " _mu.txt" ;
193
- file_gmm [2 ] = pathLearnedModelfolder + dataType + " _sigma.txt" ;
202
+ fileGMM [0 ] = pathLearnedModelfolder + dataType + " _prio.txt" ;
203
+ fileGMM [1 ] = pathLearnedModelfolder + dataType + " _mu.txt" ;
204
+ fileGMM [2 ] = pathLearnedModelfolder + dataType + " _sigma.txt" ;
194
205
195
- tossParamEstimator_.init (file_gmm ,
206
+ tossParamEstimator_.init (fileGMM ,
196
207
tossVar_.releasePosition ,
197
208
tossVar_.releaseOrientation ,
198
209
tossVar_.releaseLinearVelocity ,
@@ -237,7 +248,6 @@ bool DualArmControlSim::initDSThrowing() {
237
248
238
249
bool DualArmControlSim::loadParamFromFile (const std::string pathToYamlFile, const std::string pathLearnedModelfolder) {
239
250
YAML::Node config = YAML::LoadFile (pathToYamlFile);
240
- // TODO COMPLETE AND PUT IN YAML FILE
241
251
242
252
qpWrenchGeneration_ = config[" dual_arm_task" ][" isQP_wrench_generation" ].as <bool >();
243
253
isTargetFixed_ = config[" dual_arm_task" ][" isTargetFixed" ].as <bool >();
@@ -263,7 +273,7 @@ bool DualArmControlSim::loadParamFromFile(const std::string pathToYamlFile, cons
263
273
initDesTasksPosAndLimits (config);
264
274
initRobotParam (config);
265
275
initObjectParam (config);
266
- target_. init ( 3 , 3 , 10 , periodT_ );
276
+ initTargetParam ( );
267
277
268
278
initFreeMotionCtrl (config);
269
279
CooperativeCtrl.init ();
@@ -279,9 +289,6 @@ bool DualArmControlSim::loadParamFromFile(const std::string pathToYamlFile, cons
279
289
dsThrowingEstim_ = dsThrowing_;
280
290
freeMotionCtrlEstim_ = freeMotionCtrl_;
281
291
282
- bool isSim = config[" dual_system" ][" simulation" ].as <bool >();
283
- std::cout << " Load param from file TODO " << isSim << std::endl;
284
-
285
292
return true ;
286
293
}
287
294
@@ -358,7 +365,7 @@ bool DualArmControlSim::init() {
358
365
timeToInterceptTgt_ = 0 .0f ;
359
366
timeToInterceptBot_ = 0 .0f ;
360
367
361
- // TODO LOGGING?
368
+ // TODO LOGGING OR NOT HERE ?
362
369
// startlogging_ = false;
363
370
364
371
return true ;
@@ -379,8 +386,6 @@ bool DualArmControlSim::updateSim(Eigen::Matrix<float, 6, 1> robotWrench,
379
386
Eigen::Vector3f robotBasePos,
380
387
Eigen::Vector4f robotBaseOrientation) {
381
388
382
- // TODO in the base pose needed? In which frame should the variables be send?
383
-
384
389
for (int k = 0 ; k < NB_ROBOTS; k++) {
385
390
robot_.updateEndEffectorWrench (robotWrench, object_.getNormalVectSurfObj (), filteredForceGain_, wrenchBiasOK_, k);
386
391
robot_.updateEndEffectorPosesInWorld (eePose, eeOrientation, k);
@@ -396,12 +401,12 @@ bool DualArmControlSim::updateSim(Eigen::Matrix<float, 6, 1> robotWrench,
396
401
397
402
object_.setXo (objectPose);
398
403
object_.setQo (objectOrientation);
399
- object_.getHmgTransform ();// TODO change name?
404
+ object_.getHmgTransform ();// TODO change name, not really a get ?
400
405
401
406
target_.setXt (targetPose);
402
407
target_.setQt (targetOrientation);
403
408
// filtered object position
404
- target_.getFilteredState ();// TODO change name?
409
+ target_.getFilteredState ();// TODO change name, not really a get ?
405
410
406
411
return true ;
407
412
}
@@ -492,9 +497,8 @@ void DualArmControlSim::computeCommands(Eigen::Vector3f eePose, Eigen::Vector4f
492
497
bool isPlacing = isPlacing_ || (dualTaskSelector_ == PICK_AND_PLACE);
493
498
bool isThrowing = isThrowing_ || (dualTaskSelector_ == TOSSING) || (dualTaskSelector_ == PICK_AND_TOSS);
494
499
bool isPlaceTossing = isPlaceTossing_ || (dualTaskSelector_ == PLACE_TOSSING);
495
- // bool isClose2Release = (dsThrowing_.getActivationTangent() > 0.99f); TODO
496
500
497
- bool placingDone = (releaseFlag_) || ((object_.getWHo ().block <3 , 1 >(0 , 3 ) - xPlacing_).norm () <= 0.08 );// 0.05
501
+ bool placingDone = (releaseFlag_) || ((object_.getWHo ().block <3 , 1 >(0 , 3 ) - xPlacing_).norm () <= 0.08 );
498
502
bool placeTossingDone = (releaseFlag_)
499
503
|| (((object_.getWHo ().block <3 , 1 >(0 , 3 ) - tossVar_.releasePosition ).norm () <= 0.07 )
500
504
|| ((object_.getWHo ().block <2 , 1 >(0 , 3 ) - xPlacing_.head (2 )).norm () <= 0.05 ));
@@ -588,7 +592,7 @@ void DualArmControlSim::computeCommands(Eigen::Vector3f eePose, Eigen::Vector4f
588
592
}
589
593
590
594
// Reset some controller variables
591
- this ->reset ();// TODO
595
+ this ->reset ();
592
596
593
597
} else {// release_and_retract || release
594
598
if (releaseAndretract_) {
@@ -788,13 +792,6 @@ void DualArmControlSim::computeCommands(Eigen::Vector3f eePose, Eigen::Vector4f
788
792
Eigen::Vector3f DualArmControlSim::computeInterceptWithTarget (const Eigen::Vector3f& xTarget,
789
793
const Eigen::Vector3f& vTarget,
790
794
float phiInit) {
791
- // TODO CHECK IF CAN DELETE
792
- // float phiTarget = 0.0f;
793
- // if (vTarget.head(2).norm() > 1e-2) { phiTarget = std::atan2(vTarget(1), vTarget(0)); }
794
-
795
- // float phiTargetTangent = std::tan(phiTarget);
796
- // if (phiTargetTangent > 1e4) { phiTargetTangent = 1e4; }
797
- // if (-phiTargetTangent < -1e4) { phiTargetTangent = -1e4; }
798
795
799
796
Eigen::Vector3f xIntercept = xTarget;
800
797
0 commit comments