@@ -51,6 +51,17 @@ bool DualArmControlSim::initObjectParam(YAML::Node config) {
5151 return true ;
5252}
5353
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+
5465bool DualArmControlSim::initRobotParam (YAML::Node config) {
5566
5667 // Param vector
@@ -97,12 +108,12 @@ bool DualArmControlSim::initRobotParam(YAML::Node config) {
97108 Eigen::Map<Eigen::VectorXf, Eigen::Unaligned>(qrbStandbyVect[RIGHT].data (), qrbStandbyVect[RIGHT].size ());
98109
99110 // 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
104115
105- robot_.init (sgf_dq , periodT_, gravity_);
116+ robot_.init (sgfDq , periodT_, gravity_);
106117
107118 robot_.setInitParameters (paramToolMass, toolOffsetFromEE, toolComPositionFromSensor, xrbStandby, qrbStandby);
108119
@@ -185,14 +196,14 @@ bool DualArmControlSim::initDesTasksPosAndLimits(YAML::Node config) {
185196}
186197
187198bool DualArmControlSim::initTossParamEstimator (const std::string pathLearnedModelfolder) {
188- std::string file_gmm [3 ];
199+ std::string fileGMM [3 ];
189200 std::string dataType = " /throwingParam" ;
190201
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" ;
194205
195- tossParamEstimator_.init (file_gmm ,
206+ tossParamEstimator_.init (fileGMM ,
196207 tossVar_.releasePosition ,
197208 tossVar_.releaseOrientation ,
198209 tossVar_.releaseLinearVelocity ,
@@ -237,7 +248,6 @@ bool DualArmControlSim::initDSThrowing() {
237248
238249bool DualArmControlSim::loadParamFromFile (const std::string pathToYamlFile, const std::string pathLearnedModelfolder) {
239250 YAML::Node config = YAML::LoadFile (pathToYamlFile);
240- // TODO COMPLETE AND PUT IN YAML FILE
241251
242252 qpWrenchGeneration_ = config[" dual_arm_task" ][" isQP_wrench_generation" ].as <bool >();
243253 isTargetFixed_ = config[" dual_arm_task" ][" isTargetFixed" ].as <bool >();
@@ -263,7 +273,7 @@ bool DualArmControlSim::loadParamFromFile(const std::string pathToYamlFile, cons
263273 initDesTasksPosAndLimits (config);
264274 initRobotParam (config);
265275 initObjectParam (config);
266- target_. init ( 3 , 3 , 10 , periodT_ );
276+ initTargetParam ( );
267277
268278 initFreeMotionCtrl (config);
269279 CooperativeCtrl.init ();
@@ -279,9 +289,6 @@ bool DualArmControlSim::loadParamFromFile(const std::string pathToYamlFile, cons
279289 dsThrowingEstim_ = dsThrowing_;
280290 freeMotionCtrlEstim_ = freeMotionCtrl_;
281291
282- bool isSim = config[" dual_system" ][" simulation" ].as <bool >();
283- std::cout << " Load param from file TODO " << isSim << std::endl;
284-
285292 return true ;
286293}
287294
@@ -358,7 +365,7 @@ bool DualArmControlSim::init() {
358365 timeToInterceptTgt_ = 0 .0f ;
359366 timeToInterceptBot_ = 0 .0f ;
360367
361- // TODO LOGGING?
368+ // TODO LOGGING OR NOT HERE ?
362369 // startlogging_ = false;
363370
364371 return true ;
@@ -379,8 +386,6 @@ bool DualArmControlSim::updateSim(Eigen::Matrix<float, 6, 1> robotWrench,
379386 Eigen::Vector3f robotBasePos,
380387 Eigen::Vector4f robotBaseOrientation) {
381388
382- // TODO in the base pose needed? In which frame should the variables be send?
383-
384389 for (int k = 0 ; k < NB_ROBOTS; k++) {
385390 robot_.updateEndEffectorWrench (robotWrench, object_.getNormalVectSurfObj (), filteredForceGain_, wrenchBiasOK_, k);
386391 robot_.updateEndEffectorPosesInWorld (eePose, eeOrientation, k);
@@ -396,12 +401,12 @@ bool DualArmControlSim::updateSim(Eigen::Matrix<float, 6, 1> robotWrench,
396401
397402 object_.setXo (objectPose);
398403 object_.setQo (objectOrientation);
399- object_.getHmgTransform ();// TODO change name?
404+ object_.getHmgTransform ();// TODO change name, not really a get ?
400405
401406 target_.setXt (targetPose);
402407 target_.setQt (targetOrientation);
403408 // filtered object position
404- target_.getFilteredState ();// TODO change name?
409+ target_.getFilteredState ();// TODO change name, not really a get ?
405410
406411 return true ;
407412}
@@ -492,9 +497,8 @@ void DualArmControlSim::computeCommands(Eigen::Vector3f eePose, Eigen::Vector4f
492497 bool isPlacing = isPlacing_ || (dualTaskSelector_ == PICK_AND_PLACE);
493498 bool isThrowing = isThrowing_ || (dualTaskSelector_ == TOSSING) || (dualTaskSelector_ == PICK_AND_TOSS);
494499 bool isPlaceTossing = isPlaceTossing_ || (dualTaskSelector_ == PLACE_TOSSING);
495- // bool isClose2Release = (dsThrowing_.getActivationTangent() > 0.99f); TODO
496500
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 );
498502 bool placeTossingDone = (releaseFlag_)
499503 || (((object_.getWHo ().block <3 , 1 >(0 , 3 ) - tossVar_.releasePosition ).norm () <= 0.07 )
500504 || ((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
588592 }
589593
590594 // Reset some controller variables
591- this ->reset ();// TODO
595+ this ->reset ();
592596
593597 } else {// release_and_retract || release
594598 if (releaseAndretract_) {
@@ -788,13 +792,6 @@ void DualArmControlSim::computeCommands(Eigen::Vector3f eePose, Eigen::Vector4f
788792Eigen::Vector3f DualArmControlSim::computeInterceptWithTarget (const Eigen::Vector3f& xTarget,
789793 const Eigen::Vector3f& vTarget,
790794 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; }
798795
799796 Eigen::Vector3f xIntercept = xTarget;
800797
0 commit comments