mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-07 05:27:45 +08:00
Merge remote-tracking branch 'origin/feat/bag-record-playback' into merge/sdk_2.9.0
This commit is contained in:
@@ -166,7 +166,8 @@ typedef struct {
|
||||
class OBCameraNode {
|
||||
public:
|
||||
OBCameraNode(rclcpp::Node* node, std::shared_ptr<ob::Device> device,
|
||||
std::shared_ptr<Parameters> parameters, bool use_intra_process = false);
|
||||
std::shared_ptr<Parameters> parameters, bool use_intra_process = false,
|
||||
bool is_playback_device = false);
|
||||
|
||||
template <class T>
|
||||
void setAndGetNodeParameter(
|
||||
@@ -193,6 +194,8 @@ class OBCameraNode {
|
||||
|
||||
void startIMU();
|
||||
|
||||
void restartPlaybackStreams();
|
||||
|
||||
int openSocSyncPwmTrigger(uint16_t fps);
|
||||
int closeSocSyncPwmTrigger();
|
||||
void startGmslTrigger();
|
||||
@@ -949,6 +952,11 @@ class OBCameraNode {
|
||||
bool hw_d2c_color_undistortion_configured_ = false;
|
||||
bool has_first_color_frame_ = false;
|
||||
bool use_intra_process_ = false;
|
||||
// True when device_ is an ob::PlaybackDevice. Real-device-only hardware
|
||||
// tuning (heartbeat, USB3 retry, laser, sync config, etc.) is skipped in
|
||||
// setupDevices() for playback devices since those SDK components aren't
|
||||
// registered for a recorded .bag file.
|
||||
bool is_playback_device_ = false;
|
||||
std::string cloud_frame_id_;
|
||||
std::mutex depth_filter_mutex_;
|
||||
std::vector<std::shared_ptr<ob::Filter>> depth_filter_list_;
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#include <std_srvs/srv/empty.hpp>
|
||||
#include <backward_ros/backward.hpp>
|
||||
#include "libobsensor/hpp/Device.hpp"
|
||||
#include "libobsensor/hpp/RecordPlayback.hpp"
|
||||
#include "orbbec_camera_msgs/srv/set_bag_recording.hpp"
|
||||
|
||||
namespace orbbec_camera {
|
||||
|
||||
@@ -57,6 +59,10 @@ class OBCameraNodeDriver : public rclcpp::Node {
|
||||
|
||||
void initializeDevice(const std::shared_ptr<ob::Device>& device);
|
||||
|
||||
void initializeBagPlayback();
|
||||
|
||||
void exportBagPresetJson(const std::string& bag_path);
|
||||
|
||||
void startDevice(const std::shared_ptr<ob::DeviceList>& list);
|
||||
|
||||
void connectNetDevice(const std::string& net_device_ip, int net_device_port);
|
||||
@@ -77,6 +83,10 @@ class OBCameraNodeDriver : public rclcpp::Node {
|
||||
|
||||
void rebootDeviceCallback(const std::shared_ptr<std_srvs::srv::Empty::Request> request,
|
||||
std::shared_ptr<std_srvs::srv::Empty::Response> response);
|
||||
|
||||
void setBagRecordingCallback(
|
||||
const std::shared_ptr<orbbec_camera_msgs::srv::SetBagRecording::Request> request,
|
||||
std::shared_ptr<orbbec_camera_msgs::srv::SetBagRecording::Response> response);
|
||||
void presetUpdateCallback(bool firstCall, OBFwUpdateState state, const char* message,
|
||||
uint8_t percent);
|
||||
void updatePresetFirmware(std::string path);
|
||||
@@ -136,6 +146,8 @@ class OBCameraNodeDriver : public rclcpp::Node {
|
||||
std::string timestamp_clock_type_str_;
|
||||
std::string preset_firmware_path_;
|
||||
rclcpp::Service<std_srvs::srv::Empty>::SharedPtr reboot_device_srv_ = nullptr;
|
||||
rclcpp::Service<orbbec_camera_msgs::srv::SetBagRecording>::SharedPtr set_bag_recording_srv_ =
|
||||
nullptr;
|
||||
std::chrono::time_point<std::chrono::system_clock> start_time_;
|
||||
std::string extension_path_;
|
||||
static backward::SignalHandling sh; // for stack trace
|
||||
@@ -155,5 +167,13 @@ class OBCameraNodeDriver : public rclcpp::Node {
|
||||
std::string force_ip_gateway_; // e.g. "192.168.1.1"
|
||||
std::atomic<bool> force_ip_success_{false};
|
||||
std::string device_type_;
|
||||
// bag recording
|
||||
std::string bag_record_filename_;
|
||||
bool bag_record_compression_ = true;
|
||||
std::shared_ptr<ob::RecordDevice> record_device_ = nullptr;
|
||||
// bag playback
|
||||
std::string bag_filename_;
|
||||
bool bag_loop_ = false;
|
||||
std::shared_ptr<ob::PlaybackDevice> playback_device_ = nullptr;
|
||||
};
|
||||
} // namespace orbbec_camera
|
||||
|
||||
Reference in New Issue
Block a user