Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

eagletrt/telemetria-postprocessing

Repository files navigation

Lint Build Commitizen friendly dependencies Status License Types

eagletrt-telemetria-postprocessing

Postprocess the raw can and gps log of the telemetry of @eagletrt.

Project purpose

This project is an npm package made for the telemetry of eagletrt. The telemetry consists in a c program located in a Raspberry Pi and attached to the canbus of the car and to a rover-gps. Its job is reading all the sensors messages, forwarding them via mqtt and saving them in a local mongodb database. Some can and gps raw logs are also saved by the telemetry. The purpose of this project is having a tool that given those raw logs, obtains the parsed json or csv, with the same parsing system of the telemetry.

How it was made

This project was made with typescript and consists in an npm module that can be used also globally, as a terminal command. It is linted with eslint, bundled with webpack, documented with typedoc and checked by some github actions.

How does it work

The library gets as inputs a can and/or gps raw log. It parses all the lines of both files and computes internally all the parsed messages. After that, it just creates the desidered output file, which could be a csv, a json or a test file that can be added to the telemetry test suites.

How to use it

This module can be actually used both as a local and as a global npm module.

As a local module

Install the module executing:

$ npm install --save @eagletrt/telemetria-postprocessing

Running this script:

const postProcessor = require('@eagletrt/telemetria-postprocessing');

postProcessor.processLogsToCsv('./can.log', './gps.log', './myResultPath');
postProcessor.processLogsToJson('./can.log', './gps.log', './myResultPath');
postProcessor.processLogsForTest('./can.log', './gps.log', './myResultPath');

To see all the options, refer to the api.

As a global module

Install the module with:

$ npm install -g @eagletrt/telemetria-postprocessing

Executing:

$ eagletrt-process csv --can can.log --gps gps.log --out myResultFileName
$ eagletrt-process json --can can.log --gps gps.log --out myResultFileName
$ eagletrt-process test --can can.log --gps gps.log --out myResultFileName

Will have the same results as the examples with the local module.

The options are almost the same as in the api of the local module. To see all the cli options, run:

$ eagletrt-process --help

API

processLogsToCsv

Syntax:

processLogsToCsv(canLogPath, gpsLogPath, outputPath, throwError)

Description:

Generate csv files from a can and/or gps log. The result will be a folder with a csv file for each message.

Parameters:

  • canLogPath: The path to the can log file that you want to parse. It can be null.
  • gpsLogPath: The path to the gps log file that you want to parse. It can be null.* configModel: Optional. The path to the json file containing the config model, used by generators to dynamically generate code about the config parser. The default is config.model.json.
  • outputLogPath: The path to the output file that will be generated. The default value is result. Note that you do not have to specify the file extension because it depends by the function.
  • throwError: If a strict error handling will be used, for instance if a line is corrupted the function will throw an error. The default value is false.

processLogsToJson

Syntax:

processLogsToJson(canLogPath, gpsLogPath, outputPath, throwError)

Description:

Generate a json file from a can and/or gps log.

Parameters:

  • canLogPath: The path to the can log file that you want to parse. It can be null.
  • gpsLogPath: The path to the gps log file that you want to parse. It can be null.* configModel: Optional. The path to the json file containing the config model, used by generators to dynamically generate code about the config parser. The default is config.model.json.
  • outputLogPath: The path to the output file that will be generated. The default value is result. Note that you do not have to specify the file extension because it depends by the function.
  • throwError: If a strict error handling will be used, for instance if a line is corrupted the function will throw an error. The default value is false.

processLogsForTest

Syntax:

processLogsForTest(canLogPath, gpsLogPath, outputPath, throwError)

Description:

Generate a json testing file from a can and/or gps log. It is used for the "general tests suites of the telemetry", when it simulates some can and/or gps logs and needs a .expected.json file with the expected results.

Parameters:

  • canLogPath: The path to the can log file that you want to parse. It can be null.
  • gpsLogPath: The path to the gps log file that you want to parse. It can be null.* configModel: Optional. The path to the json file containing the config model, used by generators to dynamically generate code about the config parser. The default is config.model.json.
  • outputLogPath: The path to the output file that will be generated. The default value is result. Note that you do not have to specify the file extension because it depends by the function.
  • throwError: If a strict error handling will be used, for instance if a line is corrupted the function will throw an error. The default value is false.

Where was it used

This module was used in the telemetry sender repo of eagletrt.

Build

To build for production, using webpack:

npm run bundle

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •