Skip to content

Commit 82435fc

Browse files
authored
Add new interface_configuration_types and reusable methods (#2902) (#2936)
1 parent eaa954a commit 82435fc

File tree

4 files changed

+369
-117
lines changed

4 files changed

+369
-117
lines changed

controller_interface/include/controller_interface/controller_interface_base.hpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,27 @@ enum class return_type : std::uint8_t
4646
/// Indicating which interfaces are to be claimed.
4747
/**
4848
* One might either claim all available command/state interfaces,
49-
* specifying a set of individual interfaces,
50-
* or none at all.
49+
* specifying a set of individual interfaces or none at all.
50+
* @enum ALL - Claim all available interfaces.
51+
* @enum INDIVIDUAL - Claim only the specified individual interfaces.
52+
* @enum NONE - Claim no interfaces.
53+
* @enum INDIVIDUAL_BEST_EFFORT - Claim the available interfaces from the specified individual
54+
* interfaces.
55+
* @enum REGEX - Claim interfaces matching the specified regular expressions.
5156
*/
5257
enum class interface_configuration_type : std::uint8_t
5358
{
5459
ALL = 0,
5560
INDIVIDUAL = 1,
5661
NONE = 2,
62+
INDIVIDUAL_BEST_EFFORT = 3,
63+
REGEX = 10
5764
};
5865

5966
/// Configuring what command/state interfaces to claim.
6067
struct InterfaceConfiguration
6168
{
62-
interface_configuration_type type;
69+
interface_configuration_type type = interface_configuration_type::NONE;
6370
std::vector<std::string> names = {};
6471
};
6572

@@ -370,6 +377,10 @@ class ControllerInterfaceBase : public rclcpp_lifecycle::node_interfaces::Lifecy
370377
* If interface_configuration_type::ALL is specified, the order is determined by the internal
371378
* memory of the resource_manager and may not be deterministic. To obtain a consistent order, use
372379
* \ref get_ordered_interfaces() from \ref helpers.hpp.
380+
* If interface_configuration_type::INDIVIDUAL_BEST_EFFORT or REGEX is specified, the order might
381+
* not matched the requested one, as it depends on the available interfaces in the resource
382+
* manager. Use the \ref get_ordered_interfaces() from \ref helpers.hpp to obtain a consistent
383+
* order.
373384
*/
374385
std::vector<hardware_interface::LoanedCommandInterface> command_interfaces_;
375386
/** Loaned state interfaces.
@@ -380,6 +391,10 @@ class ControllerInterfaceBase : public rclcpp_lifecycle::node_interfaces::Lifecy
380391
* If interface_configuration_type::ALL is specified, the order is determined by the internal
381392
* memory of the resource_manager and may not be deterministic. To obtain a consistent order, use
382393
* \ref get_ordered_interfaces() from \ref helpers.hpp.
394+
* If interface_configuration_type::INDIVIDUAL_BEST_EFFORT or REGEX is specified, the order might
395+
* not matched the requested one, as it depends on the available interfaces in the resource
396+
* manager. Use the \ref get_ordered_interfaces() from \ref helpers.hpp to obtain a consistent
397+
* order.
383398
*/
384399
std::vector<hardware_interface::LoanedStateInterface> state_interfaces_;
385400

0 commit comments

Comments
 (0)