eCAL vs. Alternatives: Choosing the Right Middleware for Robotics

How to Set Up eCAL for High-Performance Messaging

What is eCAL

eCAL (enhanced Communication Abstraction Layer) is a lightweight, high-performance middleware designed for real-time messaging in robotics, automotive, and distributed systems. It focuses on low latency, high throughput, and simple integration with C++, Python, and C# applications.

System requirements

  • Linux (Ubuntu 18.04+ recommended) or Windows ⁄11
  • CMake 3.10+
  • C++17-compatible compiler (GCC/Clang/MSVC)
  • Python 3.6+ (if using Python bindings)
  • Optional: Docker for isolated setups

Installation

  1. Install dependencies (Linux example – Ubuntu):
    • Update packages:

      Code

      sudo apt update sudo apt install build-essential cmake git python3 python3-pip
  2. Clone eCAL repository and build:

    Code

    git clone https://github.com/continental/ecal.git cd ecal mkdir build && cd build cmake .. -DCMAKE_BUILDTYPE=Release make -j$(nproc) sudo make install
  3. Python bindings:

    Code

    cd ../python pip3 install -r requirements.txt python3 setup.py install

Basic concepts and architecture

  • Topics: Named message channels for pub/sub communication.
  • Services: Request/reply RPC-style communication.
  • Hosts: Nodes that run eCAL processes; discovery is automatic via multicast or UDP.
  • QoS: eCAL provides options for reliability and message history; tune for latency or throughput.

Quickstart example (C++)

  1. Publisher:

    cpp

    #include #include int main(int argc, char argv) { eCAL::Initialize(argc, argv, “publisher”); eCAL::string::CPublisher<std::string> pub(“example_topic”); while (eCAL::Ok()) { std::string msg = “hello”; pub.Send(msg); std::this_thread::sleepfor(std::chrono::milliseconds(10)); } eCAL::Finalize(); return 0; }
  2. Subscriber:

    cpp

    #include #include void OnReceive(const char* /topicname/, const char* msg, const long long /*time*/, const long long /id_/, const long /clock_/) { printf(“Received: %s “, msg_); } int main(int argc, char argv) { eCAL::Initialize(argc, argv, “subscriber”); eCAL::string::CSubscriber<std::string> sub(“example_topic”); sub.AddReceiveCallback(OnReceive); while (eCAL::Ok()) std::this_thread::sleep_for(std::chrono::milliseconds(100)); eCAL::Finalize(); return 0; }

Performance tuning

  • Transport selection: Prefer shared memory for same-host communication, UDP multicast for multi-host with low CPU overhead, or TCP when reliability is critical.
  • Message batching: Aggregate small messages into larger frames to reduce syscall overhead.
  • Threading: Use dedicated threads for sending/receiving to avoid blocking application logic.
  • Zero-copy: Use eCAL’s zero-copy APIs where available to avoid serialization overhead.
  • Message size: Keep messages under MTU when using UDP to avoid fragmentation.
  • CPU affinity: Pin eCAL threads to specific cores to reduce jitter.
  • Network: Use a dedicated NIC or VLAN for eCAL traffic; enable jumbo frames if supported.

Monitoring and debugging

  • eCAL Visual Inspector: GUI tool to view topics, message rates, and latency.
  • Logging: Enable verbose logging in development to trace message flow.

Comments

Leave a Reply