@@ -285,18 +285,21 @@ void Franka::osc() {
285285 const Eigen::Vector3d kp_p_cfg = this ->m_cfg .kp_p ;
286286 const double kp_r_cfg = this ->m_cfg .kp_r ;
287287 const common::Vector7d torque_limit = this ->m_cfg .torque_limit ;
288+ const bool allow_high_collision = this ->m_cfg .allow_high_collision ;
288289
289290 this ->controller_time = 0.0 ;
290291
291292 // conservative collision and impedance behavior
292293 this ->set_default_robot_behavior ();
293294
294- // high collision threshold values for high impedance
295- this ->robot .setCollisionBehavior (
296- {{100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 }},
297- {{100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 }},
298- {{100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 }},
299- {{100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 }});
295+ if (allow_high_collision) {
296+ // High collision threshold values for high impedance.
297+ this ->robot .setCollisionBehavior (
298+ {{100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 }},
299+ {{100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 }},
300+ {{100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 }},
301+ {{100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 }});
302+ }
300303
301304 // from bench mark
302305 // ([150.0, 150.0, 60.0], 250.0), // kp_translation, kp_rotation
@@ -514,17 +517,20 @@ void Franka::joint_controller() {
514517 const common::Vector7d Kp = this ->m_cfg .kp ;
515518 const common::Vector7d Kd = this ->m_cfg .kd ;
516519 const common::Vector7d torque_limit = this ->m_cfg .torque_limit ;
520+ const bool allow_high_collision = this ->m_cfg .allow_high_collision ;
517521 this ->controller_time = 0.0 ;
518522
519523 // conservative collision and impedance behavior
520524 this ->set_default_robot_behavior ();
521525
522- // high collision threshold values for high impedance
523- this ->robot .setCollisionBehavior (
524- {{100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 }},
525- {{100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 }},
526- {{100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 }},
527- {{100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 }});
526+ if (allow_high_collision) {
527+ // High collision threshold values for high impedance.
528+ this ->robot .setCollisionBehavior (
529+ {{100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 }},
530+ {{100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 }},
531+ {{100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 }},
532+ {{100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 }});
533+ }
528534
529535 Eigen::Array<double , 7 , 1 > joint_max_;
530536 Eigen::Array<double , 7 , 1 > joint_min_;
@@ -613,12 +619,15 @@ void Franka::zero_torque_guiding() {
613619}
614620
615621void Franka::zero_torque_controller () {
616- // high collision threshold values for high impedance
617- robot.setCollisionBehavior (
618- {{100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 }},
619- {{100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 }},
620- {{100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 }},
621- {{100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 }});
622+ this ->set_default_robot_behavior ();
623+ if (this ->m_cfg .allow_high_collision ) {
624+ // High collision threshold values for high impedance.
625+ robot.setCollisionBehavior (
626+ {{100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 }},
627+ {{100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 }},
628+ {{100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 }},
629+ {{100.0 , 100.0 , 100.0 , 100.0 , 100.0 , 100.0 }});
630+ }
622631
623632 this ->controller_time = 0.0 ;
624633 try {
0 commit comments