6#ifndef YARP_RGBDSENSOR_NWC_ROS2
7#define YARP_RGBDSENSOR_NWC_ROS2
27#include <rclcpp/rclcpp.hpp>
28#include <sensor_msgs/msg/image.hpp>
29#include <sensor_msgs/msg/camera_info.hpp>
76 std::mutex m_rgb_camera_info_mutex;
77 std::mutex m_rgb_image_mutex;
78 std::mutex m_depth_camera_info_mutex;
79 std::mutex m_depth_image_mutex;
84 std::string m_depth_image_frame;
86 double m_max_depth_width;
87 double m_max_depth_height;
91 std::string m_rgb_image_frame;
93 double m_max_rgb_width;
94 double m_max_rgb_height;
96 bool m_depth_image_valid =
false;
97 bool m_depth_stamp_valid =
false;
98 bool m_rgb_image_valid =
false;
99 bool m_rgb_stamp_valid =
false;
103 std::string m_topic_rgb_camera_info;
104 std::string m_topic_depth_camera_info;
115 rclcpp::Node::SharedPtr m_node;
128 bool open(
yarp::os::Searchable& config) override;
129 bool close() override;
137 bool getRgbFOV(
double& horizontalFov,
double& verticalFov) override;
138 bool setRgbFOV(
double horizontalFov,
double verticalFov) override;
146 bool getDepthFOV(
double& horizontalFov,
double& verticalFov) override;
147 bool setDepthFOV(
double horizontalFov,
double verticalFov) override;
158 bool getRgbImage(
yarp::sig::FlexImage& rgb_image,
yarp::os::Stamp* rgb_image_stamp = NULL) override;
160 bool getImages(
yarp::sig::FlexImage& rgb_image,
depthImage& depth_image,
yarp::os::Stamp* rgb_image_stamp=
nullptr,
yarp::os::Stamp* depth_image_stamp=
nullptr) override;
162 void callback(sensor_msgs::msg::CameraInfo::SharedPtr msg,
std::
string topic);
163 void callback(sensor_msgs::msg::Image::SharedPtr msg,
std::
string topic);
contains the definition of a Matrix type
yarp::sig::FlexImage flexImage
This class is the parameters parser for class RgbdSensor_nwc_ros2.
This class implements an nwc for ros2 for an rgbd sensor.
bool getDepthMirroring(bool &mirror) override
Get the mirroring setting of the sensor.
bool getRgbSupportedConfigurations(yarp::sig::VectorOf< yarp::dev::CameraConfig > &configurations) override
Get the possible configurations of the camera.
int getDepthWidth() override
Return the height of each frame.
void color_info_callback(const sensor_msgs::msg::CameraInfo::SharedPtr msg)
std::string getLastErrorMsg(yarp::os::Stamp *timeStamp=NULL) override
Return an error message in case of error.
double getDepthAccuracy() override
Get the minimum detectable variation in distance [meter].
void depth_raw_callback(const sensor_msgs::msg::Image::SharedPtr msg)
bool getExtrinsicParam(yarp::sig::Matrix &extrinsic) override
Get the extrinsic parameters from the device.
bool close() override
Close the DeviceDriver.
bool setRgbMirroring(bool mirror) override
Set the mirroring setting of the sensor.
bool getRgbIntrinsicParam(yarp::os::Property &intrinsic) override
Get the intrinsic parameters of the rgb camera.
bool getRgbFOV(double &horizontalFov, double &verticalFov) override
Get the field of view (FOV) of the rgb camera.
bool setDepthAccuracy(double accuracy) override
Set the minimum detectable variation in distance [meter] when possible.
bool getDepthImage(depthImage &depth_image, yarp::os::Stamp *depth_image_stamp=nullptr) override
bool getRgbImage(yarp::sig::FlexImage &rgb_image, yarp::os::Stamp *rgb_image_stamp=NULL) override
Get the rgb frame from the device.
bool getDepthFOV(double &horizontalFov, double &verticalFov) override
Get the field of view (FOV) of the depth camera.
int getRgbWidth() override
Return the width of each frame.
int getRgbHeight() override
Return the height of each frame.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
void depth_info_callback(const sensor_msgs::msg::CameraInfo::SharedPtr msg)
bool getDepthClipPlanes(double &nearPlane, double &farPlane) override
Get the clipping planes of the sensor.
yarp::dev::IRGBDSensor::RGBDSensor_status getSensorStatus() override
Get the surrent status of the sensor, using enum type.
void color_raw_callback(const sensor_msgs::msg::Image::SharedPtr msg)
bool setDepthMirroring(bool mirror) override
Set the mirroring setting of the sensor.
bool getRgbResolution(int &width, int &height) override
Get the resolution of the rgb image from the camera.
bool setDepthResolution(int width, int height) override
Set the resolution of the depth image from the camera.
RgbdSensor_nwc_ros2(RgbdSensor_nwc_ros2 &&) noexcept=delete
bool setRgbResolution(int width, int height) override
Set the resolution of the rgb image from the camera.
bool getDepthIntrinsicParam(yarp::os::Property &intrinsic) override
Get the intrinsic parameters of the depth camera.
bool getImages(yarp::sig::FlexImage &rgb_image, depthImage &depth_image, yarp::os::Stamp *rgb_image_stamp=nullptr, yarp::os::Stamp *depth_image_stamp=nullptr) override
bool getRgbMirroring(bool &mirror) override
Get the mirroring setting of the sensor.
void callback(sensor_msgs::msg::CameraInfo::SharedPtr msg, std::string topic)
bool setDepthFOV(double horizontalFov, double verticalFov) override
Set the field of view (FOV) of the depth camera.
bool setDepthClipPlanes(double nearPlane, double farPlane) override
Set the clipping planes of the sensor.
bool setRgbFOV(double horizontalFov, double verticalFov) override
Set the field of view (FOV) of the rgb camera.
RgbdSensor_nwc_ros2(const RgbdSensor_nwc_ros2 &)=delete
int getDepthHeight() override
Return the height of each frame.
Interface implemented by all device drivers.
A generic interface for cameras that have both color camera as well as depth camera sensor,...
An abstraction for a time stamp and/or sequence number.
Image class with user control of representation details.
yarp::sig::ImageOf< yarp::sig::PixelFloat > depthImage
This class is an utility.
The main, catch-all namespace for YARP.
constexpr char accuracy[]
The IntrinsicParams struct to handle the intrinsic parameter of cameras(RGB and RGBD either).