Skip to content

Commit

Permalink
The following dataTypes have been migrated from yarp_dev to yarp_sig …
Browse files Browse the repository at this point in the history
…library:

AudioPlayerStatus, AudioRecorderStatus, AudioBufferSize, AudioBufferSizeData, LaserMeasurementData, LaserScan2D.
Interfaces and devices have been fixed accordingly.
  • Loading branch information
randaz81 committed Sep 3, 2024
1 parent 5d84128 commit a0c4c17
Show file tree
Hide file tree
Showing 48 changed files with 152 additions and 186 deletions.
6 changes: 3 additions & 3 deletions src/devices/laserFromExternalPort/laserFromExternalPort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ InputPortProcessor::InputPortProcessor()
m_contains_data=false;
}

void InputPortProcessor::onRead(yarp::dev::LaserScan2D& b)
void InputPortProcessor::onRead(yarp::sig::LaserScan2D& b)
{
m_port_mutex.lock();
m_lastScan = b;
Expand All @@ -56,7 +56,7 @@ void InputPortProcessor::onRead(yarp::dev::LaserScan2D& b)
m_port_mutex.unlock();
}

inline void InputPortProcessor::getLast(yarp::dev::LaserScan2D& data, Stamp& stmp)
inline void InputPortProcessor::getLast(yarp::sig::LaserScan2D& data, Stamp& stmp)
{
//this blocks untils the first data is received;
size_t counter =0;
Expand Down Expand Up @@ -292,7 +292,7 @@ bool LaserFromExternalPort::threadInit()
return true;
}

void LaserFromExternalPort::calculate(yarp::dev::LaserScan2D scan_data, yarp::sig::Matrix m)
void LaserFromExternalPort::calculate(yarp::sig::LaserScan2D scan_data, yarp::sig::Matrix m)
{
yarp::sig::Vector temp(3);
temp = yarp::math::dcm2rpy(m);
Expand Down
18 changes: 9 additions & 9 deletions src/devices/laserFromExternalPort/laserFromExternalPort.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <yarp/os/Stamp.h>
#include <yarp/dev/ControlBoardInterfaces.h>
#include <yarp/dev/IRangefinder2D.h>
#include <yarp/dev/LaserScan2D.h>
#include <yarp/sig/LaserScan2D.h>
#include <yarp/dev/Lidar2DDeviceBase.h>
#include <yarp/sig/Vector.h>
#include <yarp/dev/IFrameTransform.h>
Expand All @@ -34,26 +34,26 @@ enum base_enum
};

class InputPortProcessor :
public yarp::os::BufferedPort<yarp::dev::LaserScan2D>
public yarp::os::BufferedPort<yarp::sig::LaserScan2D>
{
std::mutex m_port_mutex;
yarp::dev::LaserScan2D m_lastScan;
yarp::sig::LaserScan2D m_lastScan;
yarp::os::Stamp m_lastStamp;
bool m_contains_data;

public:
InputPortProcessor(const InputPortProcessor& alt) :
yarp::os::BufferedPort<yarp::dev::LaserScan2D>(),
yarp::os::BufferedPort<yarp::sig::LaserScan2D>(),
m_lastScan(alt.m_lastScan),
m_lastStamp(alt.m_lastStamp),
m_contains_data(alt.m_contains_data)
{
}

InputPortProcessor();
using yarp::os::BufferedPort<yarp::dev::LaserScan2D>::onRead;
void onRead(yarp::dev::LaserScan2D& v) override;
void getLast(yarp::dev::LaserScan2D& data, yarp::os::Stamp& stmp);
using yarp::os::BufferedPort<yarp::sig::LaserScan2D>::onRead;
void onRead(yarp::sig::LaserScan2D& v) override;
void getLast(yarp::sig::LaserScan2D& data, yarp::os::Stamp& stmp);
};

/**
Expand Down Expand Up @@ -93,7 +93,7 @@ class LaserFromExternalPort : public yarp::dev::Lidar2DDeviceBase,
std::vector <std::string> m_port_names;
std::vector<InputPortProcessor> m_input_ports;
std::vector <yarp::os::Stamp> m_last_stamp;
std::vector <yarp::dev::LaserScan2D> m_last_scan_data;
std::vector<yarp::sig::LaserScan2D> m_last_scan_data;
yarp::dev::PolyDriver m_tc_driver;
yarp::dev::IFrameTransform* m_iTc = nullptr;

Expand All @@ -102,7 +102,7 @@ class LaserFromExternalPort : public yarp::dev::Lidar2DDeviceBase,
yarp::sig::Vector m_empty_laser_data;
base_enum m_base_type;

void calculate(yarp::dev::LaserScan2D scan, yarp::sig::Matrix m);
void calculate(yarp::sig::LaserScan2D scan, yarp::sig::Matrix m);

public:
LaserFromExternalPort(double period = 0.01) : Lidar2DDeviceBase(), PeriodicThread(period)
Expand Down
2 changes: 2 additions & 0 deletions src/devices/laserFromPointCloud/laserFromPointCloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#define DEG2RAD M_PI/180.0
#endif

using namespace yarp::sig;

YARP_LOG_COMPONENT(LASER_FROM_POINTCLOUD, "yarp.devices.laserFromPointCloud")

/*
Expand Down
1 change: 1 addition & 0 deletions src/devices/laserHokuyo/laserHokuyo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define DEG2RAD M_PI/180.0
#endif

using namespace yarp::sig;

namespace {
YARP_LOG_COMPONENT(LASERHOKUYO, "yarp.devices.laserHokuyo")
Expand Down
2 changes: 1 addition & 1 deletion src/devices/laserHokuyo/laserHokuyo.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class laserHokuyo : public PeriodicThread, public yarp::dev::IRangefinder2D, pub
public:
//IRangefinder2D interface
bool getRawData(yarp::sig::Vector &data, double* timestamp) override;
bool getLaserMeasurement(std::vector<LaserMeasurementData> &data, double* timestamp) override;
bool getLaserMeasurement(std::vector<yarp::sig::LaserMeasurementData> &data, double* timestamp) override;
bool getDeviceStatus (Device_status &status) override;
bool getDeviceInfo (std::string &device_info) override;
bool getDistanceRange (double& min, double& max) override;
Expand Down
10 changes: 5 additions & 5 deletions src/devices/messages/IAudioGrabberMsgs/IAudioGrabberMsgs.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ struct return_isRecording {
2: bool isRecording = false;
}

struct yarp_dev_AudioBufferSize {
struct yarp_sig_AudioBufferSize {
} (
yarp.name = "yarp::dev::AudioBufferSize"
yarp.includefile = "yarp/dev/AudioBufferSize.h"
yarp.name = "yarp::sig::AudioBufferSize"
yarp.includefile = "yarp/sig/AudioBufferSize.h"
)

struct yarp_sig_Sound {
Expand All @@ -29,12 +29,12 @@ struct return_getSound {

struct return_getRecordingAudioBufferCurrentSize {
1: bool ret = false;
2: yarp_dev_AudioBufferSize bufsize;
2: yarp_sig_AudioBufferSize bufsize;
}

struct return_getRecordingAudioBufferMaxSize {
1: bool ret = false;
2: yarp_dev_AudioBufferSize bufsize;
2: yarp_sig_AudioBufferSize bufsize;
}

typedef i32 ( yarp.type = "size_t" ) size_t
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Rangefinder2DInputPortProcessor::Rangefinder2DInputPortProcessor()
resetStat();
}

void Rangefinder2DInputPortProcessor::onRead(yarp::dev::LaserScan2D&b)
void Rangefinder2DInputPortProcessor::onRead(yarp::sig::LaserScan2D& b)
{
now=SystemClock::nowSystem();
mutex.lock();
Expand Down Expand Up @@ -102,7 +102,7 @@ void Rangefinder2DInputPortProcessor::onRead(yarp::dev::LaserScan2D&b)
mutex.unlock();
}

inline int Rangefinder2DInputPortProcessor::getLast(yarp::dev::LaserScan2D&data, Stamp &stmp)
inline int Rangefinder2DInputPortProcessor::getLast(yarp::sig::LaserScan2D& data, Stamp& stmp)
{
mutex.lock();
int ret=state;
Expand Down Expand Up @@ -286,7 +286,7 @@ bool Rangefinder2DClient::close()

bool Rangefinder2DClient::getRawData(yarp::sig::Vector &data, double* timestamp)
{
yarp::dev::LaserScan2D scan;
yarp::sig::LaserScan2D scan;
inputPort.getLast(scan, lastTs);

data = scan.scans;
Expand All @@ -300,7 +300,7 @@ bool Rangefinder2DClient::getRawData(yarp::sig::Vector &data, double* timestamp)

bool Rangefinder2DClient::getLaserMeasurement(std::vector<LaserMeasurementData> &data, double* timestamp)
{
yarp::dev::LaserScan2D scan;
yarp::sig::LaserScan2D scan;
inputPort.getLast(scan, lastTs);
size_t size = scan.scans.size();
data.resize(size);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <yarp/dev/IRangefinder2D.h>
#include <yarp/dev/ControlBoardInterfaces.h>
#include <yarp/dev/ControlBoardHelpers.h>
#include <yarp/dev/LaserScan2D.h>
#include <yarp/sig/LaserScan2D.h>
#include <yarp/sig/Vector.h>
#include <yarp/os/Time.h>
#include <yarp/dev/PolyDriver.h>
Expand All @@ -25,9 +25,9 @@
const int LASER_TIMEOUT=100; //ms

class Rangefinder2DInputPortProcessor :
public yarp::os::BufferedPort<yarp::dev::LaserScan2D>
public yarp::os::BufferedPort<yarp::sig::LaserScan2D>
{
yarp::dev::LaserScan2D lastScan;
yarp::sig::LaserScan2D lastScan;
std::mutex mutex;
yarp::os::Stamp lastStamp;
double deltaT;
Expand All @@ -45,10 +45,10 @@ class Rangefinder2DInputPortProcessor :

Rangefinder2DInputPortProcessor();

using yarp::os::BufferedPort<yarp::dev::LaserScan2D>::onRead;
void onRead(yarp::dev::LaserScan2D&v) override;
using yarp::os::BufferedPort<yarp::sig::LaserScan2D>::onRead;
void onRead(yarp::sig::LaserScan2D& v) override;

inline int getLast(yarp::dev::LaserScan2D &data, yarp::os::Stamp &stmp);
inline int getLast(yarp::sig::LaserScan2D& data, yarp::os::Stamp& stmp);

inline int getIterations();

Expand Down Expand Up @@ -105,7 +105,7 @@ class Rangefinder2DClient:
* @param data a vector containing the measurement data, expressed in cartesian/polar format
* @return true/false..
*/
bool getLaserMeasurement(std::vector<yarp::dev::LaserMeasurementData> &data, double* timestamp = nullptr) override;
bool getLaserMeasurement(std::vector<yarp::sig::LaserMeasurementData> &data, double* timestamp = nullptr) override;

/**
* Get the device measurements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Rangefinder2DInputPortProcessor::Rangefinder2DInputPortProcessor()
resetStat();
}

void Rangefinder2DInputPortProcessor::onRead(yarp::dev::LaserScan2D&b)
void Rangefinder2DInputPortProcessor::onRead(yarp::sig::LaserScan2D& b)
{
now=SystemClock::nowSystem();
mutex.lock();
Expand Down Expand Up @@ -103,7 +103,7 @@ void Rangefinder2DInputPortProcessor::onRead(yarp::dev::LaserScan2D&b)
mutex.unlock();
}

inline int Rangefinder2DInputPortProcessor::getLast(yarp::dev::LaserScan2D&data, Stamp &stmp)
inline int Rangefinder2DInputPortProcessor::getLast(yarp::sig::LaserScan2D& data, Stamp& stmp)
{
mutex.lock();
int ret=state;
Expand Down Expand Up @@ -204,7 +204,7 @@ bool Rangefinder2D_nwc_yarp::close()

bool Rangefinder2D_nwc_yarp::getRawData(yarp::sig::Vector &data, double* timestamp)
{
yarp::dev::LaserScan2D scan;
yarp::sig::LaserScan2D scan;
m_inputPort.getLast(scan, m_lastTs);

data = scan.scans;
Expand All @@ -218,7 +218,7 @@ bool Rangefinder2D_nwc_yarp::getRawData(yarp::sig::Vector &data, double* timesta

bool Rangefinder2D_nwc_yarp::getLaserMeasurement(std::vector<LaserMeasurementData> &data, double* timestamp)
{
yarp::dev::LaserScan2D scan;
yarp::sig::LaserScan2D scan;
m_inputPort.getLast(scan, m_lastTs);
size_t size = scan.scans.size();
data.resize(size);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <yarp/dev/IRangefinder2D.h>
#include <yarp/dev/ControlBoardInterfaces.h>
#include <yarp/dev/ControlBoardHelpers.h>
#include <yarp/dev/LaserScan2D.h>
#include <yarp/sig/LaserScan2D.h>
#include <yarp/sig/Vector.h>
#include <yarp/os/Time.h>
#include <yarp/dev/PolyDriver.h>
Expand All @@ -23,9 +23,9 @@
#include "Rangefinder2D_nwc_yarp_ParamsParser.h"

class Rangefinder2DInputPortProcessor :
public yarp::os::BufferedPort<yarp::dev::LaserScan2D>
public yarp::os::BufferedPort<yarp::sig::LaserScan2D>
{
yarp::dev::LaserScan2D lastScan;
yarp::sig::LaserScan2D lastScan;
std::mutex mutex;
yarp::os::Stamp lastStamp;
double deltaT;
Expand All @@ -43,10 +43,10 @@ class Rangefinder2DInputPortProcessor :

Rangefinder2DInputPortProcessor();

using yarp::os::BufferedPort<yarp::dev::LaserScan2D>::onRead;
void onRead(yarp::dev::LaserScan2D&v) override;
using yarp::os::BufferedPort<yarp::sig::LaserScan2D>::onRead;
void onRead(yarp::sig::LaserScan2D& v) override;

inline int getLast(yarp::dev::LaserScan2D &data, yarp::os::Stamp &stmp);
inline int getLast(yarp::sig::LaserScan2D& data, yarp::os::Stamp& stmp);

inline int getIterations();

Expand Down Expand Up @@ -87,7 +87,7 @@ class Rangefinder2D_nwc_yarp:
bool close() override;

/* IRangefinder2D methods */
bool getLaserMeasurement(std::vector<yarp::dev::LaserMeasurementData> &data, double* timestamp = nullptr) override;
bool getLaserMeasurement(std::vector<yarp::sig::LaserMeasurementData> &data, double* timestamp = nullptr) override;
bool getRawData(yarp::sig::Vector &data, double* timestamp = nullptr) override;
bool getDeviceStatus(Device_status &status) override;
bool getDistanceRange(double& min, double& max) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ void Rangefinder2D_nws_yarp::run()
int ranges_size = ranges.size();
YARP_UNUSED(ranges_size);

yarp::dev::LaserScan2D& b = streamingPort.prepare();
yarp::sig::LaserScan2D& b = streamingPort.prepare();
//b.clear();
b.scans=ranges;
b.angle_min= minAngle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include <yarp/sig/Vector.h>

#include <yarp/dev/LaserScan2D.h>
#include <yarp/sig/LaserScan2D.h>
#include <yarp/dev/IRangefinder2D.h>
#include <yarp/dev/PolyDriver.h>
#include <yarp/dev/DeviceDriver.h>
Expand Down Expand Up @@ -70,7 +70,7 @@ class Rangefinder2D_nws_yarp :

private:
yarp::os::Port rpcPort;
yarp::os::BufferedPort<yarp::dev::LaserScan2D> streamingPort;
yarp::os::BufferedPort<yarp::sig::LaserScan2D> streamingPort;

//interfaces
yarp::dev::IRangefinder2D *sens_p;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <yarp/os/LogComponent.h>
#include <yarp/os/LogStream.h>

#include <yarp/dev/AudioPlayerStatus.h>
#include <yarp/sig/AudioPlayerStatus.h>
#include <yarp/dev/ControlBoardInterfaces.h>

#include <cmath>
Expand Down Expand Up @@ -254,7 +254,7 @@ void AudioPlayerWrapper::run()
m_irender->isPlaying(m_isPlaying);

//status port
yarp::dev::AudioPlayerStatus status;
yarp::sig::AudioPlayerStatus status;
status.enabled = m_isPlaying;
status.current_buffer_size = m_current_buffer_size.getSamples();
status.max_buffer_size = m_max_buffer_size.getSamples();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ class AudioPlayerWrapper :

yarp::dev::IAudioRender *m_irender = nullptr;
yarp::os::Stamp m_lastStateStamp;
yarp::dev::AudioBufferSize m_current_buffer_size;
yarp::dev::AudioBufferSize m_max_buffer_size;
yarp::sig::AudioBufferSize m_current_buffer_size;
yarp::sig::AudioBufferSize m_max_buffer_size;
std::queue<scheduled_sound_type> m_sound_buffer;

bool m_isPlaying = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "AudioRecorderWrapper.h"
#include <yarp/os/LogStream.h>
#include <yarp/dev/AudioRecorderStatus.h>
#include <yarp/sig/AudioRecorderStatus.h>

using namespace yarp::dev;
using namespace yarp::os;
Expand Down Expand Up @@ -246,8 +246,8 @@ bool AudioRecorderWrapper::detach()

void AudioRecorderStatusThread::run()
{
yarp::dev::AudioBufferSize device_buffer_current_size;
yarp::dev::AudioBufferSize device_buffer_max_size;
yarp::sig::AudioBufferSize device_buffer_current_size;
yarp::sig::AudioBufferSize device_buffer_max_size;
m_ARW->m_mic->getRecordingAudioBufferCurrentSize(device_buffer_current_size);
m_ARW->m_mic->getRecordingAudioBufferMaxSize(device_buffer_max_size);

Expand All @@ -265,7 +265,7 @@ void AudioRecorderStatusThread::run()
m_ARW->m_mic->isRecording(m_ARW->m_isRecording);

//status port
yarp::dev::AudioRecorderStatus status;
yarp::sig::AudioRecorderStatus status;
status.enabled = m_ARW->m_isRecording;
status.current_buffer_size = device_buffer_current_size.getSamples();
status.max_buffer_size = device_buffer_max_size.getSamples();
Expand Down
Loading

0 comments on commit a0c4c17

Please sign in to comment.