{"id":20507355,"url":"https://github.com/kiranj26/can-log-parser","last_synced_at":"2025-04-13T21:52:30.053Z","repository":{"id":249196326,"uuid":"830732879","full_name":"kiranj26/CAN-Log-Parser","owner":"kiranj26","description":"This repository contains a Python-based tool to parse DBC formatted CAN log files and plot the signals. It leverages cantools for parsing DBC files and matplotlib for plotting signals, providing an easy way to visualize CAN signal data.","archived":false,"fork":false,"pushed_at":"2024-11-09T02:47:28.000Z","size":1512,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T12:13:14.809Z","etag":null,"topics":["automotive","can","can-bus","can-bus-simulation","can-sniffer","canbus","cantools","communication-protocol","embedded","kvaser","kvasercanking","logger","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kiranj26.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-18T21:54:43.000Z","updated_at":"2024-11-09T02:47:33.000Z","dependencies_parsed_at":"2024-07-23T05:50:59.320Z","dependency_job_id":null,"html_url":"https://github.com/kiranj26/CAN-Log-Parser","commit_stats":null,"previous_names":["kiranj26/can-log-parser"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiranj26%2FCAN-Log-Parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiranj26%2FCAN-Log-Parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiranj26%2FCAN-Log-Parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiranj26%2FCAN-Log-Parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kiranj26","download_url":"https://codeload.github.com/kiranj26/CAN-Log-Parser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248788867,"owners_count":21161726,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automotive","can","can-bus","can-bus-simulation","can-sniffer","canbus","cantools","communication-protocol","embedded","kvaser","kvasercanking","logger","python"],"created_at":"2024-11-15T20:13:38.707Z","updated_at":"2025-04-13T21:52:30.033Z","avatar_url":"https://github.com/kiranj26.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CAN Log Parser\n![Build Status](https://github.com/kiranj26/CAN-Log-Parser/actions/workflows/ci.yml/badge.svg)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/4a476526a37145f2922f58a6f903ff27)](https://app.codacy.com/gh/kiranj26/CAN-Log-Parser/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_grade)\n![Flake8 Linting](https://img.shields.io/badge/flake8-linting-brightgreen)\n![Python Version](https://img.shields.io/badge/python-3.12-blue)\n![License](https://img.shields.io/github/license/kiranj26/CAN-Log-Parser)    \nThis repository contains a Python-based tool to parse DBC formatted CAN log files and plot the signals. It leverages `cantools` for parsing DBC files and `matplotlib` for plotting signals, providing an easy way to visualize CAN signal data.\n\n## Features\n\n- Parse DBC files to extract signal definitions\n- Read and parse CAN log files\n- Decode signals from CAN messages\n- Plot the decoded signals\n\n## Requirements\n\nAll required packages are listed in the `requirements.txt` file.\n\n- Python 3.6 or higher\n- cantools\n- matplotlib\n\n## Installation\n\n1. Clone the repository:\n\n    ```bash\n    git clone https://github.com/kiranj26/CAN-Log-Parser.git\n    cd CAN-Log-Parser\n    ```\n\n2. Install the required dependencies:\n\n    ```bash\n    pip install -r requirements.txt\n    ```\n\n## Usage\n\n1. Place your DBC file and log file in the `data/` directory.\n\n2. Run the main script with the appropriate arguments:\n\n    ```bash\n    python src/main.py PATH_TO_LOG/example.txt PATH_TO_DBC/example.dbc SignalName StartTime EndTime\n    ```\n\nExample:\n\n    ```bash\n    python src/main.py ../data/test_log.txt ../data/test.dbc SAF_SpeedTest 43.2 45.6\n    ```\n\n## Repository Structure\n\n- `src/`: Contains the main script and related files.\n  - `main.py`: Main script to run the tool.\n- `data/`: Directory to place your DBC and log files.\n- `requirements.txt`: List of dependencies.\n\n## Script Description\n\n### parse_dbc(file_path)\n\nParses the DBC file located at `file_path`.\n\n### parse_log(db, log_file_path)\n\nParses the log file located at `log_file_path` using the parsed DBC data.\n\n### process_message(db, message_lines, parsed_data)\n\nProcesses a single CAN message and extracts the signals.\n\n### print_parsed_data(parsed_data)\n\nPrints the parsed CAN data.\n\n### plot_signals(parsed_data, signal_name, start_time, end_time)\n\nPlots the specified CAN signal within the given time range.\n\n## Example\n\nTo run the script, navigate to the directory containing `main.py` and execute the following commands:\n\n```bash\npython src/main.py test SAF_SpeedTest\nOR\npython src/main.py test SAF_SpeedTest 43.2 45.6\n```\n\nThese commands will parse the test.dbc and test_log.txt files located in the data/ directory, process the CAN messages, and generate a plot for the SAF_SpeedTest signal.\n\n## Output Screenshots\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/ae5de356-ce91-4c4b-9cac-8f3f02ae049d\" width=\"600\" height=\"400\" /\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/d0fe7b06-18b1-4ff4-be53-82c877288097\" width=\"600\" height=\"400\" /\u003e\n\u003c/div\u003e\n\n\n## GUI Features\n### Overview\n\nThe GUI built using PyQt5 allows users to interactively select and plot CAN signals from the log file.\n\n### Features\n\n- **Multiple Plot Options**: Select which subplot to plot the signals in, allowing for easy comparison of multiple signals.\n- **Data Filtering**: Filter the data to be plotted by selecting specific start and end times.\n- **Advanced Plot Customization**: Customize the plot's appearance, including zooming, panning, and adjusting plot sizes.\n- **Data Export and Import**: Export the plotted data to CSV or import previously saved data for further analysis.\n- **Interactive Features**: Zoom, pan, and interact with the plot to analyze specific sections of the data.\n- **Annotations and Markers**: Add annotations and markers to the plot for highlighting important events.\n- **User-Friendly Interface**: Easy-to-use interface with buttons for loading files, plotting signals, and clearing plots.\n- **Enhanced Signal Selection**: Select and clear signals with ease, allowing for dynamic plotting.\n\n### Usage\n\n- Run the GUI application:\n  ```\n  python gui/gui_main.py\n  ```\n- Load the DBC and log files using the provided buttons.\n- Select the signals you want to plot from the list.\n- Click the \"Plot Signals\" button to visualize the selected signals.\n- Use the interactive features to zoom, pan, and analyze the plots.\n\n### Example Command\n  ```\n  python gui/gui_main.py\n  ```\n\n### GUI Working GIF    \n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/99054b12-e28b-470d-a788-66f846a47e8b\" width=\"600\" height=\"400\" /\u003e\n\u003c/div\u003e\n\n## Contributions\n\nFeel free to contribute by adding new algorithms or improving the existing implementations. Please follow the contribution guidelines outlined in the [CONTRIBUTING.md](CONTRIBUTING.md) file.\n\n## Contact\n\nKiran Jojare  \nEmbedded Software Engineer  \nPhone: 720-645-6212  \nEmail: kijo7257@colorado.edu\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\n\n---\n\nHappy Coding! 🚀\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkiranj26%2Fcan-log-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkiranj26%2Fcan-log-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkiranj26%2Fcan-log-parser/lists"}