Skip to content

Auke-Dirk/x-IMU-CPP-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

x-IMU-CPP-API

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
Mac ARM Chrubuntu Windows

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.

Code Snippet: how to use the library

// 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);

Coding Style

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.

Build Tool

CMake is used as the main build tool.

For linux:

  1. create a build directory inside "x-IMU-CPP-API"
  2. from this build directory run: cmake ..
  3. from this build directory run: make

Windows:

  1. use cmake gui and generate the source for you visual studio version

Test Tool

CTest can be used for testing. CMake has been configured to provide automated testing.

For linux: make test

Documentation

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.

Ported File List

Orignal Ported Test/Documentation
FixedFloat.cs fixed_float.h fixed_float_test.cpp
PacketEncoding.cs packet_encoding.h packet_encoding_test.cpp
RegisterData.cs register_data.h data_types_test.cpp
DateTimeData.cs datetime_data.h data_types_test.cpp
QuaternionData.cs quaternion_data.h data_types_test.cpp
PacketConstruction.cs packet_construction.h packet_construction_test.cpp
packet_deconstruction.h data_serialization_test.cpp
packet_reader.h data_serialization_test.cpp
xIMUSerial.cs reader_base.h data_serialization_test.cpp
writer_base.h data_serial_writer_test.cpp
CalInertialAndMagneticData.cs cal_iner .. magnetic_data.h data_types_test.cpp
DigitalPortBits.cs digital_port_bits.h data_types_test.cpp
DigitalIOdata.cs digital_io_data.h data_types_test.cpp
PWMOutputData.cs pwm_output_data.h
CalADXL345busData.cs adxl_345_bus_data.h
RawADXL345busData.cs adxl_345_bus_data.h
CalAnalogueInputData.cs analogue_input_data.h
RawAnalogueInputData.cs analogue_input_data.h

About

C++11 port of xioTechnologies/x-IMU-GUI ( c++ ximu )

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published