Skip to content

Commit 8bc34f2

Browse files
committed
fix(fr3): torque discontinuity while reset
1 parent 6d795ae commit 8bc34f2

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

‎extensions/rcs_fr3/src/hw/Franka.cpp‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
223228
void 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() {
667669
void Franka::reset() {
668670
this->stop_control_thread();
669671
this->automatic_error_recovery();
672+
this->clear_background_error();
670673
}
671674

672675
void Franka::wait_milliseconds(int milliseconds) {

‎extensions/rcs_fr3/src/hw/Franka.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ class Franka : public common::Robot {
9393
void joint_controller();
9494
void zero_torque_controller();
9595
void check_for_background_errors();
96+
void clear_background_error();
9697

9798
public:
9899
Franka(const FrankaConfig& cfg,

0 commit comments

Comments
 (0)