Cantools
No description available
Install / Use
/learn @aheit/CantoolsREADME
General Information
cantools is a set of libraries and command line tools for handling ASC, BLF, CLG, VSB, MDF, and DBC files from Vector-Informatik and others. The tools can be used to analyze and convert the data to other formats:
- dbcls lists the contents of a DBC file.
- cantomat converts log files in ASC, BLF, CLG, VSB format to a MAT
- file (MATLAB format)
- mdftomat converts log files in MDF format to a MAT file (up to MDF version 3.x)
Some tools are available for testing of converters:
- matdump displays the content of a MAT file as ASCII text
- dbccopy copies a DBC file
The tools 'cantomat' and 'mdftomat' require the package matio, which in turn requires the package hdf5. Support for these tools is optional; either disable them with '--disable-matlab' configure option or make sure hdf5 and matio dependencies are installed first (see instructions below).
Since hdf5 is intended only for native builds, it is recommended to disable the optional tools on cross-compile builds of cantools in order to avoid this dependency https://support.hdfgroup.org/HDF5/faq/compile.html#cross
Shared libraries for parsing and accessing these files are also provided:
- libcandbc, libcanasc, libcanblf, libcanclg, libcanvsb, libcanmdf for parsing of DBC, ASC, BLF, CLG, VSB, MDF files
Installation of hdf5 (cygwin)
Prerequisites: zlib, zlib-devel, bison , flex, make, gcc
matio can be built with libhdf5, here is how to:
- download: wget https://support.hdfgroup.org/ftp/HDF5/current/src/hdf5-1.10.5.tar.bz2
- unpack: tar xjf hdf5-1.10.5.tar.bz2
- build: cd hdf5-1.10.5 ./configure --with-zlib=/usr/include,/lib --prefix=/usr --with-default-api-version=v110 CFLAGS=-std=c99 make CFLAGS=-std=c99 make check
- install: make install
Installation of matio (cygwin)
Prerequisites: autotools, zlib, zlib-devel, make, gcc
- download matio-1.5.17.tar.gz: wget 'http://downloads.sourceforge.net/matio/matio-1.5.17.tar.gz?use_mirror=' -O matio-1.5.17.tar.gz or curl -o matio-1.5.17.tar.gz -L 'http://downloads.sourceforge.net/matio/matio-1.5.17.tar.gz?use_mirror='
- unpack: tar xzf matio-1.5.17.tar.gz
- configure: cd matio-1.5.17 ./configure --with-zlib=/ --with-hdf5=/ --prefix=/usr
- build and install: make ; make install
Installation of zlib, hdf5, matio (linux)
sudo apt-get install cmake gcc libz-dev libmatio-dev flex bison libbison-dev
Building cantools
Prerequisites (cygwin): cmake, bison, flex, make, gcc, zlib, zlib-devel, pkg-config Prerequisites (linux): cmake, libz-dev, libmatio-dev, flex, bison, libbison-dev, make, gcc, pkg-config
git clone https://github.com/aheit/cantools cantools-code cd cantools cmake -S . -B build cmake --build build
CMAKE configuration options (can be combined): cmake -DWITH_MATLAB=OFF (default: ON) - only build tools without MATLAB backend cmake -DWITH_DMALLOC=ON (default: OFF) - build with dmalloc debug library cmake -DBUILD_SHARED_LIBS=OFF (default: ON) - build static libraries instead of shared
Using libcandbc as a library
When cantools is installed, libcandbc is available as a shared library along with its headers and a pkg-config file. To use it in your project:
pkg-config --cflags --libs libcandbc
Or in CMake:
find_package(PkgConfig REQUIRED) pkg_check_modules(CANDBC REQUIRED IMPORTED_TARGET libcandbc) target_link_libraries(myapp PRIVATE PkgConfig::CANDBC)
Installed files: lib/libcandbc.so (shared library) include/cantools/dbcmodel.h (data model types and structures) include/cantools/dbcreader.h (DBC file reader) include/cantools/dbcwriter.h (DBC file writer) include/cantools/dbctypes.h (base type definitions) lib/pkgconfig/libcandbc.pc (pkg-config file)
Related Skills
node-connect
347.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
