In today's rapidly evolving agricultural landscape, automation is key to enhancing efficiency, reducing costs, and promoting sustainability. This university project proposal outlines a simple, economical, and innovative system for autonomous navigation in agricultural transport. At its core, we leverage the AWS DeepRacer—a compact, affordable robotic vehicle originally designed for machine learning education and racing simulations—modified with high-precision GPS technology. This setup allows small-scale vehicles or equipment to follow real-time routes from Google Maps, making it ideal for transporting crops, fertilizers, or tools between fields and storage facilities.
What is AWS DeepRacer?
The AWS DeepRacer is a 1/18th scale race car developed by Amazon Web Services (AWS) as an educational tool for hands-on learning in reinforcement learning and autonomous driving. It features a built-in camera, onboard computing (Intel Atom processor), and motor controls, running on a lightweight Ubuntu operating system. While originally intended for closed-track racing in AWS competitions, its modular design makes it perfect for customization. In this project, we repurpose it as a prototype for agricultural automation, demonstrating how an accessible platform can scale to real-world applications like guiding transport equipment in farms.
Diagnosis of the Problem
In the agricultural sector, transportation of goods such as crops, fertilizers, and equipment between fields, storage facilities, and markets often involves manual driving, leading to inefficiencies. Farmers and workers lose valuable time navigating routes, especially in large rural areas with variable terrain. Additionally, there are risks of deviations from optimal paths, collisions with obstacles, or delays due to rerouting from roadblocks or weather conditions. Traditional methods rely on human operators, which increase labor costs and error rates. Automation could address these issues by enabling precise, autonomous navigation, reducing operational costs, improving safety, and optimizing resource use in sustainable farming practices. Moreover, in developing regions where farms are small, there's a need for low-cost solutions that don't require expensive machinery.
Justification for the System: Simplicity, Economy, and Ease of Operation
This proposed system stands out for its simplicity and affordability, making it accessible even for small-scale farmers or university research projects. The entire setup uses off-the-shelf components and open-source tools, requiring only basic assembly and scripting skills. Operation is straightforward: users share a Google Maps route link via a mobile phone, and the vehicle navigates autonomously. This "plug-and-play" approach minimizes training time; a farmer could set it up quickly. Scalability is another key justification: starting small with the DeepRacer prototype allows testing in controlled environments before upgrading to larger vehicles. Environmentally, it promotes precision agriculture by minimizing unnecessary travel, aligning with sustainable practices.
General Objective
To develop an autonomous navigation system for agricultural vehicles or transport equipment, based on a modified AWS DeepRacer prototype integrated with RTK GPS technology, capable of following real-time routes from Google Maps with centimeter-level precision.
Specific Objectives
- Integrate a high-precision GPS module (u-blox ZED-F9P) with an external antenna into the DeepRacer for accurate positioning in open fields.
- Develop software scripts to dynamically parse Google Maps shared links, extract all waypoints from the route polyline, and send them to the vehicle for sequential navigation.
- Implement persistent memory in the system to store waypoints, allowing route recovery in case of interruptions or restarts, with tolerance for slight variations in arrival points (e.g., different spots in the same field area).
- Test the prototype on a simulated route representing agricultural transport (e.g., from a field to a storage barn), evaluating precision, reliability, and adaptability to changes.
- Incorporate sustainable energy options, such as using small solar panels to power the navigation electronics, ensuring the system operates off-grid in remote farms.
Methodology
The project follows a prototyping approach divided into hardware integration and software development:
- Hardware: Use the AWS DeepRacer as the base vehicle. Connect the u-blox ZED-F9P GPS module via UART/USB to the DeepRacer's serial port. Mount an external antenna on the vehicle's roof for optimal signal. To enhance sustainability, integrate a small solar panel (5-10W) connected to the battery via a charge controller. This powers only the navigation components, allowing extended off-grid operation in sunny agricultural regions.
- Software: On the DeepRacer (Ubuntu-based), create a background service script (copilot.py) that reads GPS data, processes waypoints, and controls movement. On a control device (Android with Termux), develop a script to fetch routes via Google Directions API, decode all detailed waypoints, and transmit them via SSH.
- Google Maps API Technology: The system uses the Google Directions API to obtain optimized routes. A shared Maps link is parsed to extract the encoded polyline, which is decoded into hundreds of precise latitude-longitude waypoints using Python's polyline library. This ensures the vehicle follows every curve and intersection accurately. The API is reliable, updated globally, and free for low-volume use, making the system easy to deploy without custom mapping.
- Testing: Conduct field tests on a representative route, measuring arrival precision, route update time, tolerance to deviations, and solar energy performance.
Expected Results
The prototype will autonomously navigate test routes with high precision and tolerance for variable endpoints. The system will handle dynamic updates and persist data for reliability. Solar integration will extend operational time significantly. The modular design demonstrates scalability to larger agricultural vehicles, potentially reducing transport time and operational costs while promoting sustainable practices.
Conclusion
This proposal presents a viable, low-cost, and simple solution for automating agricultural transport. By combining the accessible AWS DeepRacer platform with RTK GPS and Google Maps API, and adding solar-powered navigation, it democratizes automation for smallholders and researchers worldwide, contributing to more efficient and sustainable farming.
Technical Annexes: Installation Scripts
1. DeepRacer: Install dependencies and create copilot.py service (run via SSH)
pkg update -y && pkg upgrade -y && pkg install -y python3 python3-pip pyserial && pip install pyubx2 && cat > /root/copilot.py << 'EOF'
import os
import time
import serial
from pyubx2 import UBXReader
from math import radians, sin, cos, sqrt, atan2
GPS_PORT = '/dev/ttyACM0' # Adjust if necessary (check with ls /dev/tty*)
COMMAND_FILE = '/tmp/comando.txt'
WAYPOINTS_FILE = '/root/waypoints.json'
def haversine(lat1, lon1, lat2, lon2):
R = 6371000
dlat = radians(lat2 - lat1)
dlon = radians(lon2 - lon1)
a = sin(dlat/2)**2 + cos(radians(lat1)) * cos(radians(lat2)) * sin(dlon/2)**2
c = 2 * atan2(sqrt(a), sqrt(1-a))
return R * c
waypoints = []
current_idx = 0
if os.path.exists(WAYPOINTS_FILE):
import json
with open(WAYPOINTS_FILE) as f:
data = json.load(f)
waypoints = data['wps']
current_idx = data['idx']
while True:
if os.path.exists(COMMAND_FILE):
with open(COMMAND_FILE, 'r') as f:
cmd = f.read().strip()
os.remove(COMMAND_FILE)
if cmd.startswith('ROUTE '):
import json
waypoints = json.loads(cmd[6:])
current_idx = 0
with open(WAYPOINTS_FILE, 'w') as f:
json.dump({'wps': waypoints, 'idx': current_idx}, f)
if waypoints and len(waypoints) > current_idx:
target_lat, target_lon = waypoints[current_idx]
try:
stream = serial.Serial(GPS_PORT, 9600, timeout=1)
ubr = UBXReader(stream)
for (raw_data, parsed_data) in ubr:
if parsed_data.identity == 'NAV-PVT':
lat = parsed_data.lat
lon = parsed_data.lon
if lat and lon:
dist = haversine(lat, lon, target_lat, target_lon)
if dist < 15: # Tolerance for variable arrival points
current_idx += 1
with open(WAYPOINTS_FILE, 'w') as f:
json.dump({'wps': waypoints, 'idx': current_idx}, f)
break
except:
pass
time.sleep(1)
EOF
&& python /root/copilot.py & disown
2. DeepRacer: Add copilot to startup (run via SSH)
cat > /etc/systemd/system/copilot.service << 'EOF'
[Unit]
Description=Copilot GPS Autonomous Service for Agricultural Vehicle
After=network.target
[Service]
ExecStart=/usr/bin/python3 /root/copilot.py
WorkingDirectory=/root
StandardOutput=inherit
StandardError=inherit
Restart=always
User=root
[Install]
WantedBy=multi-user.target
EOF
&& systemctl daemon-reload && systemctl enable copilot.service && systemctl start copilot.service && echo "Copilot service enabled on boot"
3. Termux (Android control device): Install dependencies
pkg update -y && pkg upgrade -y && pkg install -y python termux-api clang make openssl && pip install requests polyline
4. Termux: Control script copilot.py
cat > ~/copilot.py << 'EOF'
import sys
import requests
import polyline
import json
import subprocess
import re
if len(sys.argv) < 3:
print("Usage: python copilot.py ")
sys.exit(1)
IP = sys.argv[1]
LINK = sys.argv[2]
# Replace with your Google Directions API key (free at console.cloud.google.com)
API_KEY = 'YOUR_API_KEY_HERE'
# Extract approximate coordinates from shared link
response = requests.get(LINK)
match = re.search(r'@(-?[\d.]+),(-?[\d.]+)', response.text)
if not match:
print("Could not extract coordinates from link")
sys.exit(1)
origin_lat, origin_lon = float(match.group(1)), float(match.group(2))
origin = f"{origin_lat},{origin_lon}"
destination = f"{origin_lat + 0.005},{origin_lon + 0.005}" # Adjust or improve parsing as needed
url = f"https://maps.googleapis.com/maps/api/directions/json?origin={origin}&destination={destination}&key={API_KEY}"
data = requests.get(url).json()
if 'routes' in data and data['routes']:
encoded = data['routes'][0]['overview_polyline']['points']
waypoints = polyline.decode(encoded)
cmd = 'ROUTE ' + json.dumps(waypoints)
subprocess.run(['ssh', f'root@{IP}', f"echo '{cmd}' > /tmp/comando.txt"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
print(f"Route with {len(waypoints)} waypoints sent. Autonomous navigation started.")
else:
print("Error fetching route")
EOF
&& chmod +x ~/copilot.py
Usage: Create a route in Google Maps → Share → Copy link → Run in Termux:
python ~/copilot.py 192.168.43.100 "https://maps.app.goo.gl/your_link_here"
No comments:
Post a Comment