/ECU-Core

RaspberryPi based ECU that communicates with the local machine

Primary LanguagePythonCreative Commons Attribution Share Alike 4.0 InternationalCC-BY-SA-4.0

About

Architecture_ECU-Core

This repository is for the ECU-Core part of the Autonomous-Driving-System project. The ECU-Core is based on an independent RaspberryPi board and performs following tasks.

  • Publish LIDAR scan data as ROS2 topic
  • Publish depth camera image data as ROS2 topic
  • Receive vehicle informations as ROS2 topic and convert them into CAN communication
  • Control the execution of autonomous driving mode

We used YDLIDAR X4 and RealSense D435 depth camera in this project. For more detailed information, refer to the Autonomous-Driving-System project.

Requirements

  • Ubuntu 20.04

    Install Ubuntu 20.04 for RaspberryPi using RaspberryPi OS Imager.

  • CAN HAT setup

    Follow the instruction of 2-CH CAN FD HAT setup and enable Single SPI Mode.

  • ROS2 setup

    Follow the instruction of ROS2 foxy setup.

  • LIDAR SDK setup

    Follow the instruction of YDLidar-SDK setup.

  • Depth camera SDK setup

    Follow the instruction of RealSense documentation. If you encounter issues while running the software installed on RaspberryPi, refer to the following page.

  • OpenCV packages

    pip install opencv-python
    sudo apt install ros-foxy-cv-bridge
  • Python packages

    pip install numpy
    pip install transforms3d

Usage

# Execute on the ECU-Core
colcon build
source install/setup.bash
sh can_setup.sh

ros2 run lidar_pub lidar_pub

ros2 run camera_pub camera_pub

ros2 run receiver receiver

ros2 run headunit_start headunit_start

Note

The ROS2 topic communication is machine-to-machine. Make sure that both ECU-Core and local machine are connected to the same WLAN. If the connection is not successful, disable the firewall using the following command.

# Execute on the ECU-Core and local machine
sudo ufw disable

Context of CAN communication

Message Purpose Arbitration ID
steering Control 0x00
throttle Control 0x01
x position GPS 0x02
y position GPS 0x03
orientation GPS 0x04
headunit start Autonomous driving 0x05