• Stars
    star
    931
  • Rank 49,076 (Top 1.0 %)
  • Language
    C++
  • License
    Mozilla Public Li...
  • Created over 7 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Development tool for CAN bus simulation

CANdevStudio

CANdevStudio codecov Doxygen

Overview

Most of automotive projects need to have an access to the Controller Area Network (CAN) bus. There are plenty of commercial frameworks that provides CAN stacks and hardware/software tools necessary to develop proper CAN networks. They are very comprehensive and thus expensive. CANdevStudio aims to be cost-effective replacement for CAN simulation software. It can work with variety of CAN hardware interfaces (e.g. Microchip, Vector, PEAK-Systems) or even without it (vcan and cannelloni) . CANdevStudio enables to simulate CAN signals such as ignition status, doors status or reverse gear by every automotive developer. Thanks to modularity it is easy to implement new, custom features.

Checkout CANdevStudio on YouTube

Compatible CAN interfaces

Access to CAN bus is based on Qt framework. Current list of supported CAN interfaces can be found here.

Current list of devices compatible with SocketCAN (Linux only) can be found here.

Supported operating systems

  • Linux
  • Windows
  • macOS

Build instructions

CANdevStudio project uses GitHub Actions as continuous integration environment. You can check build.yml for details.

To lower maintenance effort and allow for usage of modern C++ features, since v1.2.0 CANdevStudio dropped "official" support for legacy compilers like gcc5.3, vs2015 or MinGW. Current CI configuration uses the latest compilers available for each GitHub Actions environment:

  • ubuntu-latest (clang and gcc)
  • macos-latest (clang)
  • windows-latest (vs2019 x64)

Linux

git clone https://github.com/GENIVI/CANdevStudio.git
cd CANdevStudio
git submodule update --init --recursive
mkdir build
cd build
cmake ..
make

To choose compiler

cd CANdevStudio/build
rm -rf *
export CC=clang
export CXX=clang++
cmake ..
make

Qt in CMake

If CMake failed to find Qt in your system:

cd CANdevStudio/build
rm -rf *
cmake .. -DCMAKE_PREFIX_PATH=/home/genivi/Qt5.12.0/5.12.0/gcc_64
make

Windows

Visual Studio 2019 Win64

git clone https://github.com/GENIVI/CANdevStudio.git
cd CANdevStudio
git submodule update --init --recursive
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 16 2019" -A x64
cmake --build .

macOS / OS X

Dependencies

brew install qt5 cmake ninja

Build steps

git clone https://github.com/GENIVI/CANdevStudio.git
cd CANdevStudio
cmake -S. -Bbuild -GNinja -DCMAKE_PREFIX_PATH=$(brew --prefix qt5)/lib/cmake
cd build
ninja

Prebuilt packages

Each GitHub Actions job stores prebuilt packages for 90 days. Additionally official releases are stored on GitHub Releases page.

Package naming

CANdevStudio-X.Y.ZZZZZZZ-SYS[-standalone]

X - major version number of previous stable version
Y - minor version of previous stable version
Z - SHA commit ID
SYS - either win64, Linux or Darwin
standalone - bundle version that contains Qt libraries and all relevant plugins.

Linux

All packages are being built on ubuntu-latest environment. Refer to this page to determine the exact Ubuntu version. You may experience problems with missing or incompatible libraries when trying to run the package on other distros.

To run standalone version use CANdevStudio.sh script.

ARCH Linux

Install AUR package: candevstudio-git

Windows

Packages built with Visual Studio 2019.

Standalone version contains Qt. Installation of VS2019 redist packages may be still required.

macOS / OS X

Package is a DMG installer.

Quick Start

General instructions to start your first simulation:

  1. Build the latest master or release.
  2. Run the application and start a new project
  3. Drag and drop CanDevice and CanRawView components and connect them accordingly.
  4. Double click on CanDevice node to open configuration window.
    1. set one of supported backends (e.g. socketcan) link.
      NOTE: List of supported backends depends on Qt version.
    2. set name of your can interface (e.g. can0)
  5. Start the simulation
  6. Double click on CanRawView component to see CAN traffic

Steps required to use specific CAN hardware or virtual interfaces require some additional steps listed in following sections.

CAN Hardware

The list below shows hardware that has been successfully used with CANdevStudio.

Microchip CAN BUS Analyzer

  • Tested on Linux
  • Requires socketcan driver.
  • Officially supported in Linux Kernel v4.12+ Configuration:
  1. Find your interface name (e.g. can0)
    ip link
  2. Configure bitrate
    sudo ip link set can0 type can bitrate 1000000
  3. Bring the device up
    sudo ip link set can0 up
  4. Optionally configure CAN termination
    1. In GitHUB based driver
      sudo ip link set can0 type can termination 1
    2. In Linux 4.12+ driver
      sudo ip link set can0 type can termination 120

CanDevice backend: socketcan

Lawicel CANUSB

  • Tested on Linux
  • Based on FTDI Serial driver
  • Requires slcand to "convert" serial device to SocketCAN.
  • Officially supported in Linux Kernel v2.6.38

Configuration:

  1. Create SocketCAN device from serial interface
    sudo slcand -o -c -s8 -S1000000 /dev/ttyUSB0 can0
  2. Bring the device up
    sudo ip link set can0 up

CanDevice backend: socketcan

PeakCAN PCAN-USB

  • Tested on Windows

CanDevice settings example:

backend: peakcan
interface: usb0
configuration: BitRateKey = 250000

PassThruCAN Plugin

  • Tested on Windows

CanDevice settings example for PEAK-PCAN:

backend: passthrucan
configuration: BitRateKey = 250000
interface: PCANPT32

CanDevice settings example for SIE_CANUSB:

backend: passthrucan
configuration: BitRateKey = 250000
interface: CANUSB

CanDevice settings example for Kvaser USBcan:

backend: passthrucan
configuration: BitRateKey = 250000
interface: J2534 (kline) for Kvaser Hardware

CANdevStudio without CAN hardware

CANdevStudio can be used without actual CAN hardware thanks to Linux's built-in emulation.

VCAN

Configuration:

sudo modprobe vcan
sudo ip link add dev can0 type vcan
sudo ip link set can0 up

CanDevice backend: socketcan

Cannelloni

A SocketCAN over Ethernet tunnel. Available for Linux only.

Let's consider setup as before:

Configuration with qtCannelloniCanBusPlugin

Target configuration:

sudo modprobe vcan
sudo ip link add dev can0 type vcan
sudo ip link set can0 up
cannelloni -I can0 -R 192.168.0.1 -r 30000 -l 20000

PC configuration:

  1. Install libqtCannelloniCanBusPlugin.so that is built along with CANdevStudio. You can either copy it manually to Qt plugins directory (e.g. /usr/lib/qt/plugins/canbus) or use "make install" to do it automatically.
  2. Create new project in CANdevStudio and add CanDevice node
  3. Configure CanDevice:
    1. backend: cannelloni
    2. interface: 30000,192.168.0.2,20000 (local_port,remote_ip,remote_port)
  4. Start simulation
Configuration without qtCannelloniCanBusPlugin

Target configuration:

sudo modprobe vcan
sudo ip link add dev can0 type vcan
sudo ip link set can0 up
cannelloni -I can0 -R 192.168.0.1 -r 30000 -l 20000

PC configuration:

  1. Execute following lines in a shell
sudo modprobe vcan
sudo ip link add dev can0 type vcan
sudo ip link set can0 up
cannelloni -I can0 -R 192.168.0.2 -r 20000 -l 30000
  1. Create new project in CANdevStudio and add CanDevice node
  2. Configure CanDevice:
    1. backend: socketcan
    2. interface: can0
  3. Start simulation

Help

Scripting

As of v1.1 CANdevStudio supports creation of QML based scripts. Scripts can be developed and loaded dynamically without a need to restart the main applications. Scripting adds a lot of different possibilities to CANdevStudio that includes:

  • Creation of custom GUIs
  • Raw frames and signals handling
  • Time triggered actions
  • Message triggered actions
  • ... and many more, as all QML functionalities are supported.

Try it yourself by loading one of the examples into QMLExecutor component. You are welcome to share your scripts via Pull Requests!

CAN Signals

CANdevStudio provides support for CAN signals handling. DBC database description format is supported. Reverse engineered DBC files can be found in opendbc project.

Support for others CAN database formats can be added via extension of CANdb.

Sending signals

  1. Start new project and setup CanDevice as described in quick start section
  2. Add CanSignalData component that serves as CAN signals database for other components. You may have multiple CanSignalData components per projecthttps://github.com/commaai/opendbc
  3. Open CanSignalData properties and configure path to DBC file
  4. List of messages and signals shall be now loaded and visible in CanSignalData window
  5. You may configure cycle and initial value per each message
  6. Add CanSignalEncoder component and connect it with CanDevice. CanSignalEncoder act as a translator between signals and CAN frames. It is also responsible for sending cyclical messages.
  7. CanSignalSender has been automatically configured to use previously added CAN database. CAN database can be manually selected in component properties (this applies to all components from "Signals" group)
  8. Add CanSignalSender component and connect it with CanSignalEncoder
  9. Add signals in CanSignalSender window
  10. Start simulation
  11. CanSignalEncoder will start sending cyclical messages
  12. You can send previously configured signals from CanSignalSender:
    • if signal is a part of periodic message its value will be updated in a next cycle
    • if signal is not a part of periodic message it will be sent out immediately

Receiving signals

  1. Start new project and setup CanDevice as described in quick start section
  2. Add CanSignalData component that serves as CAN signals database for other components. You may have multiple CanSignalData components per project
  3. Open CanSignalData properties and configure path to DBC file
  4. List of messages and signals shall be now loaded and visible in CanSignalData window
  5. Add CanSignalDecoder component and connect it with CanDevice. CanSignalDecoder act as a translator between signals and CAN frames.
  6. CanSignalDecoder has been automatically configured to use previously added CAN database. CAN database can be manually selected in component properties (this applies to all components from "Signals" group)
  7. Add CanSignalViewer component and connect it with CanSignalDecoder
  8. Start simulation
  9. Signals shall now appear in CanSignalViewer. Note that CanSignalDecoder is sending over only signals which values has changed.

CanDevice configuration

CanDevice component can be configured using "configuration" property:

  • Format - "key1=value1;key2=value2;keyX=valueX"
  • Keys names are case sensitive, values are case insensitive
  • Configuration keys are taken from ConfigurationKey enum.
  • RawFilterKey and ErrorFilterKey are currently not supported
  • Whitespaces are ignored

E.g.

BitRateKey=100000;ReceiveOwnKey=false;LoopbackKey=true

CanRawFilter

CanRawFilter component enables to filter (i.e. accept or drop) incoming and outgoing frames:

  • Qt regular expressions are used to match filter rules.
  • Rules are matched from top to bottom
  • Default policy is applied to frames unmatched by any filter

Examples:

  • match 0x222 and 0x333 frames only [id field]
222|333
  • match 0x200 - 0x300 frames only [id field]
^[23]..$
  • match empty payload (DLC 0) [payload field]
^$
  • match 2 byte payload (DLC 2) [payload field]
^.{4}$

Adding new components

  1. Configure build to include templategen tool
cd build
cmake .. -DWITH_TOOLS=ON
make
  1. Generate component (use -g option if you don't need component to have GUI)
./tools/templategen/templategen -n MyNewComponent -o ../src/components -g
  1. CMake script automatically detects new components. It has to be invoked manually.
cmake ..
  1. Build project
make
  1. Your component is now integrated with CANdevStudio
  2. You may want to modify src/components/mynewcomponent/mynewcomponentplugin.h to configure section name, color and spacing
  3. Define component inputs and outputs in src/components/mynewcomponent/mynewcomponentmodel.cpp. Look for examples in other components.
  4. Modify automatically generated unit tests src/components/mynewcomponent/tests

More Repositories

1

CANdb

Library for parsing CAN bus database description formats
C++
145
star
2

genivi-vehicle-simulator

An open source vehicle simulator
C#
100
star
3

genivi-dev-platform

GENIVI Development Platform
Shell
91
star
4

rvi_core

Specify, design, plan and build a reference implementation of the open source infrastructure that drives next generation's connected vehicle services.
Erlang
64
star
5

meta-ivi

THIS REPOSITORY IS ARCHIVED i.e. please fork the project if you wish to develop it further
Shell
35
star
6

AudioManager

The GENIVI Audiomanager
Rich Text Format
25
star
7

positioning

GENIVI Positioning
Rich Text Format
21
star
8

navigation-next

Comprehensive open-source navigation stack (NOTE: repository name/URL is likely to change)
C++
18
star
9

franca_plus

Proof of concept that extends franca for components
Xtend
18
star
10

navigation-application

Applications based on navigation and positioning middleware, including Fuel Stop Advisor
C++
16
star
11

rvi_sota_server

SOTA Reference Implementation project - Server
Scala
14
star
12

genivi_swm

The Software Management System (SWM) drives software install, upgrade, and removal use cases.
Python
12
star
13

navigation

GENIVI LBS navigation code
Java
12
star
14

hmi-layout-gdp

C++
12
star
15

meta-genivi-dev

NOTE: This repository is deprecated -- meta-genivi-dev can now be found inside of the genivi-dev-platform.git repository
11
star
16

car-data-logger

C++
9
star
17

browser-poc

An in-vehicle web browser as a proof-of-concept
C++
9
star
18

persistence-client-library

The client library for the persistence database
C
9
star
19

ionas-hmi

HTML
8
star
20

node-state-manager

Node management in an automotive setting
C
8
star
21

rvi_lib

C implementation of the RVI Core protocol.
C
7
star
22

meta-rvi

Yocto Project / OpenEmbedded meta data layer to build RVI Core.
C++
7
star
23

ivi-radio

Interfaces to common radio backends found in IVI systems
C++
6
star
24

AudioManagerPlugins

Plugin interface for the GENIVI Audio Manager
C++
6
star
25

persistence-common-object

Common Object component for persistence
C
6
star
26

BluetoothPairingApp

QML
6
star
27

HVAC

HVAC application
QML
6
star
28

VCIVING-SpeechRecognition

GENIVI GSoC 2018 and 2019
Python
6
star
29

gdp-hmi

GDP launcher application and old (now unused) HMI - for new HMI, go to: https://github.com/GENIVI/hmi-layout-gdp
C++
6
star
30

open-address-book

Open Address Book (OAB) -- sync external address books with your IVI system
C++
6
star
31

audio-manager-demo

A demonstrator for GENIVI's Audio Manager
C++
5
star
32

app-framework

App framework consists of a software framework used by software developers to implement the standard structure of an application.
5
star
33

media-manager-interfaces

auto-generated CommonAPI-DBus interfaces for the media manager
C++
5
star
34

rvi_sota_client

SOTA Reference Implementation project - Client
Rust
5
star
35

slotted_udp

Stream data over UDP/IP multicast LAN with guaranteed latency and bandwidth.
C
5
star
36

capic-poc

Common API C implementation (Proof of Concept)
C
4
star
37

ramses-python

Python bindings for the ramses 3D graphics library
C++
4
star
38

persistence-administrator

Administration of GENIVI's persistence tooling
C
4
star
39

notepad-app

A simple example application to explore and explain persistent storage
QML
4
star
40

persistence-health-monitor

A component designed to check the lifecycle status of persistent data
C
4
star
41

node-health-monitor

A part of the lifecycle software that monitors nodes
C
4
star
42

FMRadio

FM Radio HMI application
QML
4
star
43

node-startup-controller

GENIVI Node Startup Controller (NSC)
C
3
star
44

ramses-blender

Blender plugin for ramses
Python
3
star
45

rvi_media_demo

RVI Media Player control from Android application
Java
3
star
46

media-manager

An API for IVI applications to control playback from CE connected devices
C++
3
star
47

genivi-appman-qt-poc

A proof of concept for a GENIVI Application Manager using Qt
C++
3
star
48

meta-ivi-renesas

meta-ivi (Genivi Yocto Baseline) adaption layer for the Renesas R-Car Yocto BSP
3
star
49

yamaica-ea

Enterprise Architect plugins for YAMAICA
Java
2
star
50

rvi_nifi_big_data

Full NiFi Template used for the 15th GENIVI AMM big data demo.
2
star
51

yamaica

Yet Another Model And Interface Conversion Application
Java
2
star
52

meta-genivi-ocf-demo

A GENIVI based demo from the Open Connectivity Foundation
2
star
53

rvi_pki_android

Example PKI module for Android RVI projects
Java
2
star
54

gdp-test-suite

A test suite for the GENIVI Developer platform
Python
2
star
55

obj-to-ramses

Import OBJ files and save as RAMSES scenes
C++
2
star
56

simple-node-state-machine

Node State Machine (for the Node State Manager) used in GDP
C
2
star
57

persistence-db-configuration-tool

A tool to configure the Persistence database
Java
2
star
58

vsm_connection

Library to remotely set signals in a VSM instance via a TCP socket.
C
2
star
59

dbus-cplusplus

Copy of dbus-c++, because the location we used before does not support anonymous clone over https (asks for login credentials)
C++
2
star
60

media-manager-extension

The GENIVI media manager extension provides an interface to the Media Manager component for CrossWalk applications.
C++
2
star
61

media-manager-hmi

Media Manager HMI for use with GENIVI Media Manager
QML
2
star
62

meta-smart-cities-pilot

Yocto layer for Smart Cities pilot
Shell
2
star
63

meta-renesas

meta-renesas (temporary fork)
BitBake
1
star
64

rvi_provisioning

RVI certificate and credential provisioning, management, and distribution project.
1
star
65

connected-home

Connected Home app used in JLR GENIVI demos
QML
1
star
66

baseline_ci_helper

Glue for integration of continuous integration tool and the GENIVI baseline
Shell
1
star
67

smart-cities

Application for GENIVI Smart Cities pilot
QML
1
star
68

vsi_web_demo

Simple Vehicle Signalling to Web Demo
HTML
1
star