Engineering Autonomous Field Robotics: ROS 2, LiDAR SLAM, and Edge Compute in Unstructured Agricultural Terrains
Soyebuzaman Naim
Robotics, Applied AI & Full-Stack Engineer
Engineering Autonomous Field Robotics: ROS 2, LiDAR SLAM, and Edge Compute in Unstructured Agricultural Terrains
Autonomous mobile robots in industrial warehouses operate in structured, flat environments with known landmarks. When deploying a differential-drive ground robot in outdoor agricultural environments—such as uneven furrowed soil, fluctuating canopy density, and variable outdoor lighting—standard assumptions break down immediately.
In this deep dive, I share the architecture, sensor fusion mathematics, and real-time ROS 2 pipeline engineered for autonomous navigation in unstructured field terrains.
#1. The Core Engineering Challenge: Wheel Slip & Degraded Odometry
In outdoor soil, wheel encoders experience significant non-systematic error from rotational slip (s_r > 15%) and irregular tire deformation. Relying solely on wheel odometry produces catastrophic trajectory drift within a 5-meter run.
+-------------------------+
| Wheel Encoders (50Hz) |
+------------+------------+
|
v
+------------------------+ +---------------+ +-------------------------+
| 6-DOF IMU (BNO085) +-----> | EKF Node | <----+ 2D LiDAR (RPLIDAR S2) |
| Raw Accel / Gyro (100Hz)| | (robot_loc) | | LaserScan / Cartographer|
+------------------------+ +-------+-------+ +-------------------------+
|
v
+-------------------------+
| /odometry/filtered |
| (Continuous 50Hz Odom) |
+-------------------------+#2. Sensor Fusion Architecture with Extended Kalman Filtering
To produce a continuous, high-rate state estimate, we implement a multi-rate Extended Kalman Filter (EKF) using the robot_localization package in ROS 2 Humble.
##State Vector Definition
Our system tracks 15 states in the odom frame:
x = [ x, y, z, roll, pitch, yaw, vx, vy, vz, vroll, vpitch, vyaw, ax, ay, az ]^T##Differential Equation for 2D Planar Ground Projection
For a differential drive robot with wheel separation L and wheel radius R:
// Custom ROS 2 Differential Kinematics Node
void OdometryPublisher::calculate_kinematics(double left_ticks, double right_ticks, double dt) {
double d_left = (left_ticks * 2.0 * M_PI * WHEEL_RADIUS) / TICKS_PER_REV;
double d_right = (right_ticks * 2.0 * M_PI * WHEEL_RADIUS) / TICKS_PER_REV;
double d_center = (d_right + d_left) / 2.0;
double d_theta = (d_right - d_left) / WHEEL_BASE;
// Runge-Kutta 2nd Order Integration for Pose
pose_x_ += d_center * std::cos(pose_yaw_ + d_theta / 2.0);
pose_y_ += d_center * std::sin(pose_yaw_ + d_theta / 2.0);
pose_yaw_ += d_theta;
// Dynamic Covariance Inflation during high angular velocity
covariance_matrix_[0] = (std::abs(d_center) > 0.01) ? 0.002 : 0.0001;
covariance_matrix_[35] = (std::abs(d_theta) > 0.05) ? 0.05 : 0.001;
}#3. 2D LiDAR SLAM Optimization under Dynamic Foliage
Standard Cartographer or Gmapping SLAM can fail when crop leaves sway in crosswinds, creating "phantom obstacles" and dynamic scan-matching variance.
##Multi-Stage Scan Filtering Pipeline
| Pipeline Stage | Algorithm / Node | Target Latency | Purpose |
|---|---|---|---|
| Stage 1: Range Clipping | laser_filters/BoxFilter | < 1.2ms | Removes robot chassis reflections and low-lying ground glare |
| Stage 2: Angular Slicing | laser_filters/ScanShadowsFilter | < 2.5ms | Eliminates grazing-angle beam dispersion along curved plant stems |
| Stage 3: Submap Scan Matching | Cartographer Ceres ScanMatcher | < 12ms | Correlates points with high-probability obstacle priors |
min_range to 0.25m and tuning submaps.num_range_data = 60 ensures that temporary foliage flutter does not degrade the long-term occupancy grid map.#4. Hardware Edge Architecture & Power Budgeting
The complete compute stack runs on a carrier board powered by a 24V 20Ah LiFePO4 battery pack with isolated DC-DC step-down converters (19V for Jetson, 12V for motor drivers, 5V for MCU/sensors).
# ROS 2 Nav2 Behavior Tree Tuning for Unstructured Dirt Tracks
recovery_plugins: ["spin", "backup", "wait"]
spin:
plugin: "nav2_recoveries/Spin"
max_rotational_vel: 0.45
min_rotational_vel: 0.15
rotational_acc_lim: 1.2
backup:
plugin: "nav2_recoveries/BackUp"
backup_dist: 0.35
backup_speed: 0.12#5. Key Lessons from Field Deployment
- 1Hardware-Level Sensor Synchronization: Never poll IMU data over unbuffered serial USB at high rates. Use hardware interrupt timers on an STM32 MCU transmitting synchronized packets over CAN bus.
- 2Dynamic Footprint Inflation: In crop rows, fixed circular inflation layers cause conservative stalls. Elliptical footprint models aligned with the chassis orientation allow tighter inter-row navigation without clipping plant stalks.
- 3Graceful Failover: When LiDAR scan match score drops below 0.45 (e.g. in tall dense monoculture fields with few unique features), the robot smoothly falls back to IMU/wheel EKF fusion with reduced linear speed limits until distinctive landmarks reappear.
About the Author
Soyebuzaman Naim is a Computer Science & Engineering researcher at Southeast University specializing in autonomous field robotics (ROS 2 / LiDAR SLAM), edge computer vision with TensorRT, 3D WebGL architecture, and production RAG systems.