|
imu_imar
|
#include <Imar.hpp>
Public Member Functions | |
| iVRU_BB () | |
| ~iVRU_BB () | |
| void | welcome () |
| Dummy Welcome method. More... | |
| bool | open_port (const char *name) |
| This method opens a serial port. More... | |
| bool | init_serial (const char *name, const int bauds) |
| This method opens and configures a serial port. More... | |
| bool | write_serial (char *command, int nbytes) |
| This method write values in the serial port. More... | |
| bool | read_serial (unsigned char *bufferpr, int nbytes) |
| Function to read values from a serial port connection. More... | |
| bool | close_port () |
| Function to close an open serial port connection. More... | |
| int | getDescriptor () |
| Returns file decriptor. More... | |
| int | cbIsFull () |
| Returns if the circular buffer is full. More... | |
| int | cbIsEmpty () |
| Returns if the circular buffer is Empty. More... | |
| bool | cbIsSynchronized () |
| Returns if the driver is Synchronized. More... | |
| void | cbWritePckg (int nbytes, unsigned char *values) |
| It writes information in the Cicular Buffer. More... | |
| bool | cbSynchronize () |
| It synchronizes the circular buffer. More... | |
| bool | cbCopyPckg (unsigned char *pckg, int len) |
| It reads a information from the circular buffer. More... | |
| bool | cbReadValues () |
| It reads a IMU packages. More... | |
| void | cbPrintValues () |
| It prints the values stored in ImuData. More... | |
| int | cbNumberElements () |
| It gives the number of elements stored in the Circular Buffer. More... | |
| int | getPacketCounter () |
| It gives the package counter. More... | |
| Eigen::Matrix< double, imu_imar::NUMAXIS, 1 > | getAccelerometers () |
| It gets the Accelerometers values. More... | |
| Eigen::Matrix< double, imu_imar::NUMAXIS, 1 > | getGyroscopes () |
| It gets the Gyroscopes values. More... | |
| Eigen::Quaternion< double > | getAttitude () |
| It gets the attitude or orientation. More... | |
| void | cbCalculateAccIntegration (const float omega) |
| Eigen::Matrix< double, imu_imar::NUMAXIS, 1 > | getVelocity () |
| Eigen::Matrix< double, imu_imar::NUMAXIS, 1 > | getPosition () |
| unsigned short | crc16 (unsigned char *data_p, int length) |
| unsigned int | Crc16_0 (unsigned char const *pByte, unsigned Size) |
| void | cbReset () |
| imu_imar::iVRU_BB::iVRU_BB | ( | ) |
Print a welcome to stdout
Init the circular Buffer
| imu_imar::iVRU_BB::~iVRU_BB | ( | ) |
| void imu_imar::iVRU_BB::cbCalculateAccIntegration | ( | const float | omega | ) |
Get the Acceleration
Remove the first elements from the buffer
Compute the FFT
Convert Acc to Displacement
Convert Acc to Velocity
Calculate the Inverse FFT
Fill the Vel and Displacement
| bool imu_imar::iVRU_BB::cbCopyPckg | ( | unsigned char * | pckg, |
| int | len | ||
| ) |
It reads a information from the circular buffer.
The method reads raw information from the circular buffer.
| [out] | *pckg | pointer to buffer. |
| [in] | len | size of the buffer |
| int imu_imar::iVRU_BB::cbIsEmpty | ( | ) |
Returns if the circular buffer is Empty.
| int imu_imar::iVRU_BB::cbIsFull | ( | ) |
Returns if the circular buffer is full.
| bool imu_imar::iVRU_BB::cbIsSynchronized | ( | ) |
Returns if the driver is Synchronized.
When the read pointer of the cicular buffer is synchronized with the SyncWord of the stream the driver is synchronized.
| int imu_imar::iVRU_BB::cbNumberElements | ( | ) |
It gives the number of elements stored in the Circular Buffer.
From read till the end
| void imu_imar::iVRU_BB::cbPrintValues | ( | ) |
It prints the values stored in ImuData.
Inertial Values
| bool imu_imar::iVRU_BB::cbReadValues | ( | ) |
It reads a IMU packages.
The method reads the information in the circular buffer and gives the inertial information. It needs to be previously synchronized otherwise the values would be wrong. The values are stored in the ImuData variable.
Pckg counter
Pckg length
Accelerometers X
Accelerometers Y
Accelerometers Z
Gyroscope X
Gyroscope Y
Gyroscope Z
Roll
Pitch
Yaw
Read the time field
Push the accelerometers readings to the FFT buffer
Check if the buffer is Synchronize
| void imu_imar::iVRU_BB::cbReset | ( | ) |
| bool imu_imar::iVRU_BB::cbSynchronize | ( | ) |
It synchronizes the circular buffer.
The method synchronizes the cicular buffer seeking for the Synchronization Word defined by SYNC_WORD
Jump one package ahead to be fully sync
The app must read new values again
| void imu_imar::iVRU_BB::cbWritePckg | ( | int | nbytes, |
| unsigned char * | values | ||
| ) |
It writes information in the Cicular Buffer.
The values previously read in the serial port are writen in the Circular Buffer.
| [in] | nbytes | number of bytes to read. |
| [in] | values | pointer to char. Buffer to store the values read |
| bool imu_imar::iVRU_BB::close_port | ( | ) |
Function to close an open serial port connection.
This function closes the serial port connection.
Returns OK if no errors
| unsigned short imu_imar::iVRU_BB::crc16 | ( | unsigned char * | data_p, |
| int | length | ||
| ) |
| unsigned int imu_imar::iVRU_BB::Crc16_0 | ( | unsigned char const * | pByte, |
| unsigned | Size | ||
| ) |
| Eigen::Matrix< double, imu_imar::NUMAXIS, 1 > imu_imar::iVRU_BB::getAccelerometers | ( | ) |
It gets the Accelerometers values.
| Eigen::Quaternion< double > imu_imar::iVRU_BB::getAttitude | ( | ) |
It gets the attitude or orientation.
| int imu_imar::iVRU_BB::getDescriptor | ( | ) |
Returns file decriptor.
| Eigen::Matrix< double, imu_imar::NUMAXIS, 1 > imu_imar::iVRU_BB::getGyroscopes | ( | ) |
It gets the Gyroscopes values.
| int imu_imar::iVRU_BB::getPacketCounter | ( | ) |
It gives the package counter.
| Eigen::Matrix< double, 3, 1 > imu_imar::iVRU_BB::getPosition | ( | ) |
| Eigen::Matrix< double, 3, 1 > imu_imar::iVRU_BB::getVelocity | ( | ) |
| bool imu_imar::iVRU_BB::init_serial | ( | const char * | name, |
| const int | bauds | ||
| ) |
This method opens and configures a serial port.
The method opens a serial port with descriptor file name and the bauds rate specified. The serial port is open set to no parity cheking 8databits, 1 stopbit and no hardware protocol.
| [in] | *name | pointer to char (C type string) with the descriptor file name |
| [out] | bauds | integer value with the baud rate |
Get the current options for the port
Set the baud rates to 57600
Input flags: Disable input processing: no parity checking or marking, no signals from break conditions, do not convert line feeds or carriage returns, and do not map upper case to lower case.
no output processing
don't convert line feeds
Select 8 data bits
| bool imu_imar::iVRU_BB::open_port | ( | const char * | name | ) |
This method opens a serial port.
The method opens a serial port with descriptor file name specified in the paramaters.
| [in] | *name | pointer to char (C type string) with the descriptor file name |
| bool imu_imar::iVRU_BB::read_serial | ( | unsigned char * | bufferpr, |
| int | nbytes | ||
| ) |
Function to read values from a serial port connection.
This function read nbytes from the open serial port
| [out] | bufferpr | pointer to char. Buffer to store the values read |
| [in] | nbytes | number of bytes to read. |
| void imu_imar::iVRU_BB::welcome | ( | ) |
Dummy Welcome method.
Dummy Welcome methods.
| bool imu_imar::iVRU_BB::write_serial | ( | char * | command, |
| int | nbytes | ||
| ) |
This method write values in the serial port.
Write values in the serial port
| [in] | *commad | pointer to array of values |
| [out] | nbytes | number of byte to write |
1.8.13