Skip to content

Fixing deprecated code for Jazzy + Adding support of Kilted#43

Merged
samuelsadok merged 5 commits into
odriverobotics:mainfrom
2lian:main
Nov 25, 2025
Merged

Fixing deprecated code for Jazzy + Adding support of Kilted#43
samuelsadok merged 5 commits into
odriverobotics:mainfrom
2lian:main

Conversation

@2lian

@2lian 2lian commented Nov 20, 2025

Copy link
Copy Markdown
Contributor

Hello,

I was bothered by the following deprecation warning on ROS 2 Jazzy and also the fact that I couldn't build on ROS 2 Kilted:

--- stderr: odrive_can
/home/elian/moonbot_tools/workspace/src/odrive_node/src/odrive_can_node.cpp: In constructor 'ODriveCanNode::ODriveCanNode(const std::string&)':
/home/elian/moonbot_tools/workspace/src/odrive_node/src/odrive_can_node.cpp:50:59: warning: 'typename rclcpp::Service<ServiceT>::SharedPtr rclcpp::Node::create_service(const std::string&, CallbackT&&, const rmw_qos_profile_t&, rclcpp::CallbackGroup::SharedPtr) [with ServiceT = odrive_can::srv::AxisState; CallbackT = std::_Bind<void (ODriveCanNode::*(ODriveCanNode*, std::_Placeholder<1>, std::_Placeholder<2>))(std::shared_ptr<odrive_can::srv::AxisState_Request_<std::allocator<void> > >, std::shared_ptr<odrive_can::srv::AxisState_Response_<std::allocator<void> > >)>; typename rclcpp::Service<ServiceT>::SharedPtr = std::shared_ptr<rclcpp::Service<odrive_can::srv::AxisState> >; std::string = std::__cxx11::basic_string<char>; rmw_qos_profile_t = rmw_qos_profile_s; rclcpp::CallbackGroup::SharedPtr = std::shared_ptr<rclcpp::CallbackGroup>]' is deprecated: use rclcpp::QoS instead of rmw_qos_profile_t [-Wdeprecated-declarations]
   50 |         service_ = rclcpp::Node::create_service<AxisState>("request_axis_state", std::bind(&ODriveCanNode::service_callback, this, _1, _2), srv_qos.get_rmw_qos_profile());
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/elian/moonbot_tools/.pixi/envs/default/include/rclcpp/rclcpp/node.hpp:1663,
                 from /home/elian/moonbot_tools/.pixi/envs/default/include/rclcpp/rclcpp/executors/single_threaded_executor.hpp:28,
                 from /home/elian/moonbot_tools/.pixi/envs/default/include/rclcpp/rclcpp/executors.hpp:22,
                 from /home/elian/moonbot_tools/.pixi/envs/default/include/rclcpp/rclcpp/rclcpp.hpp:172,
                 from /home/elian/moonbot_tools/workspace/src/odrive_node/include/odrive_can_node.hpp:4,
                 from /home/elian/moonbot_tools/workspace/src/odrive_node/src/odrive_can_node.cpp:1:

I quickly fixed this by using a if macro against the version of RCLCPP and using the new ROS syntax for the new versions.

This change does build and execute under Humble, Jazzy, Kilted and looks alright to me. I couldn't test with hardware.

@CLAassistant

CLAassistant commented Nov 20, 2025

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@samuelsadok samuelsadok left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. The high level motivation seems good. Some comments on the implementation:

  1. I prefer to have only the smallest possible difference is inside the #if. So something like
         rclcpp::QoS srv_qos(rclcpp::KeepAll{});
     #if
         auto srv_qos_profile = srv_qos;
     #else
         auto srv_qos_profile = srv_qos.get_rmw_qos_profile();
     #endif
    In this case you can actually re-use the same srv_qos_profile for both instances to save on lines of code.
  2. Formatting: #if should not be indented
  3. If you have a link that documents the deprecation, you can put it in a comment.

@2lian

2lian commented Nov 21, 2025

Copy link
Copy Markdown
Contributor Author

@samuelsadok Thanks for the fast response, I implemented your suggestions.

Comment thread odrive_node/src/odrive_can_node.cpp Outdated
Comment thread odrive_node/src/odrive_can_node.cpp Outdated
@2lian

2lian commented Nov 21, 2025

Copy link
Copy Markdown
Contributor Author

Quickly fixed in the train on my phone. Will test build+run at home tomorrow

@2lian

2lian commented Nov 22, 2025

Copy link
Copy Markdown
Contributor Author

Tested build+execution. Looks fine but I cannot test with hardware and cannot test calling the services.

@2lian 2lian requested a review from samuelsadok November 22, 2025 06:19

@samuelsadok samuelsadok left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now! A hardware test is no needed here because it's a minimal change and high up in the stack so if the compile passes that's enough.

@samuelsadok samuelsadok merged commit a96ce89 into odriverobotics:main Nov 25, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants