Skip to content

Test basic CAN communication to the ICOtronic system

Notifications You must be signed in to change notification settings

MyTooliT/ICOcantest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

ICOtronic CAN Test Container

Description

Script and Dockerfile to test basic CAN communication with the ICOtronic system

Note: the Docker container requires a Linux host, since we need a way to “connect” the CAN adapter to the Docker container.

Requirements

  • Hardware:
    • Peak CAN adapter
    • Power Injector
    • Stationary Transceiver Unit (STU)
  • Software:

Docker

Build

Please run the following command in the root of the repository:

docker build -t icocantest .

Run

Below we will describe two different options to “connect” the CAN adapter to the running container:

  1. Using host networking
  2. Using network namespaces

Host Networking

  1. Run Docker container:

    docker run --rm --network host -it --name icocantest icocantest
  2. Run script inside Docker container:

    python cantest/test.py

Network Namespaces

  1. Run Docker container:

    docker run -itd --rm --name icocantest icocantest
  2. Map CAN adapter into Docker container

    export DOCKERPID="$(docker inspect -f '{{ .State.Pid }}' icocantest)"
    sudo ip link set can0 netns "$DOCKERPID"
    sudo nsenter -t "$DOCKERPID" -n ip link set can0 type can bitrate 1000000
    sudo nsenter -t "$DOCKERPID" -n ip link set can0 up
  3. Execute script:

    docker exec icocantest python cantest/test.py
  4. Cleanup:

    docker stop icocantest

About

Test basic CAN communication to the ICOtronic system

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published