Skip to content

Commit

Permalink
Revert "Add macro with also enable argument"
Browse files Browse the repository at this point in the history
  • Loading branch information
saikishor committed Dec 9, 2024
1 parent 90d9896 commit 140d4ca
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
4 changes: 0 additions & 4 deletions doc/introspection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ How to register a variable for introspection
// The variable is introspected only when the controller is active and
// then deactivated when the controller is deactivated.
REGISTER_ROS2_CONTROL_INTROSPECTION("my_variable_name", &my_variable_);
// Register the variable for introspection that starts with the introspection enabled
// So, that the variable starts to be introspected, when the controller is in configured state.
// However, once the controller is activated and deactivated, the introspection is disabled.
REGISTER_ROS2_CONTROL_INTROSPECTION("my_active_variable", &my_active_variable_, true);
...
}
Expand Down
20 changes: 1 addition & 19 deletions hardware_interface/include/hardware_interface/introspection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,10 @@ namespace hardware_interface
constexpr char DEFAULT_REGISTRY_KEY[] = "ros2_control";
constexpr char DEFAULT_INTROSPECTION_TOPIC[] = "~/introspection_data";

#define REGISTER_ROS2_CONTROL_INTROSPECTION_2_ARGS(ID, ENTITY) \
#define REGISTER_ROS2_CONTROL_INTROSPECTION(ID, ENTITY) \
REGISTER_ENTITY( \
hardware_interface::DEFAULT_REGISTRY_KEY, get_name() + "." + ID, ENTITY, \
&stats_registrations_, false)

#define REGISTER_ROS2_CONTROL_INTROSPECTION_3_ARGS(ID, ENTITY, ENABLE) \
REGISTER_ENTITY( \
hardware_interface::DEFAULT_REGISTRY_KEY, get_name() + "." + ID, ENTITY, \
&stats_registrations_, ENABLE)

#ifndef GET_4TH_ARG
#define GET_4TH_ARG(arg1, arg2, arg3, arg4, ...) arg4
#endif

#define REGISTER_ROS2_CONTROL_INTROSPECTION_MACRO_CHOOSER(...) \
GET_4TH_ARG( \
__VA_ARGS__, REGISTER_ROS2_CONTROL_INTROSPECTION_3_ARGS, \
REGISTER_ROS2_CONTROL_INTROSPECTION_2_ARGS)

#define REGISTER_ROS2_CONTROL_INTROSPECTION(...) \
REGISTER_ROS2_CONTROL_INTROSPECTION_MACRO_CHOOSER(__VA_ARGS__)(__VA_ARGS__)

} // namespace hardware_interface

#endif // HARDWARE_INTERFACE__INTROSPECTION_HPP_

0 comments on commit 140d4ca

Please sign in to comment.