Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Release Versions:

- fix(controllers): safety check for predicate publisher access (#238)
- fix: remove ABI breaking assignment methods from C++ components and controllers (#240)
- fix(controllers): revert ABI breaking change for control type (#240)

## 5.4.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ class RobotControllerInterface : public ControllerInterface {

std::vector<std::string> joints_;///< The joint names provided by a parameter
std::string control_type_; ///< The high-level interface type (position, velocity, acceleration or effort)
bool control_type_fixed_; ///< If true, the control type cannot be changed after

bool robot_model_required_;///< If true, check that a robot model is available on configure
bool load_geometries_; ///< If true, load geometries from the URDF into the robot model
Expand Down
6 changes: 3 additions & 3 deletions source/modulo_controllers/src/RobotControllerInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ RobotControllerInterface::RobotControllerInterface(
bool robot_model_required, const std::string& control_type, bool load_geometries)
: ControllerInterface(true),
control_type_(control_type),
control_type_fixed_(false),
robot_model_required_(robot_model_required),
load_geometries_(load_geometries),
new_joint_command_ready_(false),
Expand Down Expand Up @@ -145,7 +144,6 @@ rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn RobotC
for (const auto& joint : joints_) {
add_command_interface(joint, control_type_);
}
control_type_fixed_ = true;
}

auto ft_sensor_name = get_parameter("ft_sensor_name");
Expand Down Expand Up @@ -387,7 +385,9 @@ std::string RobotControllerInterface::get_control_type() const {
}

void RobotControllerInterface::set_control_type(const std::string& control_type) {
if (control_type_fixed_) {
// FIXME: this is a quick solution to prevent adding a new private attribute to the class.
// The joint_state is initialized shortly before the interfaces are added so it can be used as a proxy.
if (joint_state_.get_name() == hardware_name_) {
throw std::runtime_error("Control type is fixed and cannot be changed anymore");
}
if (!control_type.empty() && interface_map.count(control_type) == 0) {
Expand Down
Loading