Skip to content

About

Agricultural rover: STM32 closed-loop Ackermann steering + Raspberry Pi 5 autonomous companion computer

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

26 Commits

Folders and files

Repository files navigation

Design, Real-Time Embedded Control & Autonomous Navigation for an Agricultural Ackermann Rover

Institute Department Microcontroller SBC License

Internship Project Report & Engineering Handover
Author: Jagan J S (Embedded Engineering Intern, Department of Electrical Engineering, IIT Palakkad)
Project: Aerial Dexterous Manipulators, Grasping and Transportation / Autonomous Agricultural Robotics
Documentation: πŸ“„ Internship Report (PDF) | πŸ“˜ Handover Document (PDF) | πŸ“‹ Technical Handover Guide (MD)


πŸ“Œ Executive Summary

Modern precision agriculture relies on autonomous unmanned ground vehicles (UGVs) to execute labour-intensive field tasks such as row monitoring, precision spraying, and selective weeding.

This repository houses the complete electrical architecture, bare-metal C firmware, PCB design files, and Python autonomy stack developed to transform a legacy, open-loop BeagleBone Black differential-drive rover into a distributed, closed-loop STM32F411 + Raspberry Pi 5 Ackermann-steering autonomous agricultural rover.

System Architecture


πŸ—οΈ System Architecture

The vehicle is structured across a decoupled, multi-tiered hierarchy:

+-----------------------------------------------------------------------------+
|                             POWER SYSTEM (54.6V)                            |
|        54.6V LiFePO4 --> Isolator --> 100A DC Contactor --> 48V DC Bus      |
|                                         |                                   |
|                      +------------------+-------------------+               |
|                      |                                      |               |
|              48V -> 12V Buck                        48V -> 5V Buck          |
|              (Actuator & Driver)                    (Logic & RPi 5)         |
+-----------------------------------------------------------------------------+
                                       β”‚
                                       β–Ό
+-----------------------------------------------------------------------------+
|                        HIGH-LEVEL COMPUTE & AUTONOMY                        |
|                                                                             |
|   +-----------------------+                    +------------------------+   |
|   |   Raspberry Pi 5      |<─── I2C1 (400k) ───| BNO055 9-DOF IMU       |   |
|   |   Autonomy Engine     |                    +------------------------+   |
|   |   β€’ Stanley / Pure    |                                                 |
|   |     Pursuit Followers |                    +------------------------+   |
|   |   β€’ Skip-Row Planner  |                    | 4G UGV Tracker (ESP32) |   |
|   |   β€’ Odom / IMU Fusion |                    | β€’ Quectel EC200U LTE   |   |
|   +-----------------------+                    | β€’ Standalone Telemetry |   |
|               β”‚                                +------------------------+   |
|               β”‚ UART 115200 (USART2 Binary Protocol + DMA)                  |
|               β–Ό                                                             |
+-----------------------------------------------------------------------------+
                                       β”‚
                                       β–Ό
+-----------------------------------------------------------------------------+
|                       REAL-TIME EMBEDDED CONTROL CORE                       |
|                                                                             |
|   +---------------------------------------------------------------------+   |
|   |                    STM32F411CEU6 ("Black Pill")                     |   |
|   |   β€’ 20 Hz Deterministic Loop (TIM5 Hardware Timer)                  |   |
|   |   β€’ Discrete PI Wheel Velocity Control (wheel_pid.c)                |   |
|   |   β€’ Dual-Zone Linear Actuator Steering Control (actuator.c)         |   |
|   |   β€’ Electronic Differential Geometry Computation                    |   |
|   |   β€’ Contactor MOSFET Switch & 400ms Hard RF Failsafe Ladder         |   |
|   +---------------------------------------------------------------------+   |
|          β”‚             β”‚                 β”‚                   β”‚              |
+----------β”‚-------------β”‚-----------------β”‚-------------------β”‚--------------+
           β”‚             β”‚                 β”‚                   β”‚
  PWM/DIR (PA8/5)   I2C1 (0x48)      I2C1 (0x60/61)      TIM2/3 Quadrature
           β”‚             β”‚                 β”‚                   β”‚
           β–Ό             β–Ό                 β–Ό                   β–Ό
    +-------------+ +----------+    +---------------+   +------------------+
    | Cytron MD10C| | ADS1115  |    | Dual MCP4725  |   | YT06-OP-1M Optic |
    | Motor Driver| | 16-b ADC |    | 12-bit DACs   |   | Wheel Encoders   |
    +-------------+ +----------+    +---------------+   +------------------+
           β”‚             β–²                 β”‚                     β–²
           β–Ό             β”‚                 β–Ό                     β”‚
    +-------------+ +----------+    +---------------+            β”‚
    | PA-12 Linear| | Dual 10k |    | Dual BLDC     |β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
    | Actuator    | | Kingpin  |    | Motor Drivers |
    | (Steering)  | | Pots     |    | (48V 32A)     |
    +-------------+ +----------+    +---------------+
                                           β”‚
                                           β–Ό
                                    +---------------+
                                    | Dual 750W BLDC|
                                    | 20:1 Gearbox  |
                                    +---------------+

βš™οΈ Mechanical & Kinematic Specifications

Parameter Symbol Engineering Value Firmware Reference
Wheelbase $L$ $0.850\text{ m}$ ($850\text{ mm}$) ROVER_WHEELBASE_M
Track Width $W$ $0.800\text{ m}$ ($800\text{ mm}$) ROVER_TRACK_WIDTH_M
Wheel Radius $r$ $0.175\text{ m}$ ($175\text{ mm}$) ROVER_WHEEL_RADIUS_M
Gearbox Reduction $G$ $20:1$ Planetary Reduction Motor-to-Axle Ratio
Max Linear Velocity $v_{\text{max}}$ $0.458\text{ m/s}$ ($1.65\text{ km/h}$) MAX_LINEAR_VELOCITY
Nominal Cruise Speed $v_{\text{cruise}}$ $0.240\text{ m/s}$ ($0.86\text{ km/h}$) Path tracking default
Max Steering Angle $\delta_{\text{max}}$ $\pm 45.0^\circ$ STEER_MAX_DEG
Minimum Turning Radius $R_{\text{min}}$ $\approx 2.50\text{ m}$ Non-holonomic steering limit

🧩 Key Subsystems & Features

1. STM32 Bare-Metal Firmware (Rover_closed_loop/)

  • Deterministic 20 Hz Execution: Managed via hardware timer TIM5 interrupt for jitter-free control.
  • Dual-Zone Steering Control: Combines full-speed slewing in large error zones with fine-grained PID in small error deadbands to eliminate linear actuator overshoot.
  • Electronic Differential: Dynamically calculates individual wheel speeds during turns: $$v_L = v \left(1 - \frac{W}{2L} \tan\delta\right), \quad v_R = v \left(1 + \frac{W}{2L} \tan\delta\right)$$
  • Hardware Failsafe Ladder: 400 ms timeout on iBUS/serial input; immediately drops throttle and disengages contactor if signal loss occurs.

2. Raspberry Pi 5 Autonomy Engine (RPi_companion/)

  • Stanley & Pure Pursuit Controllers: Robust cross-track and heading error compensation for path tracking.
  • Agricultural Skip-Row Headland Planning: Solves turning infeasibilities where crop row spacing ($1.4\text{ m}$) is narrower than the vehicle's minimum turning radius ($2.5\text{ m}$).

Skip-Row Planning

3. Electrical & PCB Layout (Hardware_KiCad/)

  • Custom schematic and 2-layer PCB layout incorporating optocouplers, RC snubber circuits, TVS diodes, and high-current copper pours.

Hardware Schematic


πŸ“ Repository Structure

Autonomous_Ackermann/
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ figures/                       ← Architectural & field benchmark figures
β”‚   β”œβ”€β”€ Internship_Report.pdf          ← Full academic internship report (IIT Palakkad)
β”‚   β”œβ”€β”€ Handover_Document.pdf          ← Comprehensive technical handover manual
β”‚   └── SUCCESSOR_HANDOVER_GUIDE.md    ← Markdown successor engineering guide
β”‚
β”œβ”€β”€ Rover_closed_loop/                 ← Production STM32 Bare-Metal Firmware
β”‚   β”œβ”€β”€ Core/
β”‚   β”‚   β”œβ”€β”€ Inc/                       ← Header files (wheel_pid.h, main.h, etc.)
β”‚   β”‚   └── Src/                       ← Source files (main.c, wheel_pid.c, actuator.c)
β”‚   β”œβ”€β”€ Drivers/                       ← STM32 HAL and CMSIS Drivers
β”‚   └── Rover_closed_loop.ioc          ← STM32CubeMX Project Configuration
β”‚
β”œβ”€β”€ RPi_companion/                     ← Raspberry Pi 5 Python Autonomy Stack
β”‚   β”œβ”€β”€ ackermann_controller.py        ← Stanley & Pure Pursuit path tracking
β”‚   β”œβ”€β”€ rpi_stm32_bridge.py            ← Fast binary UART serial bridge
β”‚   β”œβ”€β”€ make_lawnmower_path.py         ← Boustrophedon grid coverage generator
β”‚   └── make_skip_row_path.py          ← Agricultural headland skip-row planner
β”‚
β”œβ”€β”€ Hardware_KiCad/                    ← Complete KiCad v6 Schematics & PCB Layout
β”‚   β”œβ”€β”€ kicad_setup.kicad_pro          ← KiCad Project File
β”‚   β”œβ”€β”€ kicad_setup.kicad_sch          ← Full System Schematic
β”‚   └── kicad_setup.kicad_pcb          ← 2-Layer PCB Board Layout
β”‚
β”œβ”€β”€ ESP32_uart_sniffer/                ← Diagnostic UART sniffer firmware
└── Documentations/                    ← Detailed engineering logs and notes

πŸš€ Getting Started

Building STM32 Firmware

  1. Open Rover_closed_loop/ in STM32CubeIDE or build using make / arm-none-eabi-gcc.
  2. Flash via ST-Link V2 using STM32CubeProgrammer or OpenOCD:
    st-flash write build/Rover_closed_loop.bin 0x8000000

Running Raspberry Pi 5 Autonomy

  1. Connect Raspberry Pi 5 UART (/dev/ttyAMA0) to STM32 USART2 (PA2/PA3).
  2. Run the navigation controller:
    cd RPi_companion
    python3 ackermann_controller.py --controller stanley --path paths/lawnmower_pattern.csv

πŸ“œ Citation & Credits

  • Author: Jagan J S
  • Affiliation: Department of Electrical Engineering, Indian Institute of Technology Palakkad
  • Supervision: Aerial Dexterous Manipulators, Grasping and Transportation Lab / OSDISG Research Group

About

Agricultural rover: STM32 closed-loop Ackermann steering + Raspberry Pi 5 autonomous companion computer

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages