12#include <yarp/rosmsg/impl/yarpRosHelper.h>
54 if (!config.
check(
"period",
"refresh period of the broadcasted values in s"))
62 period = config.
find(
"period").asFloat64();
67 if (config.
check(
"forceInfoSync"))
69 forceInfoSync = config.
find(
"forceInfoSync").asBool();
72 if(!initialize_ROS(config))
100 if (!params.
check(
"depth_topic_name")) {
111 if (!params.
check(
"color_topic_name")) {
122 if (!params.
check(
"node_name")) {
133 if (!params.
check(
"depth_frame_id")) {
137 m_depth_frame_id = params.
find(
"depth_frame_id").asString();
140 if (!params.
check(
"color_frame_id")) {
144 m_color_frame_id = params.
find(
"color_frame_id").asString();
195 poly->
view(sensor_p);
199 if(sensor_p ==
nullptr)
205 if(fgCtrl ==
nullptr)
227bool RgbdSensor_nws_ros::setCamInfo(yarp::rosmsg::sensor_msgs::CameraInfo&
cameraInfo,
const std::string& frame_id,
const UInt&
seq,
const SensorType& sensorType)
249 currentSensor = sensorType == COLOR_SENSOR ?
"Rgb" :
"Depth";
258 if(!
camData.check(
"distortionModel"))
339bool RgbdSensor_nws_ros::writeData()
374 yarp::rosmsg::sensor_msgs::CameraInfo&
camInfoC = publisherPort_colorCaminfo.
prepare();
378 publisherPort_color.
write();
379 if (setCamInfo(
camInfoC, m_color_frame_id, nodeSeq, COLOR_SENSOR))
383 publisherPort_colorCaminfo.
setEnvelope(colorStamp);
384 publisherPort_colorCaminfo.
write();
394 yarp::rosmsg::sensor_msgs::CameraInfo&
camInfoD = publisherPort_depthCaminfo.
prepare();
398 publisherPort_depth.
write();
399 if (setCamInfo(
camInfoD, m_depth_frame_id, nodeSeq, DEPTH_SENSOR))
403 publisherPort_depthCaminfo.
setEnvelope(depthStamp);
404 publisherPort_depthCaminfo.
write();
419 if (sensor_p!=
nullptr)
423 switch (sensorStatus)
const yarp::os::LogComponent & RGBDSENSORNWSROS()
#define DEFAULT_THREAD_PERIOD
rgbdSensor_nws_ros: A Network grabber for kinect-like devices. This device will produce two streams o...
~RgbdSensor_nws_ros() override
bool close() override
Close the DeviceDriver.
void threadRelease() override
Release method.
bool attach(yarp::dev::PolyDriver *poly) override
Specify which sensor this thread has to read from.
bool open(yarp::os::Searchable ¶ms) override
Device driver interface.
bool threadInit() override
Initialization method.
void run() override
Loop function.
bool detach() override
WrapperSingle interface.
bool view(T *&x)
Get an interface to the device driver.
A generic interface for cameras that have both color camera as well as depth camera sensor,...
int getRgbWidth() override=0
Return the width of each frame.
bool getRgbIntrinsicParam(yarp::os::Property &intrinsic) override=0
Get the intrinsic parameters of the rgb camera.
int getDepthWidth() override=0
Return the height of each frame.
int getRgbHeight() override=0
Return the height of each frame.
virtual bool getImages(yarp::sig::FlexImage &colorFrame, yarp::sig::ImageOf< yarp::sig::PixelFloat > &depthFrame, yarp::os::Stamp *colorStamp=nullptr, yarp::os::Stamp *depthStamp=nullptr)=0
Get the both the color and depth frame in a single call.
virtual RGBDSensor_status getSensorStatus()=0
Get the surrent status of the sensor, using enum type.
int getDepthHeight() override=0
Return the height of each frame.
bool getDepthIntrinsicParam(yarp::os::Property &intrinsic) override=0
Get the intrinsic parameters of the depth camera.
A container for a device driver.
A mini-server for performing network communication in the background.
void interrupt()
interrupt delegates the call to the Node port interrupt.
An abstraction for a periodic thread.
bool setPeriod(double period)
Set the (new) period of the thread.
bool isRunning() const
Returns true when the thread is started, false otherwise.
bool start()
Call this to start the thread.
void stop()
Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() ca...
A class for storing options and configuration information.
bool topic(const std::string &name)
Set topic to publish to.
void write(bool forceStrict=false)
Write the current object being returned by Publisher::prepare.
T & prepare()
Access the object which will be transmitted by the next call to yarp::os::Publisher::write.
A base class for nested structures that can be searched.
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
virtual std::string toString() const =0
Return a standard text representation of the content of the object.
virtual Value & find(const std::string &key) const =0
Gets a value corresponding to a given keyword.
An abstraction for a time stamp and/or sequence number.
double getTime() const
Get the time stamp.
#define yCInfo(component,...)
#define yCError(component,...)
#define yCTrace(component,...)
#define yCWarning(component,...)
#define YARP_LOG_COMPONENT(name,...)
void deepCopyImages(const yarp::sig::FlexImage &src, yarp::rosmsg::sensor_msgs::Image &dest, const std::string &frame_id, const yarp::rosmsg::TickTime &timeStamp, const unsigned int &seq)
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.