Skip to content

Commit

Permalink
Replace RateThread with PeriodicThread
Browse files Browse the repository at this point in the history
  • Loading branch information
RiccardoGrieco committed Jul 5, 2022
1 parent a45ae7a commit 31c6650
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions amti/src/AMTIPlatformsDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
#include <cmath>

#include <yarp/os/LogStream.h>
#include <yarp/os/RateThread.h>
#include <yarp/os/PeriodicThread.h>
#include <yarp/os/Time.h>
#include <yarp/dev/IAnalogSensor.h>

class yarp::dev::AMTIPlatformsDriver::AMTIReaderThread : public yarp::os::RateThread
class yarp::dev::AMTIPlatformsDriver::AMTIReaderThread : public yarp::os::PeriodicThread
{
yarp::dev::AMTIPlatformsDriver &driver;
double timeout;

public:
AMTIReaderThread(yarp::dev::AMTIPlatformsDriver& _driver, int period, double _timeout)
: yarp::os::RateThread(period), driver(_driver), timeout(_timeout) {}
: yarp::os::PeriodicThread(period), driver(_driver), timeout(_timeout) {}

virtual void run()
{
Expand Down
6 changes: 3 additions & 3 deletions ftShoeUdpWrapper/ftShoeUdpWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const unsigned AS_OVF = yarp::dev::IAnalogSensor::AS_OK;
const unsigned AS_TIMEOUT = yarp::dev::IAnalogSensor::AS_OK;

ftShoeUdpWrapper::ftShoeUdpWrapper()
: RateThread(default_thread_period)
: PeriodicThread(default_thread_period)
, m_1_timestamp(new yarp::os::Stamp())
, m_2_timestamp(new yarp::os::Stamp())
, m_initialTimestamp(0)
Expand Down Expand Up @@ -78,7 +78,7 @@ bool ftShoeUdpWrapper::open(yarp::os::Searchable& config)
m_port = static_cast<unsigned>(prop.find("udpPort").asInt32());
const int threadPeriod = prop.find("threadPeriod").asInt32();

if (!setRate(threadPeriod)) {
if (!setPeriod(threadPeriod)) {
yError() << logPrefix + "Failed to set specified thread period";
return false;
}
Expand Down Expand Up @@ -181,7 +181,7 @@ bool ftShoeUdpWrapper::detachAll()
}

// ================
// RateThread class
// PeriodicThread class
// ================

void ftShoeUdpWrapper::run()
Expand Down
6 changes: 3 additions & 3 deletions ftShoeUdpWrapper/ftShoeUdpWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <yarp/dev/PolyDriver.h>
#include <yarp/dev/Wrapper.h>

#include <yarp/os/RateThread.h>
#include <yarp/os/PeriodicThread.h>

#include <yarp/sig/Vector.h>

Expand All @@ -36,7 +36,7 @@ class Stamp;

class yarp::dev::ftShoeUdpWrapper final : public yarp::dev::DeviceDriver,
public yarp::dev::IMultipleWrapper,
public yarp::os::RateThread {
public yarp::os::PeriodicThread {
private:
// Mutex to avoid race conditions
std::mutex m_mutex;
Expand Down Expand Up @@ -90,7 +90,7 @@ class yarp::dev::ftShoeUdpWrapper final : public yarp::dev::DeviceDriver,
bool attachAll(const PolyDriverList& devices2Attach) override;
bool detachAll() override;

// RateThread class
// PeriodicThread class
void run() override;
};

Expand Down

0 comments on commit 31c6650

Please sign in to comment.