mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-04 20:17:47 +08:00
refactor: move Action Command sender to standalone node
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2026 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
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <rclcpp/rclcpp.hpp>
|
||||
|
||||
#include "libobsensor/hpp/Context.hpp"
|
||||
#include "orbbec_camera_msgs/srv/send_action_command.hpp"
|
||||
|
||||
namespace orbbec_camera {
|
||||
|
||||
class GigEActionCommandNode : public rclcpp::Node {
|
||||
public:
|
||||
explicit GigEActionCommandNode(const rclcpp::NodeOptions& node_options = rclcpp::NodeOptions());
|
||||
|
||||
private:
|
||||
void sendActionCommandCallback(
|
||||
const std::shared_ptr<orbbec_camera_msgs::srv::SendActionCommand::Request> request,
|
||||
std::shared_ptr<orbbec_camera_msgs::srv::SendActionCommand::Response> response);
|
||||
|
||||
std::unique_ptr<ob::Context> context_;
|
||||
rclcpp::Service<orbbec_camera_msgs::srv::SendActionCommand>::SharedPtr
|
||||
send_action_command_service_;
|
||||
};
|
||||
|
||||
} // namespace orbbec_camera
|
||||
@@ -33,7 +33,6 @@
|
||||
#include "libobsensor/hpp/Device.hpp"
|
||||
#include "libobsensor/hpp/RecordPlayback.hpp"
|
||||
#include "orbbec_camera_msgs/srv/set_bag_recording.hpp"
|
||||
#include "orbbec_camera_msgs/srv/send_action_command.hpp"
|
||||
|
||||
namespace orbbec_camera {
|
||||
|
||||
@@ -88,10 +87,6 @@ class OBCameraNodeDriver : public rclcpp::Node {
|
||||
void setBagRecordingCallback(
|
||||
const std::shared_ptr<orbbec_camera_msgs::srv::SetBagRecording::Request> request,
|
||||
std::shared_ptr<orbbec_camera_msgs::srv::SetBagRecording::Response> response);
|
||||
void setupActionCommandService();
|
||||
void sendActionCommandCallback(
|
||||
const std::shared_ptr<orbbec_camera_msgs::srv::SendActionCommand::Request> request,
|
||||
std::shared_ptr<orbbec_camera_msgs::srv::SendActionCommand::Response> response);
|
||||
void presetUpdateCallback(bool firstCall, OBFwUpdateState state, const char* message,
|
||||
uint8_t percent);
|
||||
void updatePresetFirmware(std::string path);
|
||||
@@ -153,8 +148,6 @@ class OBCameraNodeDriver : public rclcpp::Node {
|
||||
rclcpp::Service<std_srvs::srv::Empty>::SharedPtr reboot_device_srv_ = nullptr;
|
||||
rclcpp::Service<orbbec_camera_msgs::srv::SetBagRecording>::SharedPtr set_bag_recording_srv_ =
|
||||
nullptr;
|
||||
rclcpp::Service<orbbec_camera_msgs::srv::SendActionCommand>::SharedPtr send_action_command_srv_ =
|
||||
nullptr;
|
||||
std::chrono::time_point<std::chrono::system_clock> start_time_;
|
||||
std::string extension_path_;
|
||||
static backward::SignalHandling sh; // for stack trace
|
||||
|
||||
Reference in New Issue
Block a user