From f65f14fa1ee365561bb4ce9b23db5ca9298e180f Mon Sep 17 00:00:00 2001 From: David Conner Date: Sat, 30 Apr 2022 23:28:35 -0400 Subject: [PATCH] Add note on README, and make some parameter names consistent --- README.md | 10 ++++++++++ openni2_camera/src/openni2_driver.cpp | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index e9bb8fb..d931b7d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,16 @@ openni2_camera ============== +## The fork includes the OpenNI-Linux-x64-2.3 files that work with the original Orbbec Astra + + It would be better if I provided a link to where I downloaded the OpenNI-Linux-x64-2.3.zip + for that particular SDK version that I have included, but in the various testing and frantic debugging trying to bring the Astra to life + under ROS 2 that information has been lost :-( + + This works, where the Ubuntu 20.04 OpenNI version was not recognizing the camera. + +============== + ROS2 wrapper for openni 2.0 Note: openni2_camera supports xtion devices, but not Kinects. diff --git a/openni2_camera/src/openni2_driver.cpp b/openni2_camera/src/openni2_driver.cpp index 23ca0dc..3ec6f05 100644 --- a/openni2_camera/src/openni2_driver.cpp +++ b/openni2_camera/src/openni2_driver.cpp @@ -74,10 +74,10 @@ OpenNI2Driver::OpenNI2Driver(const rclcpp::NodeOptions & node_options) : enable_reconnect_ = declare_parameter("enable_reconnect", true); ir_frame_id_ = declare_parameter("ir_frame_id", "openni_ir_optical_frame"); - color_frame_id_ = declare_parameter("rgb_frame_id", "openni_rgb_optical_frame"); + color_frame_id_ = declare_parameter("color_frame_id", "openni_rgb_optical_frame"); depth_frame_id_ = declare_parameter("depth_frame_id", "openni_depth_optical_frame"); - color_info_url_ = declare_parameter("rgb_camera_info_url", ""); + color_info_url_ = declare_parameter("color_camera_info_url", ""); ir_info_url_ = declare_parameter("depth_camera_info_url", ""); genVideoModeTableMap(); @@ -99,10 +99,14 @@ OpenNI2Driver::OpenNI2Driver(const rclcpp::NodeOptions & node_options) : RCLCPP_ERROR(this->get_logger(), "Undefined color video mode"); } - color_topic_name_ = declare_parameter("color_image_topic", "rgb/image_raw"); + color_topic_name_ = declare_parameter("color_topic_name", "rgb/image_raw"); depth_topic_name_ = declare_parameter("depth_topic_name", "depth/image"); ir_topic_name_ = declare_parameter("ir_topic_name", "ir/image"); + RCLCPP_INFO(this->get_logger(), " Color topic <%s> with frame <%s>", color_topic_name_.c_str(), color_frame_id_.c_str()); + RCLCPP_INFO(this->get_logger(), " IR topic <%s> with frame <%s>", ir_topic_name_.c_str(), ir_frame_id_.c_str()); + RCLCPP_INFO(this->get_logger(), " Depth topic <%s> with frame <%s>", depth_topic_name_.c_str(), depth_frame_id_.c_str()); + ir_video_mode_.pixel_format_ = PIXEL_FORMAT_GRAY16; color_video_mode_.pixel_format_ = PIXEL_FORMAT_RGB888; depth_video_mode_.pixel_format_ = PIXEL_FORMAT_DEPTH_1_MM; @@ -876,23 +880,21 @@ void OpenNI2Driver::initDevice() try { std::string device_URI = resolveDeviceURI(device_id_); - RCLCPP_INFO(this->get_logger(), "OpenNI2Driver - deviceUIR=<%s> - try empty instead ....\n", device_URI.c_str()); - device_URI = ""; device_ = device_manager_->getDevice(device_URI, this); - RCLCPP_INFO(this->get_logger(), "OpenNI2Driver - got device with deviceUIR=<%s>.\n", device_URI.c_str()); + RCLCPP_INFO(this->get_logger(), "OpenNI2Driver - got device with deviceURI=<%s> from id=<%s>.\n", device_URI.c_str(), device_id_.c_str()); bus_id_ = extractBusID(device_->getUri() ); } catch (const OpenNI2Exception& exception) { if (!device_) { - RCLCPP_INFO(this->get_logger(), "No matching device found.... waiting for devices.\n Reason: %s", exception.what()); + RCLCPP_WARN(this->get_logger(), "No matching device found for id=<%s> .... waiting for devices.\n Reason: %s", device_id_.c_str(), exception.what()); boost::this_thread::sleep(boost::posix_time::seconds(3)); continue; } else { - RCLCPP_ERROR(this->get_logger(), "Could not retrieve device.\n Reason: %s", exception.what()); + RCLCPP_ERROR(this->get_logger(), "Could not retrieve device <%s>.\n Reason: %s", device_id_.c_str(), exception.what()); exit(-1); } }