mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-11 15:09:48 +08:00
[launch]Add uvc_backend params
This commit is contained in:
@@ -83,6 +83,7 @@ class OBCameraNodeDriver : public rclcpp::Node {
|
|||||||
std::string device_unique_id_;
|
std::string device_unique_id_;
|
||||||
std::string usb_port_;
|
std::string usb_port_;
|
||||||
bool enumerate_net_device_ = false; // default false
|
bool enumerate_net_device_ = false; // default false
|
||||||
|
std::string uvc_backend_;
|
||||||
std::shared_ptr<Parameters> parameters_ = nullptr;
|
std::shared_ptr<Parameters> parameters_ = nullptr;
|
||||||
std::shared_ptr<std::thread> query_thread_ = nullptr;
|
std::shared_ptr<std::thread> query_thread_ = nullptr;
|
||||||
std::shared_ptr<std::thread> device_count_update_thread_ = nullptr;
|
std::shared_ptr<std::thread> device_count_update_thread_ = nullptr;
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ def generate_launch_description():
|
|||||||
DeclareLaunchArgument('serial_number', default_value=''),
|
DeclareLaunchArgument('serial_number', default_value=''),
|
||||||
DeclareLaunchArgument('usb_port', default_value=''),
|
DeclareLaunchArgument('usb_port', default_value=''),
|
||||||
DeclareLaunchArgument('device_num', default_value='1'),
|
DeclareLaunchArgument('device_num', default_value='1'),
|
||||||
|
DeclareLaunchArgument('uvc_backend', default_value='libuvc'),#libuvc or v4l2
|
||||||
DeclareLaunchArgument('point_cloud_qos', default_value='default'),
|
DeclareLaunchArgument('point_cloud_qos', default_value='default'),
|
||||||
DeclareLaunchArgument('enable_point_cloud', default_value='true'),
|
DeclareLaunchArgument('enable_point_cloud', default_value='true'),
|
||||||
DeclareLaunchArgument('enable_colored_point_cloud', default_value='false'),
|
DeclareLaunchArgument('enable_colored_point_cloud', default_value='false'),
|
||||||
|
|||||||
@@ -1160,7 +1160,6 @@ void OBCameraNode::getParameters() {
|
|||||||
depth_aligned_frame_id_[stream_index] =
|
depth_aligned_frame_id_[stream_index] =
|
||||||
camera_name_ + "_" + stream_name_[COLOR] + "_optical_frame";
|
camera_name_ + "_" + stream_name_[COLOR] + "_optical_frame";
|
||||||
}
|
}
|
||||||
|
|
||||||
setAndGetNodeParameter(publish_tf_, "publish_tf", true);
|
setAndGetNodeParameter(publish_tf_, "publish_tf", true);
|
||||||
setAndGetNodeParameter(tf_publish_rate_, "tf_publish_rate", 0.0);
|
setAndGetNodeParameter(tf_publish_rate_, "tf_publish_rate", 0.0);
|
||||||
setAndGetNodeParameter(depth_registration_, "depth_registration", false);
|
setAndGetNodeParameter(depth_registration_, "depth_registration", false);
|
||||||
|
|||||||
@@ -162,6 +162,17 @@ void OBCameraNodeDriver::init() {
|
|||||||
net_device_ip_ = declare_parameter<std::string>("net_device_ip", "");
|
net_device_ip_ = declare_parameter<std::string>("net_device_ip", "");
|
||||||
net_device_port_ = static_cast<int>(declare_parameter<int>("net_device_port", 0));
|
net_device_port_ = static_cast<int>(declare_parameter<int>("net_device_port", 0));
|
||||||
enumerate_net_device_ = declare_parameter<bool>("enumerate_net_device", false);
|
enumerate_net_device_ = declare_parameter<bool>("enumerate_net_device", false);
|
||||||
|
uvc_backend_ = declare_parameter<std::string>("uvc_backend", "libuvc");
|
||||||
|
if(uvc_backend_=="libuvc"){
|
||||||
|
ctx_->setUvcBackendType(OB_UVC_BACKEND_TYPE_LIBUVC);
|
||||||
|
RCLCPP_INFO_STREAM(logger_, "setUvcBackendType:"<<uvc_backend_);
|
||||||
|
}else if(uvc_backend_=="v4l2"){
|
||||||
|
ctx_->setUvcBackendType(OB_UVC_BACKEND_TYPE_V4L2);
|
||||||
|
RCLCPP_INFO_STREAM(logger_, "setUvcBackendType:"<<uvc_backend_);
|
||||||
|
}else{
|
||||||
|
ctx_->setUvcBackendType(OB_UVC_BACKEND_TYPE_LIBUVC);
|
||||||
|
RCLCPP_INFO_STREAM(logger_, "setUvcBackendType:"<<uvc_backend_);
|
||||||
|
}
|
||||||
ctx_->enableNetDeviceEnumeration(enumerate_net_device_);
|
ctx_->enableNetDeviceEnumeration(enumerate_net_device_);
|
||||||
ctx_->setDeviceChangedCallback([this](const std::shared_ptr<ob::DeviceList> &removed_list,
|
ctx_->setDeviceChangedCallback([this](const std::shared_ptr<ob::DeviceList> &removed_list,
|
||||||
const std::shared_ptr<ob::DeviceList> &added_list) {
|
const std::shared_ptr<ob::DeviceList> &added_list) {
|
||||||
|
|||||||
Reference in New Issue
Block a user