mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-04 03:57:46 +08:00
chore: rename gemini2R to gemini_generic
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2023 Orbbec 3D Technology, Inc
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*******************************************************************************/
|
||||
* Copyright (c) 2023 Orbbec 3D Technology, Inc
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -117,5 +117,15 @@ const int GEMINI2RL_PID = 0x06d1;
|
||||
const int GEMINI2R_PID2 = 0x0800;
|
||||
const int GEMINI2RL_PID2 = 0x0804;
|
||||
const std::string ORB_DEFAULT_LOCK_NAME = "orbbec_device_lock";
|
||||
const int32_t GEMINI_335_PID = 0x0800; // Gemini 335 / 335e
|
||||
const int32_t GEMINI_330_PID = 0x0801; // Gemini 330
|
||||
const int32_t GEMINI_336_PID = 0x0803; // Gemini 336 / 336e
|
||||
const int32_t GEMINI_335L_PID = 0x0804; // Gemini 335L
|
||||
const int32_t GEMINI_330L_PID = 0x0805; // Gemini 336L
|
||||
const int32_t GEMINI_336L_PID = 0x0807; // Gemini 335Lg
|
||||
const int32_t GEMINI_335LG_PID = 0x080B; // Gemini 336Lg
|
||||
const int32_t GEMINI_336LG_PID = 0x080D;
|
||||
const int32_t GEMINI_335LE_PID = 0x080E; // Gemini 335Le
|
||||
const int32_t GEMINI_336LE_PID = 0x0810; // Gemini 335Le
|
||||
|
||||
} // namespace orbbec_camera
|
||||
|
||||
@@ -325,6 +325,8 @@ class OBCameraNode {
|
||||
|
||||
static bool isGemini335PID(uint32_t pid);
|
||||
|
||||
std::string selectPreset(uint32_t pid);
|
||||
|
||||
private:
|
||||
rclcpp::Node* node_ = nullptr;
|
||||
std::shared_ptr<ob::Device> device_ = nullptr;
|
||||
|
||||
+1
@@ -106,6 +106,7 @@ def generate_launch_description():
|
||||
DeclareLaunchArgument('diagnostic_period', default_value='1.0'),
|
||||
DeclareLaunchArgument('enable_laser', default_value='true'),
|
||||
DeclareLaunchArgument('depth_precision', default_value='1mm'),
|
||||
DeclareLaunchArgument('device_preset', default_value=''),
|
||||
# Laser on/off alternate mode, 0: off, 1: on-off alternate, 2: off-on alternate.
|
||||
DeclareLaunchArgument('laser_on_off_mode', default_value='0'),
|
||||
DeclareLaunchArgument('retry_on_usb3_detection_failure', default_value='false'),
|
||||
@@ -12,7 +12,7 @@ def generate_launch_description():
|
||||
launch_file_dir = os.path.join(package_dir, 'launch')
|
||||
launch1_include = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(
|
||||
os.path.join(launch_file_dir, 'gemini2R.launch.py')
|
||||
os.path.join(launch_file_dir, 'gemini_generic.launch.py')
|
||||
),
|
||||
launch_arguments={
|
||||
'camera_name': 'camera_01',
|
||||
@@ -24,7 +24,7 @@ def generate_launch_description():
|
||||
|
||||
launch2_include = IncludeLaunchDescription(
|
||||
PythonLaunchDescriptionSource(
|
||||
os.path.join(launch_file_dir, 'gemini2R.launch.py')
|
||||
os.path.join(launch_file_dir, 'gemini_generic.launch.py')
|
||||
),
|
||||
launch_arguments={
|
||||
'camera_name': 'camera_02',
|
||||
|
||||
@@ -153,6 +153,7 @@ void OBCameraNode::setupDevices() {
|
||||
device_->setIntProperty(OB_PROP_LASER_ON_OFF_MODE_INT, laser_on_off_mode_);
|
||||
}
|
||||
if (!device_preset_.empty()) {
|
||||
RCLCPP_INFO_STREAM(logger_, "Load device preset: " << device_preset_);
|
||||
device_->loadPreset(device_preset_.c_str());
|
||||
}
|
||||
auto depth_sensor = device_->getSensor(OB_SENSOR_DEPTH);
|
||||
@@ -788,6 +789,12 @@ void OBCameraNode::getParameters() {
|
||||
align_target_stream_ = obStreamTypeFromString(align_target_stream_str_);
|
||||
setAndGetNodeParameter<bool>(retry_on_usb3_detection_failure_, "retry_on_usb3_detection_failure",
|
||||
false);
|
||||
auto device_info = device_->getDeviceInfo();
|
||||
CHECK_NOTNULL(device_info.get());
|
||||
auto pid = device_info->pid();
|
||||
if (isGemini335PID(pid)) {
|
||||
device_preset_ = selectPreset(pid);
|
||||
}
|
||||
}
|
||||
|
||||
void OBCameraNode::setupTopics() {
|
||||
@@ -2040,22 +2047,22 @@ bool OBCameraNode::setupFormatConvertType(OBFormat format) {
|
||||
}
|
||||
|
||||
bool OBCameraNode::isGemini335PID(uint32_t pid) {
|
||||
const uint16_t GEMINI_335_PID = 0x0800; // Gemini 335 / 335e
|
||||
const uint16_t GEMINI_330_PID = 0x0801; // Gemini 330
|
||||
const uint16_t GEMINI_336_PID = 0x0803; // Gemini 336 / 336e
|
||||
const uint16_t GEMINI_335L_PID = 0x0804; // Gemini 335L
|
||||
const uint16_t GEMINI_330L_PID = 0x0805; // Gemini 336L
|
||||
const uint16_t GEMINI_336L_PID = 0x0807; // Gemini 335Lg
|
||||
const uint16_t GEMINI_335LG_PID = 0x080B; // Gemini 336Lg
|
||||
const uint16_t GEMINI_336LG_PID = 0x080D;
|
||||
const uint16_t GEMINI_335LE_PID = 0x080E; // Gemini 335Le
|
||||
const uint16_t GEMINI_336LE_PID = 0x0810; // Gemini 335Le
|
||||
return pid == GEMINI_335_PID || pid == GEMINI_330_PID || pid == GEMINI_336_PID ||
|
||||
pid == GEMINI_335L_PID || pid == GEMINI_330L_PID || pid == GEMINI_336L_PID ||
|
||||
pid == GEMINI_335LG_PID || pid == GEMINI_336LG_PID || pid == GEMINI_335LE_PID ||
|
||||
pid == GEMINI_336LE_PID;
|
||||
}
|
||||
|
||||
std::string OBCameraNode::selectPreset(uint32_t pid) {
|
||||
switch (pid) {
|
||||
case GEMINI_336_PID:
|
||||
case GEMINI_336L_PID:
|
||||
return "AMR with IR-Pass";
|
||||
default:
|
||||
return "Default";
|
||||
}
|
||||
}
|
||||
|
||||
orbbec_camera_msgs::msg::IMUInfo OBCameraNode::createIMUInfo(
|
||||
const stream_index_pair &stream_index) {
|
||||
orbbec_camera_msgs::msg::IMUInfo imu_info;
|
||||
|
||||
Reference in New Issue
Block a user