BTK  0.3dev.0
Open-source library to visualize/process biomechanical data
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
btk::IMU Class Reference

Container of analog channels representing an inertial measurement unit (IMU). More...

#include <btkIMU.h>

Inheritance diagram for btk::IMU:
Inheritance graph
[legend]

Public Types

typedef Eigen::Matrix< double,
Eigen::Dynamic, Eigen::Dynamic > 
CalMatrix
 
typedef btkSharedPtr< const IMUConstPointer
 
typedef btkNullPtr< IMUNullPointer
 
typedef btkSharedPtr< IMUPointer
 
typedef Eigen::Matrix< double, 3, 3 > Rotation
 
- Public Types inherited from btk::DataObjectLabeled
typedef btkSharedPtr< const
DataObjectLabeled
ConstPointer
 
typedef btkSharedPtr
< DataObjectLabeled
Pointer
 
- Public Types inherited from btk::DataObject
typedef btkSharedPtr< const
DataObject
ConstPointer
 
typedef btkNullPtr< DataObjectNullPointer
 
typedef btkSharedPtr< DataObjectPointer
 
- Public Types inherited from btk::Object
typedef btkSharedPtr< const
Object
ConstPointer
 
typedef btkSharedPtr< ObjectPointer
 

Public Member Functions

Pointer Clone () const
 
Analog::Pointer GetAccelerometerX ()
 
Analog::Pointer GetAccelerometerY ()
 
Analog::Pointer GetAccelerometerZ ()
 
CalMatrixGetCalMatrix ()
 
const CalMatrixGetCalMatrix () const
 
Analog::Pointer GetChannel (int id)
 
Analog::ConstPointer GetChannel (int id) const
 
Analog::Pointer GetChannel (const std::string &label)
 
Analog::ConstPointer GetChannel (const std::string &label) const
 
int GetChannelNumber () const
 
AnalogCollection::Pointer GetChannels ()
 
int GetFrameNumber () const
 
double GetFrequency () const
 
Analog::Pointer GetGyroscopeX ()
 
Analog::Pointer GetGyroscopeY ()
 
Analog::Pointer GetGyroscopeZ ()
 
int GetType () const
 
void Rotate (const Rotation &R)
 
void SetCalMatrix (const CalMatrix &cal)
 
void SetChannel (int id, Analog::Pointer channel)
 
void SetChannels (Analog::Pointer accX, Analog::Pointer accY, Analog::Pointer accZ, Analog::Pointer gyroX, Analog::Pointer gyroY, Analog::Pointer gyroZ)
 
void SetFrameNumber (int fn)
 
void SetFrequency (double f)
 
virtual ~IMU ()
 
- Public Member Functions inherited from btk::DataObjectLabeled
const std::string & GetDescription () const
 
const std::string & GetLabel () const
 
virtual void SetDescription (const std::string &description)
 
virtual void SetLabel (const std::string &label)
 
- Public Member Functions inherited from btk::DataObject
DataObjectGetParent () const
 
bool HasParent () const
 
void Modified ()
 
void SetParent (DataObject *parent)
 
void Update ()
 
- Public Member Functions inherited from btk::Object
unsigned long int GetTimestamp () const
 

Static Public Member Functions

static NullPointer Null ()
 
- Static Public Member Functions inherited from btk::DataObject
static NullPointer Null ()
 

Protected Member Functions

 IMU (const std::string &label, const std::string &desc, bool init)
 
 IMU (const IMU &toCopy)
 
- Protected Member Functions inherited from btk::DataObjectLabeled
 DataObjectLabeled (const std::string &label="", const std::string &description="")
 
 DataObjectLabeled (const DataObjectLabeled &toCopy)
 
- Protected Member Functions inherited from btk::DataObject
 DataObject ()
 
 DataObject (const DataObject &toCopy)
 
virtual ~DataObject ()
 
- Protected Member Functions inherited from btk::Object
 Object ()
 
 Object (const Object &toCopy)
 
virtual ~Object ()
 

Protected Attributes

int m_Type
 
- Protected Attributes inherited from btk::DataObjectLabeled
std::string m_Description
 
std::string m_Label
 
- Protected Attributes inherited from btk::Object
unsigned long int m_Timestamp
 

Detailed Description

Container of analog channels representing an inertial measurement unit (IMU).

This class proposes to store any number of analog channels but the 6 first channels could be used for 3 accelerometers and 3 gyroscopes as some convenient methods are proposed in this way (see SetChannels(), GetAccelerometerX(), GetAccelerometerY(), GetAccelerometerZ(), GetGyroscopeX(), GetGyroscopeY(), GetGyroscopeZ()).

The storage of the channel is done using an ID and not an array index. You can then use the same ID for some kind of sensor even if other are missing (i.e. IMU with accelerometers disabled or configured with 1 acc, and 2 gyros., etc.).

Note: This class is still experimental and could be modified in the next release.

Member Typedef Documentation

Type which represents a possible calibration matrix used with the IMU to aligne sensors axes together (gyrosocope axes and accelerometer axes).

Smart pointer associated with a const IMU object.

Special null pointer associated with a IMU object. This type should be used only internally to test the nullity of a smart pointer. See the static method Null() instead.

Smart pointer associated with a IMU object.

Type definition for Eigen 3x3 rotation matrix (of double).

Constructor & Destructor Documentation

btk::IMU::~IMU ( )
inlinevirtual

Empty destructor.

btk::IMU::IMU ( const std::string &  label,
const std::string &  desc,
bool  init 
)
protected

Constructor

btk::IMU::IMU ( const IMU toCopy)
protected

Constructor of copy

Member Function Documentation

Pointer btk::IMU::Clone ( ) const
inline

Deep copy of the current object.

Analog::Pointer btk::IMU::GetAccelerometerX ( )
inline

Convenient method to return the analog channel with the ID 0 (which should correspond to an accelerometer measuring data on the X axis of the IMU).

Analog::Pointer btk::IMU::GetAccelerometerY ( )
inline

Convenient method to return the analog channel with the ID 1 (which should correspond to an accelerometer measuring data on the Y axis of the IMU).

Analog::Pointer btk::IMU::GetAccelerometerZ ( )
inline

Convenient method to return the analog channel with the ID 2 (which should correspond to an accelerometer measuring data on the Z axis of the IMU).

CalMatrix & btk::IMU::GetCalMatrix ( )
inline

Returns calibration marix.

Warning
If you modify the object's content with this function, don't forget to call the Modified() method.
const CalMatrix & btk::IMU::GetCalMatrix ( ) const
inline

Returns the calibration matrix.

Analog::Pointer btk::IMU::GetChannel ( int  id)

Returns the analog channel with the given ID. If there is no analog channel with the given ID, then an exception is thrown.

Analog::ConstPointer btk::IMU::GetChannel ( int  id) const

Returns the analog channel with the given ID. If there is no analog channel with the given ID, then an exception is thrown.

Analog::Pointer btk::IMU::GetChannel ( const std::string &  label)

Returns the analog channel with the given label. If there is no analog channel with the given label, then an exception is thrown.

Analog::ConstPointer btk::IMU::GetChannel ( const std::string &  label) const

Returns the analog channel with the given label. If there is no analog channel with the given label, then an exception is thrown.

int btk::IMU::GetChannelNumber ( ) const
inline

Returns the number of channels used by the IMU.

AnalogCollection::Pointer btk::IMU::GetChannels ( )

Returns the analog channels of the IMU in a collection. The analog channels are pushed in the collection by using their ID.

int btk::IMU::GetFrameNumber ( ) const
inline

Returns the number of frames set in this IMU.

double btk::IMU::GetFrequency ( ) const
inline

Returns the frequency set to the IMU. (by default it is 0 Hz).

Analog::Pointer btk::IMU::GetGyroscopeX ( )
inline

Convenient method to return the analog channel with the ID 3 (which should correspond to a gyroscope measuring data on the X axis of the IMU).

Analog::Pointer btk::IMU::GetGyroscopeY ( )
inline

Convenient method to return the analog channel with the ID 4 (which should correspond to a gyroscope measuring data on the Y axis of the IMU).

Analog::Pointer btk::IMU::GetGyroscopeZ ( )
inline

Convenient method to return the analog channel with the ID 5 (which should correspond to a gyroscope measuring data on the Z axis of the IMU).

int btk::IMU::GetType ( ) const
inline

Returns the type of the IMU.

static NullPointer btk::IMU::Null ( )
inlinestatic

Static function to return a null pointer.

Note
This static method should be used only to test if a shared ponter is null or not. It is advised to call the method without parenthesis as special (in)equality operator are implemented to use a function pointer. See the description of the class NullPtr for an example.
void btk::IMU::Rotate ( const Rotation R)

Convenient method to rotate the analog channels with the IDs 0-5. This method handles the case where some of these analog channels are missing.

void btk::IMU::SetCalMatrix ( const CalMatrix cal)

Sets the calibration matrix. Assigning a calibration matrix won't change sensors' values. This is only an informative member to know what is the orientation between the sensors. However the filter btk::IMUsExtractor can adapt sensors' values to have aligned measurements.

void btk::IMU::SetChannel ( int  id,
Analog::Pointer  channel 
)

Sets an analog channel to the given ID. If an analog channel is already set to this ID, then it is replaced.

Warning
: This function assumes that the number of frames corresponds to the number of frames set in the IMU. You can set afterward the number of frames by using the method SetFrameNumber().
void btk::IMU::SetChannels ( Analog::Pointer  accX,
Analog::Pointer  accY,
Analog::Pointer  accZ,
Analog::Pointer  gyroX,
Analog::Pointer  gyroY,
Analog::Pointer  gyroZ 
)

Sets the 6 first channels of the IMUs with the analog channels accX, accY, accZ, gyroX, gyroY, gyroZ.

Warning
: This function assumes that the number of frames corresponds to the number of frames set in the IMU. You can set afterward the number of frames by using the method SetFrameNumber().
void btk::IMU::SetFrameNumber ( int  fn)

Set the number of frames for the IMU and modify also the number of frames for the channels.

void btk::IMU::SetFrequency ( double  f)

Sets the acquisition sample rate associated to the IMU.

Member Data Documentation

btk::IMU::m_Type
protected

Type of the IMU. Used to determine necessary data for a particular IMU sensor.