Autonomous dairy farm operations using industrial robotics and distributed systems
Overview โข Features โข Technologies โข Architecture โข Structure โข Contributors
LatteBot is a ROS-based robotic system that automates dairy farm operations using a Universal Robots UR10e manipulator with Robotiq 2F-140 gripper mounted on a 10-meter linear mobile platform. The system demonstrates autonomous bucket handling and delivery to multiple cow stalls through a distributed MQTT/ROS architecture.
graph LR
A[Operator UI] -->|MQTT| B[Bridge]
B -->|ROS| C[Robot Controller]
C --> D[Platform Motion]
C --> E[Arm Planning]
C --> F[Gripper Control]
D --> G[Gazebo Simulation]
E --> G
F --> G
H[Arduino + Weight Sensor] -->|Serial| I[Serial Bridge]
I -->|MQTT| B
System Capabilities:
- ๐ฆพ 6-DOF robotic arm with industrial parallel-jaw gripper
- ๐ 10-meter linear platform for multi-station operations
- ๐ Multi-platform architecture (Linux + Windows coordination)
- ๐ก MQTT/ROS bridge with cloud-based message broker
- ๐ฎ Interactive GUI for sequence planning and monitoring
- โ๏ธ Arduino weight sensors for milk consumption monitoring
|
|
| Technique | Description | File |
|---|---|---|
| URDF/Xacro Macros | Parametric robot descriptions with macro-based assembly | urdf/ur10e.urdf.xacro |
| MoveIt Planning | Collision-aware trajectory planning with named poses | ur10e_moveit_config/ |
| Gazebo Physics | Custom contact parameters (ฮผ=2000, kp=5M) for reliable grasping | models/bucket/model.sdf |
| ROS Control | Hardware abstraction for arm, gripper, and platform | controller/ |
| TF Transforms | Complete kinematic chain from world to end effector | System-wide |
- Thread-Safe Queues: Lock-based sequence execution prevents race conditions โ
bridge_keypad2robot.py - State Machine Pattern: Multi-phase grasp (open โ pre-grasp โ close) โ
robot_movement.py - Action Servers: Non-blocking trajectory execution with feedback
- Dynamic SDF Modification: Runtime model name changes for grasp plugin compatibility
- Paho MQTT: TLS-encrypted pub/sub
- Bidirectional Bridging: MQTT โ ROS topic translation with state tracking
- Distributed Architecture: Windows UI โ Cloud Broker โ Linux Controller
- Tkinter: Custom numerical keypad with sequence planning โ
numerical_keypad.py - Scrollable Canvas: Dynamic content with mousewheel support
- State Visualization: Real-time cow availability tracking
- Custom Binary Protocol: Efficient serial communication with header (
\xff) and payload structure โbridge_serial2MQTT.py - Weight Monitoring: Load cell simulation with button-based weight changes and LCD display
- Auto-detection: COM port discovery via device description matching
- Event-Based Publishing: Triggers MQTT messages when milk consumption thresholds are met or timeout occurs (20 seconds)
- Serial โ MQTT Bridge: Translates Arduino sensor data to MQTT topics (
cow/{calf_num}) for robot coordination
๐ค Robotics Stack
- ROS Noetic - Robot Operating System for Linux/WSL
- MoveIt - Motion planning framework with OMPL/CHOMP planners
- Gazebo 11 - 3D physics simulator with ODE solver
- Universal Robots ROS Drivers - UR10e kinematics and controllers
- Robotiq Gripper Package - 2F-140 gripper URDF with mimic joint plugin
- Gazebo Grasp Plugin - Contact-based grasping simulation
๐ก Communication
- HiveMQ Cloud - Managed MQTT broker with TLS encryption (port 8883)
- Paho MQTT Python - v1.6.1 client library
- PySerial - Arduino integration for weight sensor simulation
๐ Python Environment
- rospy - ROS Python client library
- moveit_commander - Python interface for MoveIt
- tf.transformations - Quaternion and Euler angle conversions
- ConfigParser - INI file parsing for MQTT/serial settings
๐ง Hardware & Embedded
- Arduino - Microcontroller for weight sensor simulation
- Adafruit SSD1306 - OLED display library for weight visualization
- Custom Serial Protocol - Binary message format with header/payload/footer structure
๐ฆ lattebot/
โโโ ๐ .github/ # GitHub configuration
โ โโโ ๐ copilot-instructions.md # Complete system architecture reference
โ โโโ ๐ COPILOT_INSTRUCTIONS_UPDATE.md
โโโ ๐ pkg01/ # Main ROS package โญ
โ โโโ ๐ config/ # MQTT/serial configuration
โ โโโ ๐ controller/ # Joint controller parameters
โ โโโ ๐ launch/ # ROS launch files for simulation
โ โโโ ๐ models/ # Custom Gazebo models (bucket, cow)
โ โโโ ๐ scripts/ # Python control scripts & bridges
โ โ โโโ ๐ robot_movement.py # Main robot controller
โ โ โโโ ๐ bridge_keypad2robot.py # MQTT โ ROS bridge
โ โ โโโ ๐ bridge_serial2MQTT.py # Arduino โ MQTT bridge
โ โ โโโ ๐ pickup_site.py # Operator interface
โ โ โโโ ๐ numerical_keypad.py # GUI components
โ โ โโโ ๐ calf_arduino/ # Arduino firmware
โ โ โโโ ๐ง calf_arduino.ino # Weight sensor code
โ โโโ ๐ urdf/ # Robot description (xacro format)
โ โโโ ๐ world/ # Gazebo world definitions
โ โโโ ๐ claude_explanations/ # Troubleshooting documentation ๐
โ โโโ ๐ meshes/ # 3D models for visualization
โโโ ๐ ur10e_moveit_config/ # MoveIt configuration package โญ
โ โโโ ๐ config/ # Planning parameters & SRDF
โ โโโ ๐ launch/ # Motion planning launch files
โโโ ๐ robotiq/ # Robotiq gripper packages (gitignored)
โโโ ๐ roboticsgroup_gazebo_plugins/ # Mimic joint plugin (gitignored)
โโโ ๐ requirements.txt # Python dependencies
| Directory | Description |
|---|---|
pkg01/claude_explanations/ |
๐ Comprehensive markdown docs covering physics tuning, collision troubleshooting, and grasp reliability - essential reading |
pkg01/scripts/ |
๐ All executable Python scripts: robot controller, MQTT bridges, test utilities |
pkg01/scripts/calf_arduino/ |
๐ง Arduino firmware for weight sensor simulation with OLED display |
pkg01/models/bucket/ |
๐ชฃ Custom SDF model with extreme physics (ฮผ=2000, kp=5M) for stable grasping |
ur10e_moveit_config/config/ |
โ๏ธ MoveIt configuration with manually tuned collision matrices and named poses |
The project uses a three-tier distributed architecture:
| Component | Platform | Purpose |
|---|---|---|
| Operator Interface | Windows | Tkinter GUI for planning cow milking sequences |
| MQTT Bridge | Linux/WSL | Translates MQTT messages to ROS topics with queue management |
| Robot Controller | Linux/WSL | Orchestrates platform motion, MoveIt planning, and gripper control |
| Serial Bridge | Windows | Reads Arduino sensor data and publishes to MQTT |
| Arduino System | Hardware | Monitors bucket weight via load cells with OLED display |
| Gazebo Simulation | Linux/WSL | Executes physics-based movements with contact-based grasping |
MQTT Topics:
Pickup-Siteโ Complete sequence data from operator to bridgecow/{calf_num}โ Weight sensor triggers from Arduino to bridge
ROS Topics:
/calf_numโ Task commands from bridge to robot controller/ur10e_robot/joint_statesโ Joint positions for monitoring/ur10e_robot/*_controller/follow_joint_trajectoryโ Action servers for motion execution
Message Protocol: HiveMQ Cloud broker with QoS 2 (exactly-once delivery) ensures reliable communication across Windows/Linux boundary.
The Arduino communicates via a custom binary protocol over serial (9600 baud):
[ 0xFF | Calf_Num | Weight | 0xFE ]
^ 1 byte 1 byte ^
Header Footer
Trigger Conditions:
- โ
Weight drops below
starting_weight - milk_limitโ Publishes1(cow finished) - โฐ 120-second timeout โ Publishes
0(incomplete feeding)
This project builds upon several open-source robotics packages:
- roboticsgroup_gazebo_plugins - Mimic joint plugin for Robotiq gripper linkage simulation
- ros-industrial-attic/robotiq - Robotiq 2F-140 URDF models and visualization meshes
- gazebo-pkgs - Gazebo grasp fix plugin for contact-based object grasping
- general-message-pkgs - Supporting message definitions for grasp plugin
Casali Cristian |
Flotta Aldo |
Developed as part of Smart Robotics course project, A.Y. 2024/2025