ROS2 Control Framework unit3 ERROR

I am getting the following error message at the end of unit3. Copy pasted all the code from the notebook and still not running properly. Can I get some help?

Hello @roman.smid
I can see that under section 3.14 it sais

Create a new file called dynamixel_hardware.xml at the root directory of the package where the CMakeLists.txt file is also defined.

but it should say:

Create a new file called my_robot_hardware_interface.xml at the root directory of the package where the CMakeLists.txt file is also defined.

Please rename your file
dynamixel_hardware.xml

to

my_robot_hardware_interface.xml

and try again.

Thanks for such a quick reply @rzegers, however I was using my_robot_hardware_interface.xml in the root dir and CMake.txt already and am still getting the error.

Hello @roman.smid, thanks for reporting back.

Could please verify if the on_configure() method is defined inside the my_robot_hardware_interface.cpp file ?

This is what that method should look like:

CallbackReturn RRBotSystemPositionOnlyHardware::on_configure(
    const rclcpp_lifecycle::State &previous_state) {
  // START: This part here is for exemplary purposes - Please do not copy to
  // your production code

  // prevent unused variable warning
  auto prev_state = previous_state;
  RCLCPP_INFO(rclcpp::get_logger("RRBotSystemPositionOnlyHardware"),
              "Configuring ...please wait...");

  for (int i = 0; i < hw_start_sec_; i++) {
    rclcpp::sleep_for(std::chrono::seconds(1));
    RCLCPP_INFO(rclcpp::get_logger("RRBotSystemPositionOnlyHardware"),
                "%.1f seconds left...", hw_start_sec_ - i);
  }
  // END: This part here is for exemplary purposes - Please do not copy to your
  // production code

  // reset values always when configuring hardware
  for (uint i = 0; i < hw_states_.size(); i++) {
    hw_states_[i] = 0;
    hw_commands_[i] = 0;
  }

  RCLCPP_INFO(rclcpp::get_logger("RRBotSystemPositionOnlyHardware"),
              "Successfully configured!");

  return CallbackReturn::SUCCESS;
}

I have also updated the course to include instructions about adding the method under this section:

3.7 Add the on_configure() method

I would love to hear back . Thanks!

Roberto

1 Like

Amazing work @rzegers , added the on_configure() method to the .cpp file and it works.

Thanks so much for helping out so quickly.

2 Likes