C++11 port of xioTechnologies API ( c++ ximu ). This xioTechnologies project is also hosted on github and can be found here. The latest version of x-IMU-API has build in support for Qt.
Mac OS X | ARM Chrubuntu | Windows 7 |
---|---|---|
QtSerialPort (>= Qt 5.1.x)
If the requirements are met, the library is extended --"ximu::SerialPort" with Qt's serialport functionality. Next to this a serialport (Qt) gui and console program.
QOpenGLWidget (>=Qt 5.4.x)
When then requirements for the QOpenGLWidget are met, a test is added showing a rotating cube. And a plugin '3D Cube' becomes available.
// Whenever the Qt::SerialPort is available
class MyClass {
ximu::SerialPort _sp;
void onQuaternionRecieved(const ximu::QuaternionData& q){...}
};
...
// registering for data is based on signals/slots from Qt
connect(&_sp, &ximu::SerialPort::quaternion, this, &MyClass::onQuaternionRecieved);
...
// Create your own Ximu class by extending the two available
// bases. ReaderBase for reading data from the ximu and WriterBase
// for writing to the ximu device.
class XimuIO : public ximu::ReaderBase, public ximu::WriterBase {
..
IOPort port; // os specific not included (Except if Qt5::SerialPort 5.1.x) is found
// often a callback is presented from the IO port
void IOPortCallback(char* data, int length) {
// two template methods are provided, see reader_base.h
fill(data, length);
read();
}
// forward encoded data to the IOPort
virtual void sendSerialBuffer(std::vector<unsigned char>& data) {
..
port.write(data..
}
// implement reciever functions for those datatypes that you are interested in
virtual void recievedQuaternionData(ximu::QuaternionData& q) {
..
}
virtual void recievedCalInertialAndMagneticData(
ximu::CalInertialAndMagneticData& data){
..
}
};
XimuIO xio;
// writing
xio.sendCommandPacket(ximu::CommandCodes::ALGORITHM_CLEAR_TARE);
xio.sendCommandPacket(ximu::CommandCodes::ALGORITHM_INITIALISE_THEN_TARE);
..
ximu::DateTimeData dt(..,..);
xio.sendWriteDateTimePacket(dt);
This project holds the Google code style guidelines. Make sure that you test your code for code-style before you push, tools/scripts/plugins such as:
can be of great confiniance.
CMake is used as the main build tool.
For linux:
- create a build directory inside "x-IMU-CPP-API"
- from this build directory run: cmake ..
- from this build directory run: make
Windows:
- use cmake gui and generate the source for you visual studio version
CTest can be used for testing. CMake has been configured to provide automated testing.
For linux: make test
All functionality should come with a unit test, this test should be written such that it serves as an example/documenation for the developer. The Ported File List section lists/links what functionality already has been ported alongside its test/documentation.