6#ifndef YARP_RGBDSENSOR_NWC_ROS2
7#define YARP_RGBDSENSOR_NWC_ROS2
26#include <rclcpp/rclcpp.hpp>
27#include <sensor_msgs/msg/image.hpp>
28#include <sensor_msgs/msg/camera_info.hpp>
75 std::mutex m_rgb_camera_info_mutex;
76 std::mutex m_rgb_image_mutex;
77 std::mutex m_depth_camera_info_mutex;
78 std::mutex m_depth_image_mutex;
83 std::string m_depth_image_frame;
85 double m_max_depth_width;
86 double m_max_depth_height;
90 std::string m_rgb_image_frame;
92 double m_max_rgb_width;
93 double m_max_rgb_height;
95 bool m_depth_image_valid =
false;
96 bool m_depth_stamp_valid =
false;
97 bool m_rgb_image_valid =
false;
98 bool m_rgb_stamp_valid =
false;
102 std::string m_topic_rgb_camera_info;
103 std::string m_topic_depth_camera_info;
114 rclcpp::Node::SharedPtr m_node;
127 bool open(
yarp::os::Searchable& config) override;
128 bool close() override;
136 yarp::dev::ReturnValue
getRgbFOV(
double& horizontalFov,
double& verticalFov) override;
137 yarp::dev::ReturnValue
setRgbFOV(
double horizontalFov,
double verticalFov) override;
146 yarp::dev::ReturnValue
getDepthFOV(
double& horizontalFov,
double& verticalFov) override;
147 yarp::dev::ReturnValue
setDepthFOV(
double horizontalFov,
double verticalFov) override;
158 yarp::dev::ReturnValue
getRgbImage(
yarp::sig::FlexImage& rgb_image,
yarp::os::Stamp* rgb_image_stamp = NULL) override;
160 yarp::dev::ReturnValue
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.
yarp::dev::ReturnValue getExtrinsicParam(yarp::sig::Matrix &extrinsic) override
Get the extrinsic parameters from the device.
int getDepthWidth() override
Return the height of each frame.
yarp::dev::ReturnValue getRgbResolution(int &width, int &height) override
Get the resolution of the rgb image from the camera.
yarp::dev::ReturnValue getRgbSupportedConfigurations(std::vector< yarp::dev::CameraConfig > &configurations) override
Get the possible configurations of the camera.
yarp::dev::ReturnValue getDepthClipPlanes(double &nearPlane, double &farPlane) override
Get the clipping planes of the sensor.
void color_info_callback(const sensor_msgs::msg::CameraInfo::SharedPtr msg)
yarp::dev::ReturnValue setDepthMirroring(bool mirror) override
Set the mirroring setting of the sensor.
void depth_raw_callback(const sensor_msgs::msg::Image::SharedPtr msg)
yarp::dev::ReturnValue getDepthAccuracy(double &accuracy) override
Get the minimum detectable variation in distance [meter].
yarp::dev::ReturnValue getDepthImage(depthImage &depth_image, yarp::os::Stamp *depth_image_stamp=nullptr) override
yarp::dev::ReturnValue 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 close() override
Close the DeviceDriver.
yarp::dev::ReturnValue getLastErrorMsg(std::string &message, yarp::os::Stamp *timeStamp=NULL) override
Return an error message in case of error.
yarp::dev::ReturnValue getDepthIntrinsicParam(yarp::os::Property &intrinsic) override
yarp::dev::ReturnValue getRgbFOV(double &horizontalFov, double &verticalFov) override
Get the field of view (FOV) of the rgb camera.
yarp::dev::ReturnValue getSensorStatus(yarp::dev::IRGBDSensor::RGBDSensor_status &status) override
Get the current status of the sensor, using enum type.
yarp::dev::ReturnValue getDepthFOV(double &horizontalFov, double &verticalFov) override
Get the field of view (FOV) of the depth camera.
yarp::dev::ReturnValue getRgbMirroring(bool &mirror) override
Get the mirroring setting of the sensor.
yarp::dev::ReturnValue getRgbImage(yarp::sig::FlexImage &rgb_image, yarp::os::Stamp *rgb_image_stamp=NULL) override
Get the rgb frame from the device.
int getRgbWidth() override
Return the width of each frame.
int getRgbHeight() override
Return the height of each frame.
yarp::dev::ReturnValue getRgbIntrinsicParam(yarp::os::Property &intrinsic) override
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
yarp::dev::ReturnValue setDepthFOV(double horizontalFov, double verticalFov) override
Set the field of view (FOV) of the depth camera.
yarp::dev::ReturnValue setDepthClipPlanes(double nearPlane, double farPlane) override
Set the clipping planes of the sensor.
void depth_info_callback(const sensor_msgs::msg::CameraInfo::SharedPtr msg)
yarp::dev::ReturnValue setRgbResolution(int width, int height) override
Set the resolution of the rgb image from the camera.
void color_raw_callback(const sensor_msgs::msg::Image::SharedPtr msg)
yarp::dev::ReturnValue getDepthMirroring(bool &mirror) override
Get the mirroring setting of the sensor.
yarp::dev::ReturnValue setDepthAccuracy(double accuracy) override
Set the minimum detectable variation in distance [meter] when possible.
RgbdSensor_nwc_ros2(RgbdSensor_nwc_ros2 &&) noexcept=delete
yarp::dev::ReturnValue setRgbMirroring(bool mirror) override
Set the mirroring setting of the sensor.
yarp::dev::ReturnValue setRgbFOV(double horizontalFov, double verticalFov) override
Set the field of view (FOV) of the rgb camera.
void callback(sensor_msgs::msg::CameraInfo::SharedPtr msg, std::string topic)
yarp::dev::ReturnValue setDepthResolution(int width, int height) override
Set the resolution of the depth image from the camera.
yarp::dev::ReturnValue getDepthResolution(int &width, int &height) override
Get the resolution of the depth image from the 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).