-
Notifications
You must be signed in to change notification settings - Fork 10
Home
This project provide a UDS and J1939 vehicle diagnostics mocking system based on a Raspberry Pi (+ CAN shield) driven by Lua scripts.
This project originated as simulation to run on the RaspberryPi. So far it has been confirmed to run on Raspberry Pi 3B+ and 4. It should run on any Linux System, though, that provides the necessary libraries. For example you can run it on WSL when only using virtual CAN or DoIP.
When performing simulation on a real CAN Bus, you need a CAN-Shield for the Raspberry Pi.
The CarSimulator ist OpenSource Software, licensed under the Apache License 2.0. The complete source code is located in the Github repository at https://github.com/AVL-DiTEST-DiagDev/car-simulator
This repository contains scripts to build a CarSimulator SD-Card image: https://github.com/AVL-DiTEST-DiagDev/car-simulator-image-generator A pre-built image is not, yet publicly available.
After writing the image to the SD-Card, you get a drive or mount called "BOOT". Open the file config.txt and adapt it to the specific CAN-Shield you are using. See CAN Shield Configuration for how to do that.
There is also a commandline tool to control the CarSimulator, upload simulation files etc.> https://github.com/AVL-DiTEST-DiagDev/car-simulator-control To use it you need to connect the RaspberryPi via Network to the host PC.
Currently there is no *easy way to change the CAN hardware configuration (e.g. baudrate) But there are two ways to do it manually with a bit of Linux knowledge:
- Option 1: Rebuild the image.
The framework to buld the image is here: https://github.com/AVL-DiTEST-DiagDev/car-simulator-image-generator The file https://github.com/AVL-DiTEST-DiagDev/car-simulator-image-generator/blob/develop/stage2.1-can-system/11-enable-can-interfaces/01-run-chroot.sh contains the bitrate and it is possible to configure other CAN Parameter here as well. - Option 2: Change configuration in the existing image
- Boot RaspberryPi
- Login via SSH (Default Rasberry Pi OS username/password)
- In /etc/network/interfaces.d/ are files called can0, can1 respectively which you can use to configure the interface.
- Reboot RaspberryPi
You can find a reference of the Open Lua Simulation Format here: https://lua.carsimulator.org/
Note: In the CarSimulation currently all ECUs need to be named "Main", not "PCM" or "BCM" like in the examples. Consequently only one ECU per file is supported. We are already working on a fix to remove that limitation.
Tool / Library | Version |
---|---|
Lua | >= 5.2 |
C++ compiler | >= ISO C++14 |
can-isotp | >= git 2017/04/22 |
can-utils (optional) | >= git 2015/09/02 |
CppUnit (optional) | >= 1.10 |
Doxygen (optional) | >= 1.8 |
graphviz (optional) | >= 2.38 |