Intel RealSense D455 autonomous lawn care system with ROS 2 Humble
Complete computer vision pipeline for grass detection, obstacle avoidance, and coverage path planning using depth and color cameras.
~/lawn_care_ws/
├── src/d455_lawn_care/ # Main package directory
│ ├── d455_lawn_care/ # Python package
│ │ ├── grass_detector.py # Grass detection node
│ │ └── obstacle_detector.py # Obstacle detection node
│ ├── msg/ # Custom message definitions
│ │ ├── GrassDetection.msg # Grass analysis results
│ │ ├── Obstacle.msg # Individual obstacle data
│ │ ├── ObstacleArray.msg # Multiple obstacles
│ │ └── LawnStatus.msg # Overall system status
│ ├── srv/ # Service definitions
│ │ ├── CalibrateGrassDetection.srv # Calibration service
│ │ └── SetMowingPattern.srv # Pattern planning service
│ ├── launch/ # Launch files
│ │ └── lawn_care_system.launch.py # Complete system launch
│ ├── config/ # Configuration files
│ │ └── lawn_care_params.yaml # Tuned parameters
│ └── package.xml # Package dependencies
cd ~/lawn_care_ws
colcon build --packages-select d455_lawn_care
source install/setup.bash
# Your D455 is already streaming with optimal settings
ros2 topic list | grep d455
source ~/lawn_care_ws/install/setup.bash
ros2 launch d455_lawn_care lawn_care_system.launch.py
# Grass detection
python3 ~/lawn_care_ws/src/d455_lawn_care/d455_lawn_care/grass_detector.py
# Obstacle detection
python3 ~/lawn_care_ws/src/d455_lawn_care/d455_lawn_care/obstacle_detector.py
- Real-time grass analysis using HSV color filtering
- Height measurement using RGB-D depth data
- Coverage percentage calculation
- Cutting recommendations based on height thresholds
- Auto-calibration service for different grass types
- Debug visualizations with grass mask overlay
- 3D obstacle detection using depth clustering
- Obstacle classification (tree, rock, furniture, etc.)
- Persistent tracking with unique IDs
- Safety zone calculation with danger levels
- RViz visualization with colored bounding boxes
- Configurable detection parameters
GrassDetection.msg
- Complete grass analysis dataObstacle.msg
- Individual obstacle propertiesObstacleArray.msg
- Multiple obstacles with statisticsLawnStatus.msg
- Overall system health and status
CalibrateGrassDetection.srv
- Adaptive grass color calibrationSetMowingPattern.srv
- Autonomous mowing path planning
All parameters are tuned for D455 lawn care in config/lawn_care_params.yaml
:
grass_detector:
ros__parameters:
# HSV color range (outdoor optimized)
grass_color_hue_min: 40 # Green hue lower bound
grass_color_hue_max: 80 # Green hue upper bound
# Height thresholds
min_grass_height: 0.02 # 2cm minimum
cutting_threshold: 0.08 # 8cm cutting trigger
# Performance
detection_frequency: 10.0 # 10 Hz detection rate
obstacle_detector:
ros__parameters:
# Detection ranges
min_obstacle_height: 0.10 # 10cm minimum height
max_detection_distance: 10.0 # 10m maximum range
# Safety zones
safety_buffer_distance: 0.5 # 50cm safety buffer
danger_zone_distance: 1.0 # 1m danger zone
/lawn_care/grass_detector/grass_detection
- Grass analysis results/lawn_care/grass_detector/debug_image
- Visualization with overlay/lawn_care/grass_detector/grass_mask
- Binary grass mask
/lawn_care/obstacle_detector/obstacles
- Detected obstacles array/lawn_care/obstacle_detector/obstacle_markers
- RViz visualization/lawn_care/obstacle_detector/debug_image
- Debug visualization
/d455/d455_camera/color/image_raw
- RGB camera feed/d455/d455_camera/aligned_depth_to_color/image_raw
- Aligned depth/d455/d455_camera/depth/color/points
- Point cloud data
✅ Package Built Successfully:
- ROS 2 workspace created and configured
- Custom messages and services defined
- Python nodes with OpenCV dependencies
- Launch files for system integration
- Configuration parameters optimized for D455
✅ D455 Camera Active:
- Streaming at 1280x720 @ 30fps
- Outdoor-optimized settings applied
- All depth processing filters active
- Perfect integration with ROS 2 topics
✅ Ready for Integration:
- Grass detection algorithms implemented
- Obstacle detection and tracking ready
- Calibration services available
- Debug visualizations enabled
-
Test Grass Detection:
python3 ~/lawn_care_ws/src/d455_lawn_care/d455_lawn_care/grass_detector.py
-
Test Obstacle Detection:
python3 ~/lawn_care_ws/src/d455_lawn_care/d455_lawn_care/obstacle_detector.py
-
Launch Complete System:
ros2 launch d455_lawn_care lawn_care_system.launch.py
-
Calibrate for Your Grass:
ros2 service call /lawn_care/grass_detector/calibrate_grass_detection d455_lawn_care/srv/CalibrateGrassDetection "{auto_calibrate: true}"
- OpenCV for computer vision processing
- NumPy for numerical computations
- SciPy for advanced mathematical functions
- scikit-learn for machine learning features
- Matplotlib for data visualization
- cv_bridge for ROS-OpenCV integration
- tf2_ros for coordinate transformations
- The package is built as a pure Python package for easier development
- All parameters are configurable via YAML files
- Debug visualizations help with tuning and debugging
- Custom messages provide structured data for lawn care applications
- Services enable dynamic reconfiguration and calibration