@@ -220,6 +220,11 @@ void Franka::check_for_background_errors() {
220220 }
221221}
222222
223+ void Franka::clear_background_error () {
224+ std::lock_guard<std::mutex> lock (this ->exception_mutex );
225+ this ->background_exception = nullptr ;
226+ }
227+
223228void Franka::osc_set_cartesian_position (
224229 const common::Pose& desired_pose_EE_in_base_frame) {
225230 this ->check_for_background_errors ();
@@ -335,8 +340,7 @@ void Franka::osc() {
335340
336341 // torques handler
337342 if (this ->running_controller .load () == Controller::none) {
338- franka::Torques zero_torques{{0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 }};
339- return franka::MotionFinished (zero_torques);
343+ return franka::MotionFinished (franka::Torques (robot_state.tau_J_d ));
340344 }
341345 // TO BE replaced
342346 // if (!this->control_thread_running && dq.maxCoeff() < 0.0001) {
@@ -541,9 +545,7 @@ void Franka::joint_controller() {
541545
542546 // torques handler
543547 if (this ->running_controller .load () == Controller::none) {
544- // TODO: test if this also works when the robot is moving
545- franka::Torques zero_torques{{0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 }};
546- return franka::MotionFinished (zero_torques);
548+ return franka::MotionFinished (franka::Torques (robot_state.tau_J_d ));
547549 }
548550
549551 common::Vector7d desired_q;
@@ -667,6 +669,7 @@ void Franka::automatic_error_recovery() {
667669void Franka::reset () {
668670 this ->stop_control_thread ();
669671 this ->automatic_error_recovery ();
672+ this ->clear_background_error ();
670673}
671674
672675void Franka::wait_milliseconds (int milliseconds) {
0 commit comments