Git Product home page Git Product logo

px4-ulog-rs's Introduction

PX4 Ulog file parser for Rust

NOTE: Before 1.0 we will not follow semantic versioning.

A ULog file parser for Rust written with a small memory footprint. Reading the file is implemented in a streaming manner, where possible.

Contributing

Design goals

The API should be streaming, meaning:

  • Store minimum possible amount of data in memory
  • Everything should be implemented as iterators
  • Data should be read directly from file, where possible

Other goals are:

  • Don't panic
  • Don't use unsafe

px4-ulog-rs's People

Contributors

bkueng avatar bwstearns avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

bwstearns

px4-ulog-rs's Issues

Failed to read vector of floats

For the data chunk

data = [217, 135, 153, 12, 0, 0, 0, 0, 
        251, 133, 153, 12, 0, 0, 0, 0, 
        231, 207, 50, 49, 
        64, 131, 213, 36, 
        215, 182, 109, 50, 
        247, 152, 146, 50, 
        0, 0, 192, 127, 
        0, 0, 192, 127, 
        0, 0, 192, 127, 
        0, 0, 192, 127, 
        0, 0, 192, 127, 
        0, 0, 192, 127, 
        0, 0, 192, 127, 
        0, 0, 192, 127, 
        0, 0]

and field description

[('uint64_t', 1, 'timestamp'),
 ('uint64_t', 1, 'timestamp_sample'),
 ('float', 12, 'control'),
 ('uint16_t', 1, 'reversible_flags'),
 ('uint8_t', 6, '_padding0')]

This library only outputs the first two items from the field description in

println!("{} at {}: {:?}", item.name(), item.index(), item.data());

The extracted format from this library is

["uint64_t timestamp", "uint64_t timestamp_sample", "float[12] control", "uint16_t reversible_flags", "uint8_t[6] _padding0", ""]

Here is how I correctly parse them

import struct

timestamp = struct.unpack('<Q', bytes([217, 135, 153, 12, 0, 0, 0, 0]))[0]
timestamp_sample = struct.unpack('<Q', bytes([251, 133, 153, 12, 0, 0, 0, 0]))[0]
control_0 = struct.unpack('<f', bytes([231, 207, 50, 49]))
control_1 = struct.unpack('<f', bytes([64, 131, 213, 36]))
control_2 = struct.unpack('<f', bytes([215, 182, 109, 50]))
control_3 = struct.unpack('<f', bytes([247, 152, 146, 50]))
control_4 = np.nan 
# ...
control_11 = np.nan 

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.