Skip to content

Commit d439fc7

Browse files
committed
Merge pull request #210 in SWDEV/franka_ros from bugfix/control-loop-does-not-exit-upon-controller-switching to develop
* commit 'b27e85734457ffd45102cc55def74535215ac96c': fix: The previous controller was still active after controller switching
2 parents 3584069 + b27e857 commit d439fc7

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Requires `libfranka` >= 0.8.0
1212
* `franka_control`: Fix a bug where `error_recovery` actions recover future errors ([#316](https://github.com/frankaemika/franka_ros/issues/316)).
1313
* `franka_gazebo`: `FrankaHWSim` only acts on joints belonging to a Franka robot. This allows to combine a Franka robot and others (like mobile platforms) in same URDF ([#313](https://github.com/frankaemika/franka_ros/issues/313))
1414
* `franka_description`: `<xacro:franka_robot/>` macro now supports to customize the `parent` frame and its `xyz` + `rpy` offset
15+
* `franka_hw`: Fix the bug where the previous controller is still running after switching the controller. ([#326](https://github.com/frankaemika/franka_ros/issues/326))
1516

1617
## 0.10.1 - 2022-09-15
1718

franka_hw/src/franka_hw.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,13 @@ bool FrankaHW::prepareSwitch(const std::list<hardware_interface::ControllerInfo>
297297
requested_control_mode &= ~stop_control_mode;
298298
requested_control_mode |= start_control_mode;
299299

300-
if (!setRunFunction(requested_control_mode, get_limit_rate_(), get_cutoff_frequency_(),
301-
get_internal_controller_())) {
302-
return false;
300+
{
301+
controller_active_ = false;
302+
std::lock_guard<std::mutex> lock(robot_mutex_);
303+
if (!setRunFunction(requested_control_mode, get_limit_rate_(), get_cutoff_frequency_(),
304+
get_internal_controller_())) {
305+
return false;
306+
}
303307
}
304308

305309
if (current_control_mode_ != requested_control_mode) {
@@ -309,7 +313,6 @@ bool FrankaHW::prepareSwitch(const std::list<hardware_interface::ControllerInfo>
309313
<< ", cutoff_frequency=" << get_cutoff_frequency_()
310314
<< ", internal_controller=" << get_internal_controller_());
311315
current_control_mode_ = requested_control_mode;
312-
controller_active_ = false;
313316
}
314317

315318
return true;

0 commit comments

Comments
 (0)