Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ class ForwardControllersBase : public controller_interface::ControllerInterface

std::vector<std::string> command_interface_types_;

size_t history_depth_ = 1u;

// the realtime container to exchange the reference from subscriber
realtime_tools::RealtimeThreadSafeBox<CmdType> rt_command_;
// save the last reference in case of unable to get value from box
Expand Down
2 changes: 2 additions & 0 deletions forward_command_controller/src/forward_command_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ controller_interface::CallbackReturn ForwardCommandController::read_parameters()
command_interface_types_.push_back(joint + "/" + params_.interface_name);
}

history_depth_ = static_cast<size_t>(params_.queue_size);

return controller_interface::CallbackReturn::SUCCESS;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,12 @@ forward_command_controller:
},
read_only: true
}
queue_size: {
type: int,
description: "Size of the command queue",
default_value: 1,
read_only: true,
validation: {
gt_eq<>: 1
},
}
3 changes: 2 additions & 1 deletion forward_command_controller/src/forward_controllers_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ controller_interface::CallbackReturn ForwardControllersBase::on_configure(
return ret;
}

auto qos = rclcpp::SystemDefaultsQoS().keep_last(history_depth_);
joints_command_subscriber_ = get_node()->create_subscription<CmdType>(
"~/commands", rclcpp::SystemDefaultsQoS(),
"~/commands", qos,
[this](const CmdType::SharedPtr msg)
{
const auto cmd = *msg;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ controller_interface::CallbackReturn MultiInterfaceForwardCommandController::rea
command_interface_types_.push_back(params_.joint + "/" + interface);
}

history_depth_ = static_cast<size_t>(params_.queue_size);

return controller_interface::CallbackReturn::SUCCESS;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,12 @@ multi_interface_forward_command_controller:
},
read_only: true
}
queue_size: {
type: int,
description: "Size of the command queue",
default_value: 1,
read_only: true,
validation: {
gt_eq<>: 1
},
}