Skip to content
tobiasjaehnelavl edited this page May 31, 2023 · 9 revisions

Car Simulator LogoRaspberry Pi CarSimulator Build Status

Raspberry Pi as a simulated car

This project provide a UDS and J1939 vehicle diagnostics mocking system based on a Raspberry Pi (+ CAN shield) driven by Lua scripts.

Getting Started

Hardware

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.

CarSimulator Software

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.

Changing CAN Baudrate

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:

Writing simulation files

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.

Requirements to build the software

Selene Lua C++ Binding

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