You're reading the documentation for a development version. For the latest released version, please have a look at Iron.

Foxy to Galactic

hardware_interface

Between Foxy and Galactic we made substantial changes to the interface of hardware components to enable management of their lifecycle. The following list shows a set of quick changes to port existing hardware components to Galactic:

  1. Rename configure to on_init and change return type to CallbackReturn

  2. If using BaseInterface as base class then you should remove it. Specifically, change:

hardware_interface::BaseInterface<hardware_interface::[Actuator|Sensor|System]Interface>

to

hardware_interface::[Actuator|Sensor|System]Interface
  1. Remove include of headers base_interface.hpp and hardware_interface_status_values.hpp

  2. Add include of header rclcpp_lifecycle/state.hpp although this may not be strictly necessary

  3. replace first three lines in on_init to

if (hardware_interface::[Actuator|Sensor|System]Interface::on_init(info) != CallbackReturn::SUCCESS)
{
  return CallbackReturn::ERROR;
}
  1. Change last return of on_init to return CallbackReturn::SUCCESS;

  2. Remove all lines with status_ = ... or status::...

  3. Rename start() to on_activate(const rclcpp_lifecycle::State & previous_state) and stop() to on_deactivate(const rclcpp_lifecycle::State & previous_state)

  4. Change return type of on_activate and on_deactivate to CallbackReturn

  5. Change last return of on_activate and on_deactivate to return CallbackReturn::SUCCESS;

  6. If you have any return_type::ERROR in on_init, on_activate, or in_deactivate change to CallbackReturn::ERROR

  7. If you get link errors with undefined refernences to symbols in rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface, then add rclcpp_lifecyle package dependency to CMakeLists.txt and package.xml