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 num = m_position_sensors.size();
103 std::lock_guard<std::mutex> myLockGuard (m_mutex);
105 return m_position_sensors[sens_index].m_status;
110 std::lock_guard<std::mutex> myLockGuard(m_mutex);
112 name = m_position_sensors[sens_index].m_name;
118 std::lock_guard<std::mutex> myLockGuard(m_mutex);
120 frameName = m_position_sensors[sens_index].m_framename;
126 std::lock_guard<std::mutex> myLockGuard(m_mutex);
128 timestamp = m_position_sensors[sens_index].m_timestamp;
129 xyz = m_position_sensors[sens_index].m_data;
135 std::lock_guard<std::mutex> myLockGuard(m_mutex);
136 num = m_orientation_sensors.size();
142 std::lock_guard<std::mutex> myLockGuard(m_mutex);
144 return m_orientation_sensors[sens_index].m_status;
149 std::lock_guard<std::mutex> myLockGuard(m_mutex);
151 name = m_orientation_sensors[sens_index].m_name;
157 std::lock_guard<std::mutex> myLockGuard(m_mutex);
159 frameName = m_orientation_sensors[sens_index].m_framename;
165 std::lock_guard<std::mutex> myLockGuard(m_mutex);
167 timestamp = m_orientation_sensors[sens_index].m_timestamp;
168 xyz = m_orientation_sensors[sens_index].m_data;
#define ReturnValue_error_input_out_of_bounds
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
FakePositionSensor(double period=0.05)
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.
yarp::dev::MAS_status getOrientationSensorStatus(size_t sens_index) const override
Get the status of the specified sensor.
void run() override
Loop function.
yarp::dev::ReturnValue getOrientationSensorName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
yarp::dev::ReturnValue getNrOfOrientationSensors(size_t &num) const override
Get the number of orientation sensors exposed by this device.
yarp::dev::ReturnValue getPositionSensorName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
bool threadInit() override
Initialization method.
yarp::dev::ReturnValue 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.
yarp::dev::ReturnValue getOrientationSensorFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame of the specified sensor.
void threadRelease() override
Release method.
yarp::dev::ReturnValue 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::ReturnValue getPositionSensorFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame of the specified sensor.
yarp::dev::ReturnValue getNrOfPositionSensors(size_t &num) const override
Get the number of position sensors exposed by this device.
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.