Code Monkey home page Code Monkey logo

ixblue_stdbin_decoder's Introduction

iXblue parsing library for protocol iXblue stdbin

iXblue is a global leader in the design and manufacturing of innovative solutions devoted to navigation, positioning and underwater imaging, shipbuilding, as well as photonics. Using its unique in-house technology, the company offers turnkey solutions to its Civil and Defense customers to carry out their sea, land and space operations with optimum efficiency and reliability. Employing a workforce of 600 people worldwide, iXblue conducts its business with over 60 countries.

The aim of this library is to parse the iXblue standard binary protocol which is the most generic input/output protocol for iXblue inertial system. In this library the protocol is only parsed as output protocol.

Please note that a ROS driver allows to format the protocol data into ROS messages thanks to the parsing library.

iXblue logo


Table of Contents

  1. Protocol
  2. Installation
  3. Implementation
  4. License

Protocol

The protocol iXblue stdbin allows obtaining as much information as possible from inertial system data thanks to its modularity. Here is a non-exhaustive list of data that are proposed in the protocol:

  • Attitude
  • Positions
  • Status
  • Accelerations
  • ...

This information can be given in vessel or geographic frame, compensated or not from gravity and earth rotation. You can find the details of this protocol in the interface library document of your product user manual.

Back to top


Installation

Dependencies

  • Boost - Useful C++ library
  • Gtest - Used to create the unit tests

This librairy is used in our ROS driver that you can find here on Github.

Build the library

If you have not already done so, you can first download the source code in the dedicated library folder:

git clone https://github.com/ixblue/ixblue_stdbin_decoder

Then you can build the code in a build directory from the library folder:

cd ixblue_stdbin_decoder
mkdir build
cd build/
cmake ..
make
sudo make install

Run Unit Tests

If you need to run unit tests, you can do it in your build directory by first enabling the tests:

To run all tests :

cmake -DBUILD_TESTING ..
make test

To run only one test :

./bin/name_of_the_test

Back to top


Usage

This library doesn't manage the communication with the IMU, only the reconstruction and parsing of the stdbin data.

Simple UDP, TCP and serial port usage examples using Boost asio are available in the examples directory.

A more complete usage example can be found in our ROS driver that implements an UDP Client based on Boost asio to receive data from the IMU and publish them as ROS topic.

The entry point of this library is the class StdBinDecoder.

Here is a minimal usage example:

StdBinDecoder decoder;

std::vector<uint8_t> binaryDatas;
// Fill binary data with data received from IMU
size_t bytesRead = mySocket.read(binaryDatas);
try {
  decoder.addNewData(binaryDatas.data(), bytesRead);
  while(decoder.parseNextFrame()) {
    auto navDatas = decoder.getLastNavData();
    // Do something with the nav data
  }
} catch(std::runtime_error& e) {
   // Parsing error are reported by throwing std::runtime_exception.
}

The StdBinDecoder::addNewData adds the newly arrived bytes to the parsed internal buffer. The parser manages the reconstruction of the frames. It can then be used on serial port, TCP and UDP. The method StdBinDecoder::parseNextFrame returns true if a valid frame has been parsed from the internal buffer. The frame content can then be retrieved with the method StdBinDecoder::getLastNavData.

Parsing errors are reported by throwing std::runtime_execpetion.

Back to top


Bug reports:

Feel free to open a Github issue if you encounter any problem with this parser, we will process it as soon as possible.


License

This project is licensed under the MIT License

(The MIT License)

Copyright (c) 2019 iXblue SAS

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Back to top

ixblue_stdbin_decoder's People

Contributors

romainreignier avatar foissac-nicola avatar adrienbarral avatar

ixblue_stdbin_decoder's Issues

Error recovery on parsing

IxBlue stdbin decoder throw exception when errors occur on following function :

  • Data::NavHeader parseHeader(boost::asio::const_buffer& buffer) const;
  • bool haveEnoughBytesToParseHeader();
  • void compareChecksum();

All data frame wasn't cleaned when exception are thrown.
This behavior make parser non-robust on error.

For example, we have a data frame with a bad checksum, followed by a data frame with a good checksum.
Errors were repeated for each data frame received.
Because we call parseNextFrame() function, but internal buffer is same each time caused by miss cleaning.


List of task :

  • Make tests before to validate no error recovery.
  • Fix each tests issues.

Fix error recovery on compare checksum

IxBlue stdbin decoder has error recovery(#1) with one specific case for compare checksum.

This method use internal buffer to wipe each byte described inside telegram size field in data frame.
But my first implementation was false because if data frame can have bad checksum we must not trust telegram size field.

  • Remove internal buffer cleaning by telegram size.
  • Remove only one byte for error recovery.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.