Skip to content
This repository was archived by the owner on Oct 6, 2025. It is now read-only.

Modules

Rui-Pedro-Pires edited this page Aug 18, 2025 · 6 revisions

Modules

This page explains the core executable modules and their key components in the JetsonNano ECU system.

Vehicle System (src/vehicle.cpp)

The Vehicle System module maintains the vehicle state model and provides actuation interfaces aligned with VSS (Vehicle Signal Specification).

Key Components:

  • VehicleSystem: Central state container with VSS-aligned hierarchy
  • Vehicle: Core state representation with sub-systems
  • MotionManagement: Steering and powertrain management
  • Exterior: External vehicle elements

Responsibilities:

  • Maintains current vehicle state
  • Subscribes to control commands via Zenoh
  • Actuates chassis/body components
  • Exposes vehicle state via standardized interfaces

Middleware (src/middleware.cpp)

The Middleware module bridges CAN bus communications with Zenoh, enabling seamless integration between vehicle hardware and software components.

Key Components:

  • BatterySensor: Monitors power metrics (voltage, current, power) via I²C
  • Signals: Main CAN↔Zenoh bridge for bidirectional communication

Responsibilities:

  • CAN → Zenoh: Publishes vehicle telemetry (speed, battery, lights)
  • Zenoh → CAN: Subscribes to control commands (steering, throttle, lights)
  • Provides standardized Zenoh interfaces for vehicle communication

Combined Controller (src/combinedControl.cpp)

The Combined Controller handles all vehicle control functions, from manual inputs to autonomous steering and speed.

Key Components:

  • XboxController: Reads gamepad inputs, exposes manual speed/steering
  • PIDController: Steering control with fixed/predefined desired speed values
  • MPCController: Optimizes both steering and desired speed based on trajectory
  • SpeedPidController: Throttle control that attempts to reach the desired speed (used with both PID and MPC)

Responsibilities:

  • Processes manual inputs from Xbox controller
  • Switches control algorithms based on automation mode
  • If using PID:
    • PIDController handles only steering based on lane midpoint error
    • Uses fixed/predefined desired speed values
  • If using MPC:
    • MPCController optimizes both steering and the desired speed target
    • Determines optimal desired speed based on trajectory/curves
  • In both cases:
    • SpeedPidController handles the actual throttle control to reach the desired speed target
    • Minimizes error between current speed and desired speed (whether from PID or MPC)
  • Subscribes to perception outputs (when in autonomous modes)
  • Publishes control commands to Middleware

Detection (src/detection.cpp)

The Detection module processes camera inputs to understand the environment, detecting lanes, objects, signs, and lights.

Key Components:

  • LaneDetector: Processes images to detect lane boundaries
  • ObjectDetector: Identifies vehicles, pedestrians, signs, and road surfaces
  • TrajectoryDefinition: Generates path planning based on lane/object fusion
  • TrafficSignClassifier: Classifies detected signs and lights
  • AdaptiveCruiseControl: Estimates distances for ACC behavior
  • ObstacleAvoidance: Path planning for obstacle avoidance in SAE_4

Responsibilities:

  • Captures and processes camera frames
  • Detects lane boundaries and calculates midpoint error
  • Identifies objects and classifies them
  • Determines road/non-road segments
  • Generates trajectory for autonomous steering
  • Classifies traffic signs and lights
  • Triggers emergency braking when needed
  • Publishes perception outputs to Combined Controller

Communication (src/Communication/)

While not a standalone executable, the Communication components facilitate standardized messaging across modules.

Key Components:

  • ControllerPublisher: Sends control commands
  • LaneDetectorPublisher: Publishes lane detection results
  • SensoringPublisher: Shares sensor data
  • VSSSubscriber/VSSQueryable: VSS-aligned interfaces

Responsibilities:

  • Standardizes message formatting
  • Encapsulates Zenoh pub/sub operations
  • Provides VSS-aligned communication interfaces

Clone this wiki locally