37 this->m_channelsNum = 1;
38 m_orientation_sensors.resize(m_channelsNum);
39 m_position_sensors.resize(m_channelsNum);
41 return PeriodicThread::start();
48 PeriodicThread::stop();
66 for (
size_t i = 0; i < m_position_sensors.size(); i++)
68 m_position_sensors[i].m_timestamp = timeNow;
70 for (
auto it= m_position_sensors[i].m_data.begin(); it != m_position_sensors[i].m_data.end(); it++)
75 for (
size_t i = 0; i < m_orientation_sensors.size(); i++)
77 m_orientation_sensors[i].m_timestamp = timeNow;
79 for (
auto it = m_orientation_sensors[i].m_data.begin(); it != m_orientation_sensors[i].m_data.end(); it++)
96 std::lock_guard<std::mutex> myLockGuard(m_mutex);
97 return m_position_sensors.size();
102 std::lock_guard<std::mutex> myLockGuard (m_mutex);
104 return m_position_sensors[sens_index].m_status;
109 std::lock_guard<std::mutex> myLockGuard(m_mutex);
110 if (sens_index >= m_position_sensors.size())
return false;
111 name = m_position_sensors[sens_index].m_name;
117 std::lock_guard<std::mutex> myLockGuard(m_mutex);
118 if (sens_index >= m_position_sensors.size())
return false;
119 frameName = m_position_sensors[sens_index].m_framename;
125 std::lock_guard<std::mutex> myLockGuard(m_mutex);
126 if (sens_index >= m_position_sensors.size())
return false;
127 timestamp = m_position_sensors[sens_index].m_timestamp;
128 xyz = m_position_sensors[sens_index].m_data;
134 std::lock_guard<std::mutex> myLockGuard(m_mutex);
135 return m_orientation_sensors.size();
140 std::lock_guard<std::mutex> myLockGuard(m_mutex);
142 return m_orientation_sensors[sens_index].m_status;
147 std::lock_guard<std::mutex> myLockGuard(m_mutex);
148 if (sens_index >= m_orientation_sensors.size())
return false;
149 name = m_orientation_sensors[sens_index].m_name;
155 std::lock_guard<std::mutex> myLockGuard(m_mutex);
156 if (sens_index >= m_orientation_sensors.size())
return false;
157 frameName = m_orientation_sensors[sens_index].m_framename;
163 std::lock_guard<std::mutex> myLockGuard(m_mutex);
164 if (sens_index >= m_orientation_sensors.size())
return false;
165 timestamp = m_orientation_sensors[sens_index].m_timestamp;
166 xyz = m_orientation_sensors[sens_index].m_data;
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
FakePositionSensor(double period=0.05)
bool getOrientationSensorFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame of the specified sensor.
bool close() override
Close the DeviceDriver.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
yarp::dev::MAS_status getPositionSensorStatus(size_t sens_index) const override
Get the status of the specified sensor.
bool getOrientationSensorMeasureAsRollPitchYaw(size_t sens_index, yarp::sig::Vector &xyz, double ×tamp) const override
Get the last reading of the orientation sensor as roll pitch yaw.
bool getPositionSensorMeasure(size_t sens_index, yarp::sig::Vector &xyz, double ×tamp) const override
Get the last reading of the position sensor as x y z.
yarp::dev::MAS_status getOrientationSensorStatus(size_t sens_index) const override
Get the status of the specified sensor.
void run() override
Loop function.
bool getPositionSensorFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame of the specified sensor.
bool threadInit() override
Initialization method.
size_t getNrOfOrientationSensors() const override
Get the number of orientation sensors exposed by this device.
void threadRelease() override
Release method.
bool getPositionSensorName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
size_t getNrOfPositionSensors() const override
Get the number of position sensors exposed by this device.
bool getOrientationSensorName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
bool setPeriod(double period)
Set the (new) period of the thread.
A base class for nested structures that can be searched.
#define yCTrace(component,...)
#define YARP_LOG_COMPONENT(name,...)
For streams capable of holding different kinds of content, check what they actually have.
MAS_status
Status of a given analog sensor exposed by a multiple analog sensors interface.
@ MAS_UNKNOWN
The sensor is in an unknown state.
@ MAS_OK
The sensor is working correctly.
double now()
Return the current time in seconds, relative to an arbitrary starting point.