31 m_rgbdsensor =
nullptr;
43 std::string rpcPort_Name =
rootName +
"/rpc:i";
44 colorFrame_StreamingPort_Name =
rootName +
"/rgbImage:o";
45 depthFrame_StreamingPort_Name =
rootName +
"/depthImage:o";
50 if (!rpcPort.
open(rpcPort_Name))
57 if (!colorFrame_StreamingPort.
open(colorFrame_StreamingPort_Name))
62 if (!depthFrame_StreamingPort.
open(depthFrame_StreamingPort_Name))
68 if (!
bRet) {
return false;}
83 colorFrame_StreamingPort.
close();
84 depthFrame_StreamingPort.
close();
95 std::lock_guard lock (m_mutex);
101 m_rgbdsensor =
nullptr;
108 std::lock_guard lock (m_mutex);
112 poly->
view(m_rgbdsensor);
113 poly->
view(m_fgCtrl);
117 if(m_rgbdsensor ==
nullptr)
123 if(m_fgCtrl ==
nullptr)
129 m_rgbd_RPC = std::make_unique<RGBDSensorMsgsImpl>(m_rgbdsensor, m_fgCtrl);
148bool RGBDSensor_nws_yarp::setCamInfo(
const std::string&
frame_id,
const UInt&
seq,
const SensorType&
sensorType)
178 if(!
camData.check(
"distortionModel"))
217bool RGBDSensor_nws_yarp::writeData()
251 colorFrame_StreamingPort.
write();
258 depthFrame_StreamingPort.
write();
266 std::lock_guard lock (m_mutex);
268 if (m_rgbdsensor!=
nullptr)
272 switch (m_sensorStatus)
312 if (!connection.
isValid()) {
return false;}
314 std::lock_guard<std::mutex> lock(m_mutex);
318 if (m_rgbd_RPC->read(connection))
const yarp::os::LogComponent & RGBDSENSORNWSYARP()
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
RGBDSensor_nws_yarp: A Network grabber for kinect-like devices. This device will produce two streams ...
~RGBDSensor_nws_yarp() override
bool attach(yarp::dev::PolyDriver *poly) override
Attach to another object.
void run() override
Loop function.
bool close() override
Close the DeviceDriver.
void threadRelease() override
Release method.
bool threadInit() override
Initialization method.
bool read(yarp::os::ConnectionReader &connection) override
Read this object from a network connection.
bool detach() override
WrapperSingle interface.
bool open(yarp::os::Searchable ¶ms) override
Device driver interface.
bool view(T *&x)
Get an interface to the device driver.
virtual yarp::dev::ReturnValue getDepthIntrinsicParam(yarp::os::Property &intrinsic)=0
Get the intrinsic parameters of the depth camera.
A generic interface for cameras that have both color camera as well as depth camera sensor,...
virtual yarp::dev::ReturnValue 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 yarp::dev::ReturnValue getSensorStatus(RGBDSensor_status &status)=0
Get the current status of the sensor, using enum type.
virtual yarp::dev::ReturnValue getRgbIntrinsicParam(yarp::os::Property &intrinsic)=0
Get the intrinsic parameters of the rgb camera.
A container for a device driver.
A mini-server for performing network communication in the background.
void close() override
Stop port activity.
bool setEnvelope(PortWriter &envelope) override
Set an envelope (e.g., a timestamp) to the next message which will be sent.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
void interrupt() override
Interrupt any current reads or writes attached to the port.
int getOutputCount() override
Determine how many output connections this port has.
void write(bool forceStrict=false)
Write the current object being returned by BufferedPort::prepare.
T & prepare()
Access the object which will be transmitted by the next call to yarp::os::BufferedPort::write.
An interface for reading from a network connection.
virtual bool isValid() const =0
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...
void setReader(PortReader &reader) override
Set an external reader for port data.
void interrupt() override
Interrupt any current reads or writes attached to the port.
void close() override
Stop port activity.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
A class for storing options and configuration information.
A base class for nested structures that can be searched.
An abstraction for a time stamp and/or sequence number.
double getTime() const
Get the time stamp.
Image class with user control of representation details.
#define yCInfo(component,...)
#define yCError(component,...)
#define yCTrace(component,...)
#define yCWarning(component,...)
#define YARP_LOG_COMPONENT(name,...)
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.