iCub-main
Loading...
Searching...
No Matches
XSensMTx.h
Go to the documentation of this file.
1// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2
3/*
4 * Copyright (C) 2006 Radu Bogdan Rusu, Alexis Maldonado
5 * CopyPolicy: Released under the terms of the GNU GPL v2.0.
6 *
7 */
8
9#ifndef __XSENSMTX__
10#define __XSENSMTX__
11
12#include "MTComm.h"
13#include <yarp/dev/DeviceDriver.h>
14#include <yarp/dev/IGenericSensor.h>
15#include <yarp/dev/MultipleAnalogSensorsInterfaces.h>
16#include <yarp/os/Stamp.h>
17#include <yarp/dev/IPreciselyTimed.h>
18#include <string>
19
20namespace yarp{
21 namespace dev{
22 class XSensMTx;
23 }
24}
25
27{
28 std::string comPortString;
29 short comPort;
30};
31
41class yarp::dev::XSensMTx : public yarp::dev::IGenericSensor,
42 public yarp::dev::IPreciselyTimed,
43 public DeviceDriver,
44 public yarp::dev::IThreeAxisGyroscopes,
45 public yarp::dev::IThreeAxisLinearAccelerometers,
46 public yarp::dev::IThreeAxisMagnetometers,
47 public yarp::dev::IOrientationSensors
48{
49public:
50 XSensMTx();
51 virtual ~XSensMTx();
52
53 // IGenericSensor interface.
54 bool read(yarp::sig::Vector &out) override;
55 bool getChannels(int *nc) override;
56 bool open(yarp::os::Searchable &config) override;
57 bool calibrate(int ch, double v) override;
58 bool close() override;
59
60 yarp::os::Stamp getLastInputStamp() override;
61
62 /* IThreeAxisGyroscopes methods */
67 size_t getNrOfThreeAxisGyroscopes() const override;
68
74 yarp::dev::MAS_status getThreeAxisGyroscopeStatus(size_t sens_index) const override;
75
82 bool getThreeAxisGyroscopeName(size_t sens_index, std::string &name) const override;
83
90 bool getThreeAxisGyroscopeFrameName(size_t sens_index, std::string &frameName) const override;
91
99 bool getThreeAxisGyroscopeMeasure(size_t sens_index, yarp::sig::Vector& out, double& timestamp) const override;
100
101 /* IThreeAxisLinearAccelerometers methods */
106 size_t getNrOfThreeAxisLinearAccelerometers() const override;
107
113 yarp::dev::MAS_status getThreeAxisLinearAccelerometerStatus(size_t sens_index) const override;
114
121 bool getThreeAxisLinearAccelerometerName(size_t sens_index, std::string &name) const override;
122
129 bool getThreeAxisLinearAccelerometerFrameName(size_t sens_index, std::string &frameName) const override;
130
138 bool getThreeAxisLinearAccelerometerMeasure(size_t sens_index, yarp::sig::Vector& out, double& timestamp) const override;
139
140 /* IThreeAxisMagnetometers methods */
145 size_t getNrOfThreeAxisMagnetometers() const override;
146
152 yarp::dev::MAS_status getThreeAxisMagnetometerStatus(size_t sens_index) const override;
153
160 bool getThreeAxisMagnetometerName(size_t sens_index, std::string &name) const override;
161
168 bool getThreeAxisMagnetometerFrameName(size_t sens_index, std::string &frameName) const override;
169
177 bool getThreeAxisMagnetometerMeasure(size_t sens_index, yarp::sig::Vector& out, double& timestamp) const override;
178
179 /* IOrientationSensors methods */
184 size_t getNrOfOrientationSensors() const override;
185
191 yarp::dev::MAS_status getOrientationSensorStatus(size_t sens_index) const override;
192
199 bool getOrientationSensorName(size_t sens_index, std::string &name) const override;
200
207 bool getOrientationSensorFrameName(size_t sens_index, std::string &frameName) const override;
208
216 bool getOrientationSensorMeasureAsRollPitchYaw(size_t sens_index, yarp::sig::Vector& rpy, double& timestamp) const override;
217
218 // Open the device
219 bool open(const XSensMTxParameters &par);
220
221private:
222 bool start();
223 bool stop();
224
225 yarp::dev::MAS_status genericGetStatus(size_t sens_index) const;
226 bool genericGetSensorName(size_t sens_index, std::string &name) const;
227 bool genericGetFrameName(size_t sens_index, std::string &frameName) const;
228 bool genericGetMeasure(size_t sens_index, yarp::sig::Vector& out, double& timestamp, size_t startIdx) const;
229 void *system_resources;
230 int nchannels;
231 std::string m_sensorName;
232 std::string m_frameName;
233 yarp::os::Stamp lastStamp;
234};
235
236
237#endif
xsensmtx : driver for XSens's MTx IMU unit.
Definition XSensMTx.h:48
bool getOrientationSensorMeasureAsRollPitchYaw(size_t sens_index, yarp::sig::Vector &rpy, double &timestamp) const override
Get orientation sensor measurements.
Definition XSensMTx.cpp:419
bool getThreeAxisGyroscopeMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const override
Get three axis gyroscope measurements.
Definition XSensMTx.cpp:394
bool getThreeAxisGyroscopeFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame in which three axis gyroscope measurements are expressed.
Definition XSensMTx.cpp:389
size_t getNrOfThreeAxisMagnetometers() const override
Get the number of three axis magnetometers in the device.
Definition XSensMTx.cpp:424
bool close() override
Definition XSensMTx.cpp:315
size_t getNrOfThreeAxisGyroscopes() const override
Get the number of three axis gyroscopes in the device.
Definition XSensMTx.cpp:373
yarp::dev::MAS_status getThreeAxisMagnetometerStatus(size_t sens_index) const override
Get the status of three axis magnetometer.
Definition XSensMTx.cpp:429
bool getThreeAxisLinearAccelerometerMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const override
Get three axis linear accelerometer measurements.
Definition XSensMTx.cpp:367
bool getThreeAxisMagnetometerName(size_t sens_index, std::string &name) const override
Get the name of three axis magnetometer.
Definition XSensMTx.cpp:434
size_t getNrOfThreeAxisLinearAccelerometers() const override
Get the number of three axis linear accelerometers in the device.
Definition XSensMTx.cpp:346
bool getChannels(int *nc) override
Definition XSensMTx.cpp:173
bool getThreeAxisLinearAccelerometerFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame in which three axis linear accelerometer measurements are expressed.
Definition XSensMTx.cpp:362
yarp::os::Stamp getLastInputStamp() override
Definition XSensMTx.cpp:340
bool getThreeAxisLinearAccelerometerName(size_t sens_index, std::string &name) const override
Get the name of three axis linear accelerometer.
Definition XSensMTx.cpp:357
bool read(yarp::sig::Vector &out) override
Definition XSensMTx.cpp:151
bool open(yarp::os::Searchable &config) override
Definition XSensMTx.cpp:207
bool getOrientationSensorName(size_t sens_index, std::string &name) const override
Get the name of orientation sensor.
Definition XSensMTx.cpp:409
size_t getNrOfOrientationSensors() const override
Get the number of orientation sensors in the device.
Definition XSensMTx.cpp:399
bool getThreeAxisMagnetometerMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const override
Get three axis magnetometer measurements.
Definition XSensMTx.cpp:444
bool calibrate(int ch, double v) override
Definition XSensMTx.cpp:179
yarp::dev::MAS_status getThreeAxisGyroscopeStatus(size_t sens_index) const override
Get the status of three axis gyroscope.
Definition XSensMTx.cpp:379
bool getThreeAxisGyroscopeName(size_t sens_index, std::string &name) const override
Get the name of three axis gyroscope.
Definition XSensMTx.cpp:384
XSensMTx()
Driver for XSens's MTx IMU unit.
Definition XSensMTx.cpp:134
yarp::dev::MAS_status getThreeAxisLinearAccelerometerStatus(size_t sens_index) const override
Get the status of three axis linear accelerometer.
Definition XSensMTx.cpp:352
bool getOrientationSensorFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame in which orientation sensor measurements are expressed.
Definition XSensMTx.cpp:414
bool getThreeAxisMagnetometerFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame in which three axis magnetometer measurements are expressed.
Definition XSensMTx.cpp:439
yarp::dev::MAS_status getOrientationSensorStatus(size_t sens_index) const override
Get the status of orientation sensor.
Definition XSensMTx.cpp:404
Copyright (C) 2008 RobotCub Consortium.
out
Definition sine.m:8
std::string comPortString
Definition 3dm_gx3.h:41