diff --git a/realsense2_camera/include/constants.h b/realsense2_camera/include/constants.h index d6a561e638..e95384f715 100644 --- a/realsense2_camera/include/constants.h +++ b/realsense2_camera/include/constants.h @@ -34,7 +34,8 @@ namespace realsense2_camera const uint16_t RS435i_RGB_PID = 0x0B3A; // AWGC_MM const uint16_t RS405_PID = 0x0b0c; // DS5U const uint16_t RS_T265_PID = 0x0b37; // - const uint16_t RS_L515_PID = 0x0B3D; // + const uint16_t RS_L515_PID_PRE_PRQ = 0x0B3D; // + const uint16_t RS_L515_PID = 0x0B64; // const bool ALIGN_DEPTH = false; diff --git a/realsense2_camera/include/realsense_node_factory.h b/realsense2_camera/include/realsense_node_factory.h index 6b4110f923..9d757e459b 100644 --- a/realsense2_camera/include/realsense_node_factory.h +++ b/realsense2_camera/include/realsense_node_factory.h @@ -25,6 +25,7 @@ namespace realsense2_camera { const stream_index_pair COLOR{RS2_STREAM_COLOR, 0}; const stream_index_pair DEPTH{RS2_STREAM_DEPTH, 0}; + const stream_index_pair INFRA0{RS2_STREAM_INFRARED, 0}; const stream_index_pair INFRA1{RS2_STREAM_INFRARED, 1}; const stream_index_pair INFRA2{RS2_STREAM_INFRARED, 2}; const stream_index_pair FISHEYE{RS2_STREAM_FISHEYE, 0}; @@ -35,7 +36,7 @@ namespace realsense2_camera const stream_index_pair POSE{RS2_STREAM_POSE, 0}; - const std::vector IMAGE_STREAMS = {DEPTH, INFRA1, INFRA2, + const std::vector IMAGE_STREAMS = {DEPTH, INFRA0, INFRA1, INFRA2, COLOR, FISHEYE, FISHEYE1, FISHEYE2}; diff --git a/realsense2_camera/src/base_realsense_node.cpp b/realsense2_camera/src/base_realsense_node.cpp index 39c1e7bfc2..f14b95b7a0 100644 --- a/realsense2_camera/src/base_realsense_node.cpp +++ b/realsense2_camera/src/base_realsense_node.cpp @@ -242,14 +242,18 @@ bool is_checkbox(rs2::options sensor, rs2_option option) bool is_enum_option(rs2::options sensor, rs2_option option) { + static const int MAX_ENUM_OPTION_VALUES(100); + static const float EPSILON(0.05); + rs2::option_range op_range = sensor.get_option_range(option); - if (op_range.step < 0.001f) return false; + if (abs((op_range.step - 1)) > EPSILON || (op_range.max > MAX_ENUM_OPTION_VALUES)) return false; for (auto i = op_range.min; i <= op_range.max; i += op_range.step) { if (sensor.get_option_value_description(option, i) == nullptr) - return false; + continue; + return true; } - return true; + return false; } bool is_int_option(rs2::options sensor, rs2_option option) @@ -269,6 +273,8 @@ std::map get_enum_method(rs2::options sensor, rs2_option optio const auto op_range_step = int(op_range.step); for (auto val = op_range_min; val <= op_range_max; val += op_range_step) { + if (sensor.get_option_value_description(option, val) == nullptr) + continue; dict[sensor.get_option_value_description(option, val)] = val; } } @@ -705,37 +711,34 @@ void BaseRealSenseNode::setupDevice() ROS_INFO_STREAM("Device Sensors: "); for(auto&& sensor : _dev_sensors) { + for (auto& profile : sensor.get_stream_profiles()) + { + auto video_profile = profile.as(); + stream_index_pair sip(video_profile.stream_type(), video_profile.stream_index()); + if (_sensors.find( sip ) != _sensors.end()) + continue; + _sensors[sip] = sensor; + } + std::string module_name = sensor.get_info(RS2_CAMERA_INFO_NAME); if (sensor.is()) { - _sensors[DEPTH] = sensor; - _sensors[INFRA1] = sensor; - _sensors[INFRA2] = sensor; _sensors_callback[module_name] = frame_callback_function; } else if (sensor.is()) { - _sensors[COLOR] = sensor; _sensors_callback[module_name] = frame_callback_function; } else if (sensor.is()) { - _sensors[FISHEYE] = sensor; _sensors_callback[module_name] = frame_callback_function; } else if (sensor.is()) { - _sensors[GYRO] = sensor; - _sensors[ACCEL] = sensor; _sensors_callback[module_name] = imu_callback_function; } else if (sensor.is()) { - _sensors[GYRO] = sensor; - _sensors[ACCEL] = sensor; - _sensors[POSE] = sensor; - _sensors[FISHEYE1] = sensor; - _sensors[FISHEYE2] = sensor; _sensors_callback[module_name] = multiple_message_callback_function; } else @@ -1813,7 +1816,7 @@ void BaseRealSenseNode::calcAndPublishStaticTransform(const stream_index_pair& s { if (!strcmp(e.what(), "Requested extrinsics are not available!")) { - ROS_WARN_STREAM(e.what() << " : using unity as default."); + ROS_WARN_STREAM("(" << rs2_stream_to_string(stream.first) << ", " << stream.second << ") -> (" << rs2_stream_to_string(base_profile.stream_type()) << ", " << base_profile.stream_index() << "): " << e.what() << " : using unity as default."); ex = rs2_extrinsics({{1, 0, 0, 0, 1, 0, 0, 0, 1}, {0,0,0}}); } else