Closed tonynajjar closed 1 year ago
Humble is not currently supported, but is on our backlog.
I got it to compile by adding defaults to the declare_parameter()
functions. If you don't see much more effort to be put into it to support humble, I can create a PR (I would need a new humble branch)
Thank you for the offer! I created a humble branch from foxy if you want to PR what you've done so far; that would definitely be helpful! https://github.com/microsoft/Azure_Kinect_ROS_Driver/tree/humble
Hi! Thanks for creating the branch. I am running ROS2 Humble on Ubuntu 22.04. When I try to build the package, I get the following error:
Starting >>> azure_kinect_ros_driver --- stderr: azure_kinect_ros_driver
/home/francesco/humble_ws/src/Azure_Kinect_ROS_Driver/src/k4a_ros_device.cpp: In member function ‘k4a_result_t K4AROSDevice::getBodyMarker(const k4abt_body_t&, std::shared_ptr<visualizationmsgs::msg::Marker<std::allocator> >, int, rclcpp::Time)’: /home/francesco/humble_ws/src/Azure_Kinect_ROS_Driver/src/k4a_ros_device.cpp:771:47: error: no matching function for call to ‘rclcpp::Duration::Duration(double)’ 771 | marker_msg->lifetime = rclcpp::Duration(0.25); | ^ In file included from /opt/ros/humble/include/rclcpp/rclcpp/qos.hpp:20, from /opt/ros/humble/include/rclcpp/rclcpp/node_interfaces/node_graph_interface.hpp:32, from /opt/ros/humble/include/rclcpp/rclcpp/client.hpp:42, from /opt/ros/humble/include/rclcpp/rclcpp/callback_group.hpp:24, from /opt/ros/humble/include/rclcpp/rclcpp/node.hpp:40, from /opt/ros/humble/include/image_transport/image_transport/image_transport.hpp:37, from /home/francesco/humble_ws/src/Azure_Kinect_ROS_Driver/include/azure_kinect_ros_driver/k4a_ros_device.h:15, from /home/francesco/humble_ws/src/Azure_Kinect_ROS_Driver/src/k4a_ros_device.cpp:6: /opt/ros/humble/include/rclcpp/rclcpp/duration.hpp:48:3: note: candidate: ‘template<class Rep, class Period> rclcpp::Duration::Duration(const std::chrono::duration<_Rep1, _Period1>&)’ 48 | Duration(const std::chrono::duration<Rep, Period> & duration) // NOLINT(runtime/explicit) | ^ ~~~ /opt/ros/humble/include/rclcpp/rclcpp/duration.hpp:48:3: note: template argument deduction/substitution failed: /home/francesco/humble_ws/src/Azure_Kinect_ROS_Driver/src/k4a_ros_device.cpp:771:47: note: mismatched types ‘const std::chrono::duration<_Rep1, _Period1>’ and ‘double’ 771 | marker_msg->lifetime = rclcpp::Duration(0.25); | ^ In file included from /opt/ros/humble/include/rclcpp/rclcpp/qos.hpp:20, from /opt/ros/humble/include/rclcpp/rclcpp/node_interfaces/node_graph_interface.hpp:32, from /opt/ros/humble/include/rclcpp/rclcpp/client.hpp:42, from /opt/ros/humble/include/rclcpp/rclcpp/callback_group.hpp:24, from /opt/ros/humble/include/rclcpp/rclcpp/node.hpp:40, from /opt/ros/humble/include/image_transport/image_transport/image_transport.hpp:37, from /home/francesco/humble_ws/src/Azure_Kinect_ROS_Driver/include/azure_kinect_ros_driver/k4a_ros_device.h:15, from /home/francesco/humble_ws/src/Azure_Kinect_ROS_Driver/src/k4a_ros_device.cpp:6: /opt/ros/humble/include/rclcpp/rclcpp/duration.hpp:151:3: note: candidate: ‘rclcpp::Duration::Duration()’ 151 | Duration() = default; | ^~~~ /opt/ros/humble/include/rclcpp/rclcpp/duration.hpp:151:3: note: candidate expects 0 arguments, 1 provided /opt/ros/humble/include/rclcpp/rclcpp/duration.hpp:61:3: note: candidate: ‘rclcpp::Duration::Duration(const rclcpp::Duration&)’ 61 | Duration(const Duration & rhs); | ^~~~ /opt/ros/humble/include/rclcpp/rclcpp/duration.hpp:61:29: note: no known conversion for argument 1 from ‘double’ to ‘const rclcpp::Duration&’ 61 | Duration(const Duration & rhs); |~~~^/opt/ros/humble/include/rclcpp/rclcpp/duration.hpp:59:12: note: candidate: ‘rclcpp::Duration::Duration(const rcl_duration_t&)’ 59 | explicit Duration(const rcl_duration_t & duration); | ^~~~ /opt/ros/humble/include/rclcpp/rclcpp/duration.hpp:59:44: note: no known conversion for argument 1 from ‘double’ to ‘const rcl_duration_t&’ {aka ‘const rcl_duration_s&’} 59 | explicit Duration(const rcl_duration_t & duration); |~~~~~^~/opt/ros/humble/include/rclcpp/rclcpp/duration.hpp:53:3: note: candidate: ‘rclcpp::Duration::Duration(const Duration&)’ 53 | Duration(const builtin_interfaces::msg::Duration & duration_msg); // NOLINT(runtime/explicit) | ^~~~ /opt/ros/humble/include/rclcpp/rclcpp/duration.hpp:53:54: note: no known conversion for argument 1 from ‘double’ to ‘const Duration&’ {aka ‘const builtininterfaces::msg::Duration<std::allocator>&’} 53 | Duration(const builtin_interfaces::msg::Duration & duration_msg); // NOLINT(runtime/explicit) | ~~~~~~~~^~~~~~ /opt/ros/humble/include/rclcpp/rclcpp/duration.hpp:42:12: note: candidate: ‘rclcpp::Duration::Duration(std::chrono::nanoseconds)’ 42 | explicit Duration(std::chrono::nanoseconds nanoseconds); | ^~~~ /opt/ros/humble/include/rclcpp/rclcpp/duration.hpp:42:46: note: no known conversion for argument 1 from ‘double’ to ‘std::chrono::nanoseconds’ {aka ‘std::chrono::duration<long int, std::ratio<1, 1000000000> >’} 42 | explicit Duration(std::chrono::nanoseconds nanoseconds); |~~~~~^~~/opt/ros/humble/include/rclcpp/rclcpp/duration.hpp:39:3: note: candidate: ‘rclcpp::Duration::Duration(int32_t, uint32_t)’ 39 | Duration(int32_t seconds, uint32_t nanoseconds); | ^~~~ /opt/ros/humble/include/rclcpp/rclcpp/duration.hpp:39:3: note: candidate expects 2 arguments, 1 provided gmake[2]: [CMakeFiles/azure_kinect_ros_driver_node.dir/build.make:90: CMakeFiles/azure_kinect_ros_driver_node.dir/src/k4a_ros_device.cpp.o] Error 1 gmake[1]: [CMakeFiles/Makefile2:137: CMakeFiles/azure_kinect_ros_driver_node.dir/all] Error 2 gmake: *** [Makefile:146: all] Error 2 Failed <<< azure_kinect_ros_driver [4.06s, exited with code 2]
In case it matters, I need to use libk4a1.4 and libk4abt1.1. Any idea of why this could be happening? I am not sure that is related to the fact I am using Humble though.
Ok, I sorted it out. Apparently, you need to specify the duration in seconds and nanoseconds with two separate variables, while constructing the rclcpp::Duration object. Replacing this line with the highlighted one will do.
marker_msg->lifetime = rclcpp::Duration(int32_t(0),uint32_t(25000000));
Does the foxy-devel branch support Humble? From what I tried, no. Here is (part of) the traceback I get when building: