Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CAN-Parsing

Decodes CAN logs (candump / rosbag) into CSV, or into a rosbag with one topic per DBC signal, using DBC files. Every CAN ID in the DBC files is parsed.

Clone

dbc/ is the private repository, linked as a submodule, so clone it along with this one.

git clone --recurse-submodules https://github.com/dev-muuu/CAN-Parsing.git
git submodule update --init       # if you already cloned without the flag

Usage

  1. Put the log under log/<vehicle>/.
log/sportage/<session>/          # session directory holding mcap, candump, etc.
log/sportage/<session>.log       # or a single candump log
  1. Choose the vehicle and session in config/parsing.yaml.
vehicle: sportage       # which car's databases decode it
session: dynamic_260806 # directory name or .log filename under log/<vehicle>/
label:                  # filename tag for the result (may be left empty)

Databases

config/dbc.yaml says what each file in dbc/ is -- which car it belongs to, which bus its frames are on, and any prefix its message names carry:

Sportage_sbgCan.dbc:
  vehicle: sportage             # picked by 'vehicle:' in parsing.yaml / --vehicle
  namespace: rtk                # topic prefix: /rtk/STATUS_01/TIME_STAMP
  strip_prefix: SBG_ECAN_MSG_   # SBG_ECAN_MSG_STATUS_01 -> STATUS_01

Add a file to dbc/, add it here too. A database that is not listed still works: the vehicle is read from the name before the first _, the namespace from rtcan / sbg in the filename, and the run says it guessed.

  1. Run a parser from src/.
cd src
./can_parsing/candump2csv.py      # candump log -> wide CSV
./can_parsing/rosbag2csv.py       # rosbag      -> wide CSV
./can_parsing/candump2topics.py   # candump log -> rosbag, one topic per signal
./can_parsing/rosbag2topics.py    # rosbag      -> rosbag, one topic per signal

Results land in parse_results/<vehicle>_<session>/: csv/ for the tables, bag/ for the signal bags.

Signal topics

rosbag2topics.py reads the recorded can_msgs/Frame topic and writes a new bag in which every DBC signal is its own std_msgs/Float64 topic, named after the database. candump2topics.py writes the same bag from a candump log, for a session recorded without one:

/ccan/FB_EAIT_SPD/WHL_SPD_FL     <- BO_ FB_EAIT_SPD, SG_ WHL_SPD_FL
/rtk/LatitudeLongitude/PosLon

The car logs several buses onto one ROS topic, so the namespace says which one a signal came from. Which bus a frame is on is whatever config/dbc.yaml gives the database that describes it.

About

DBC-based CAN data (candump, rosbag) parsing repository

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages